From 6a1842fc1af10a4c63dc590f01b9f76551d3a361 Mon Sep 17 00:00:00 2001 From: Tim Buchwaldt Date: Fri, 14 Oct 2022 08:19:18 +0200 Subject: [PATCH 1/3] Use error logger in timeout condition Signed-off-by: Tim Buchwaldt --- core-dump-composer/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-dump-composer/src/main.rs b/core-dump-composer/src/main.rs index bb5e8a9..c4361d1 100644 --- a/core-dump-composer/src/main.rs +++ b/core-dump-composer/src/main.rs @@ -33,7 +33,7 @@ fn main() -> Result<(), anyhow::Error> { match result { Ok(inner_result) => inner_result, Err(_error) => { - println!("timeout"); + error!("Timeout error during coredump processing."); process::exit(1); } } From 517f09d7d8a87725c4e46496834cdfd8322ca490 Mon Sep 17 00:00:00 2001 From: Tim Buchwaldt Date: Sun, 19 Feb 2023 11:47:12 +0100 Subject: [PATCH 2/3] Pass timeout test on exit-code alone Signed-off-by: Tim Buchwaldt --- core-dump-composer/tests/timeout.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core-dump-composer/tests/timeout.rs b/core-dump-composer/tests/timeout.rs index 4d2d8f3..ba05dd9 100644 --- a/core-dump-composer/tests/timeout.rs +++ b/core-dump-composer/tests/timeout.rs @@ -65,8 +65,7 @@ fn timeout_scenario() -> Result<(), std::io::Error> { .output() .expect("Couldn't execute"); - println!("{}", String::from_utf8_lossy(&cdc.stdout)); - assert_eq!("timeout\n", String::from_utf8_lossy(&cdc.stdout)); + // FIXME: It would be nice to check the log output here. assert_eq!(1, *&cdc.status.code().unwrap()); Ok(()) } From cbc5f298d8a54e18e6f258826cb02df5427d30bf Mon Sep 17 00:00:00 2001 From: Tim Buchwaldt Date: Sun, 19 Feb 2023 11:52:06 +0100 Subject: [PATCH 3/3] Switch to exit code 32 for timeouts No special meaning here, just a random non-reserved exit-code. Signed-off-by: Tim Buchwaldt --- core-dump-composer/src/main.rs | 2 +- core-dump-composer/tests/timeout.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core-dump-composer/src/main.rs b/core-dump-composer/src/main.rs index 7358b72..2a95ad9 100644 --- a/core-dump-composer/src/main.rs +++ b/core-dump-composer/src/main.rs @@ -37,7 +37,7 @@ fn main() -> Result<(), anyhow::Error> { Ok(inner_result) => inner_result, Err(_error) => { error!("Timeout error during coredump processing."); - process::exit(1); + process::exit(32); } } } diff --git a/core-dump-composer/tests/timeout.rs b/core-dump-composer/tests/timeout.rs index ba05dd9..a4b27e1 100644 --- a/core-dump-composer/tests/timeout.rs +++ b/core-dump-composer/tests/timeout.rs @@ -66,6 +66,6 @@ fn timeout_scenario() -> Result<(), std::io::Error> { .expect("Couldn't execute"); // FIXME: It would be nice to check the log output here. - assert_eq!(1, *&cdc.status.code().unwrap()); + assert_eq!(32, *&cdc.status.code().unwrap()); Ok(()) }