From 35ba24b32bee989e935ccadd12ca0deb5dfa1264 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 30 Apr 2024 10:42:34 +0000 Subject: [PATCH] Add an abort test --- tests/integration.rs | 4 ++++ tests/integrations/basic-fail/Cargo.stdout | 18 ++++++++++++++++-- .../tests/actual_tests_bless/abort.rs | 5 +++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tests/integrations/basic-fail/tests/actual_tests_bless/abort.rs diff --git a/tests/integration.rs b/tests/integration.rs index f036d4a6..b11a9578 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -86,6 +86,10 @@ fn main() -> Result<()> { "(/target/ui/tests/integrations/[^/]+).*debug/deps", "$1/debug/deps", ); + // abort messages are different on macos + config.stdout_filter(r#" \(core dumped\)"#, ""); + // abort messages are different on windows + config.stdout_filter(r#"exit status: 0xc0000409"#, "signal: 6 (SIGABRT)"); let text = ui_test::status_emitter::Text::from(args.format); diff --git a/tests/integrations/basic-fail/Cargo.stdout b/tests/integrations/basic-fail/Cargo.stdout index 2e0c4e04..d3983efb 100644 --- a/tests/integrations/basic-fail/Cargo.stdout +++ b/tests/integrations/basic-fail/Cargo.stdout @@ -454,9 +454,10 @@ FAILURES: test result: FAIL. 15 failed; +Building dependencies ... ok +tests/actual_tests_bless/abort.rs ... FAILED tests/actual_tests_bless/aux_build_not_found.rs ... FAILED tests/actual_tests_bless/aux_proc_macro_misuse.rs ... FAILED -Building dependencies ... ok Building aux file tests/actual_tests_bless/auxiliary/the_proc_macro.rs ... ok tests/actual_tests_bless/aux_proc_macro_no_main.rs ... FAILED tests/actual_tests_bless/compile_flags_quotes.rs ... FAILED @@ -497,6 +498,18 @@ tests/actual_tests_bless/unknown_revision.rs ... FAILED tests/actual_tests_bless/unknown_revision2.rs ... FAILED tests/actual_tests_bless/wrong_diagnostic_code.rs ... FAILED +FAILED TEST: tests/actual_tests_bless/abort.rs +command: "$CMD" + +error: run(0) test got signal: 6 (SIGABRT), but expected 0 + = note: the test was expected to run successfully + +full stderr: + +full stdout: + + + FAILED TEST: tests/actual_tests_bless/aux_build_not_found.rs command: "$CMD" @@ -1010,6 +1023,7 @@ full stdout: FAILURES: + tests/actual_tests_bless/abort.rs tests/actual_tests_bless/aux_build_not_found.rs tests/actual_tests_bless/aux_proc_macro_misuse.rs tests/actual_tests_bless/aux_proc_macro_no_main.rs @@ -1032,7 +1046,7 @@ FAILURES: tests/actual_tests_bless/unknown_revision2.rs tests/actual_tests_bless/wrong_diagnostic_code.rs -test result: FAIL. 21 failed; 14 passed; 3 ignored; +test result: FAIL. 22 failed; 14 passed; 3 ignored; Building dependencies ... ok tests/actual_tests_bless_yolo/revisions_bad.rs (revision `foo`) ... ok diff --git a/tests/integrations/basic-fail/tests/actual_tests_bless/abort.rs b/tests/integrations/basic-fail/tests/actual_tests_bless/abort.rs new file mode 100644 index 00000000..8b200a11 --- /dev/null +++ b/tests/integrations/basic-fail/tests/actual_tests_bless/abort.rs @@ -0,0 +1,5 @@ +//@run + +fn main() { + std::process::abort(); +}