kernel: don't use debug_here in CI

When running in CI, cause processes to panic rather than waiting for a
debugger to attach. This will ensure test failures are caught sooner
rather than later.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-06-21 20:05:24 +08:00
parent 4901453e3d
commit 973e4601e4
2 changed files with 7 additions and 1 deletions

View file

@ -46,4 +46,10 @@ fn main() {
}
println!("cargo:rerun-if-changed=build.rs");
// CI sets this variable. This changes how the panic handler works.
println!("cargo:rerun-if-env-changed=CI");
if option_env!("CI").is_some() {
println!("cargp:rustc-cfg=ci");
}
}

View file

@ -142,7 +142,7 @@ pub extern "C" fn kmain() {
// Note that at this point, no new direct children of INIT may be created.
let mut pid = None;
#[cfg(not(target_os = "none"))]
#[cfg(not(any(target_os = "none", all(ci, test))))]
{
use std::panic;
panic::set_hook(Box::new(|arg| {