From b7d98618b6d9e0dcd7cd7e010b42145fb041d02c Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sun, 29 Dec 2024 13:30:55 -0500 Subject: [PATCH] test: relax panic output assertion rust-lang/rust#122565 adds a new line to thread panic output. To make the current test suites works on stable, beta, and nightly, similar to rust-lang/cargo#14602, this relaxes the assertion around that by globbing everything. --- tests/build-std/main.rs | 1 + tests/testsuite/build_script.rs | 18 ++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/build-std/main.rs b/tests/build-std/main.rs index 976fc7e141b..ffe9f426492 100644 --- a/tests/build-std/main.rs +++ b/tests/build-std/main.rs @@ -376,6 +376,7 @@ fn remap_path_scope() { str![[r#" [FINISHED] `release` profile [optimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] `target/[HOST_TARGET]/release/foo` +... [..]thread '[..]' panicked at [..]src/main.rs:3:[..]: [..]remap to /rustc/[..] [..]at /rustc/[..]/library/std/src/[..] diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 78af30351ca..280575ec6a2 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -4000,7 +4000,7 @@ fn warnings_emitted_when_build_script_panics() { fn main() { println!("cargo::warning=foo"); println!("cargo::warning=bar"); - panic!(); + panic!("our crate panicked"); } "#, ) @@ -4022,10 +4022,9 @@ Caused by: cargo::warning=bar --- stderr - thread 'main' panicked at build.rs:5:21: - explicit panic - [NOTE] run with `RUST_BACKTRACE=1` environment variable to display a backtrace - +... +[..]our crate panicked[..] +... "#]]) .run(); } @@ -4039,7 +4038,7 @@ fn warnings_emitted_when_dependency_panics() { fn main() { println!("cargo::warning=foo"); println!("cargo::warning=bar"); - panic!(); + panic!("dependency panicked"); } "#, ) @@ -4093,10 +4092,9 @@ Caused by: cargo::warning=bar --- stderr - thread 'main' panicked at [ROOT]/home/.cargo/registry/src/-[HASH]/published-0.1.0/build.rs:5:21: - explicit panic - [NOTE] run with `RUST_BACKTRACE=1` environment variable to display a backtrace - +... +[..]dependency panicked[..] +... "#]]) .run(); }