From 973e4601e405cbcf086f293e97715712664a45d5 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Mon, 21 Jun 2021 20:05:24 +0800 Subject: [PATCH] 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 --- kernel/build.rs | 6 ++++++ kernel/src/main.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/build.rs b/kernel/build.rs index 23065a78d..7b30e8adf 100644 --- a/kernel/build.rs +++ b/kernel/build.rs @@ -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"); + } } diff --git a/kernel/src/main.rs b/kernel/src/main.rs index ad2d4cf8d..bb682f39c 100644 --- a/kernel/src/main.rs +++ b/kernel/src/main.rs @@ -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| {