mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-18 03:56:42 +00:00
Add cfg(ktest)
as a well-known configuration
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
ab1d931cb7
commit
8633893bb9
@ -209,6 +209,9 @@ fn build_kernel_elf(
|
|||||||
// We do not really allow unwinding except for kernel testing. However, we need to specify
|
// We do not really allow unwinding except for kernel testing. However, we need to specify
|
||||||
// this to show backtraces when panicking.
|
// this to show backtraces when panicking.
|
||||||
"-C panic=unwind",
|
"-C panic=unwind",
|
||||||
|
// This is to let rustc know that "cfg(ktest)" is our well-known configuration.
|
||||||
|
// See the [Rust Blog](https://blog.rust-lang.org/2024/05/06/check-cfg.html) for details.
|
||||||
|
"--check-cfg cfg(ktest)",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if matches!(arch, Arch::X86_64) {
|
if matches!(arch, Arch::X86_64) {
|
||||||
|
@ -24,6 +24,12 @@ pub fn execute_forwarded_command(subcommand: &str, args: &Vec<String>) -> ! {
|
|||||||
cargo.arg("--target").arg(get_default_arch().triple());
|
cargo.arg("--target").arg(get_default_arch().triple());
|
||||||
}
|
}
|
||||||
cargo.args(args);
|
cargo.args(args);
|
||||||
|
|
||||||
|
let env_rustflags = std::env::var("RUSTFLAGS").unwrap_or_default();
|
||||||
|
let rustflags = env_rustflags + " --check-cfg cfg(ktest)";
|
||||||
|
|
||||||
|
cargo.env("RUSTFLAGS", rustflags);
|
||||||
|
|
||||||
let status = cargo.status().expect("Failed to execute cargo");
|
let status = cargo.status().expect("Failed to execute cargo");
|
||||||
std::process::exit(status.code().unwrap_or(1));
|
std::process::exit(status.code().unwrap_or(1));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user