Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move test kernels to a separate workspace #486

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- uses: r7kamura/[email protected]
- name: "Run `cargo check`"
run: cargo check --all-targets --all
- name: "Check test kernels"
run: cargo check --all
working-directory: tests/test_kernels
- name: "Check docs.rs build"
run: cargo check
env:
Expand Down Expand Up @@ -89,6 +92,8 @@ jobs:
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]
- run: cargo fmt --all -- --check
- run: cargo fmt --all -- --check
working-directory: tests/test_kernels

clippy:
name: Clippy
Expand All @@ -99,6 +104,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
- uses: r7kamura/[email protected]
- run: cargo clippy --all --all-targets
- run: cargo clippy --all
working-directory: tests/test_kernels

semver-checks:
name: Semver Checks
Expand Down
9 changes: 0 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 1 addition & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cargo-features = ["profile-rustflags"]

[package]
name = "bootloader"
description = "An experimental x86_64 bootloader that works on both BIOS and UEFI systems."
Expand All @@ -19,17 +17,8 @@ members = [
"bios/stage-*",
"bios/common",
"tests/runner",
"tests/test_kernels/default_settings",
"tests/test_kernels/map_phys_mem",
"tests/test_kernels/higher_half",
"tests/test_kernels/pie",
"tests/test_kernels/lto",
"tests/test_kernels/ramdisk",
"tests/test_kernels/min_stack",
"tests/test_kernels/lower_memory_free",
"tests/test_kernels/write_usable_memory",
]
exclude = ["examples/basic", "examples/test_framework"]
exclude = ["examples/basic", "examples/test_framework", "tests/test_kernels/*"]

[workspace.package]
# don't forget to update `workspace.dependencies` below
Expand Down Expand Up @@ -110,23 +99,6 @@ inherits = "release"
debug = true
overflow-checks = true

[profile.lto]
inherits = "release"
lto = true

[profile.test.package.test_kernel_higher_half]
rustflags = [
"-C",
"link-args=--image-base 0xFFFF800000000000",
"-C",
"relocation-model=pic",
"-C",
"code-model=large",
]

[profile.test.package.test_kernel_min_stack]
opt-level = 2

[build-dependencies]
llvm-tools = "0.1.1"

Expand Down
2 changes: 1 addition & 1 deletion tests/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use bootloader_test_runner::run_test_kernel;
fn basic_boot() {
// build test kernel manually to force-enable link-time optimization
let mut cmd = Command::new(std::env::var("CARGO").unwrap_or_else(|_| "cargo".into()));
cmd.current_dir("tests/test_kernels");
cmd.arg("build");
cmd.arg("-p").arg("test_kernel_lto");
cmd.arg("--target").arg("x86_64-unknown-none");
cmd.arg("--profile").arg("lto");
let status = cmd.status().unwrap();
assert!(status.success());
Expand Down
1 change: 1 addition & 0 deletions tests/test_kernels/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[build]
target-dir = "../../target"
target = "x86_64-unknown-none"
141 changes: 141 additions & 0 deletions tests/test_kernels/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions tests/test_kernels/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
cargo-features = ["profile-rustflags"]

[workspace]
resolver = "2"
members = [
"default_settings",
"map_phys_mem",
"higher_half",
"pie",
"lto",
"ramdisk",
"min_stack",
"lower_memory_free",
"write_usable_memory",
]

[profile.release]
panic = "abort"
lto = false
debug = true
overflow-checks = true

[profile.lto]
inherits = "release"
lto = true

[profile.test.package.test_kernel_higher_half]
rustflags = [
"-C",
"link-args=--image-base 0xFFFF800000000000",
"-C",
"relocation-model=pic",
"-C",
"code-model=large",
]

[profile.test.package.test_kernel_min_stack]
opt-level = 2
Loading