about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2024-05-24 15:46:42 +0000
committerlcnr <rust@lcnr.de>2024-05-30 15:26:49 +0200
commitaa8f995b89b939fa4e7528b42df36b1eeec4731d (patch)
treefdc71668c38d7492c77c97e11f3528b6256e463f
parent86cbabbb9d41c8e7bb3b4716e1bb224163532f4e (diff)
downloadrust-aa8f995b89b939fa4e7528b42df36b1eeec4731d.tar.gz
rust-aa8f995b89b939fa4e7528b42df36b1eeec4731d.zip
add info to rust-ldd tests failures
-rw-r--r--tests/run-make/rust-lld-by-default/rmake.rs12
-rw-r--r--tests/run-make/rust-lld-custom-target/rmake.rs12
-rw-r--r--tests/run-make/rust-lld/rmake.rs17
3 files changed, 24 insertions, 17 deletions
diff --git a/tests/run-make/rust-lld-by-default/rmake.rs b/tests/run-make/rust-lld-by-default/rmake.rs
index 6a8dae1043e..b46988da503 100644
--- a/tests/run-make/rust-lld-by-default/rmake.rs
+++ b/tests/run-make/rust-lld-by-default/rmake.rs
@@ -17,8 +17,9 @@ fn main() {
         .input("main.rs")
         .run();
     assert!(
-        find_lld_version_in_logs(output),
-        "the LLD version string should be present in the output logs"
+        find_lld_version_in_logs(&output),
+        "the LLD version string should be present in the output logs:\n{}",
+        std::str::from_utf8(&output.stderr).unwrap()
     );
 
     // But it can still be disabled by turning the linker feature off.
@@ -29,12 +30,13 @@ fn main() {
         .input("main.rs")
         .run();
     assert!(
-        !find_lld_version_in_logs(output),
-        "the LLD version string should not be present in the output logs"
+        !find_lld_version_in_logs(&output),
+        "the LLD version string should not be present in the output logs:\n{}",
+        std::str::from_utf8(&output.stderr).unwrap()
     );
 }
 
-fn find_lld_version_in_logs(output: Output) -> bool {
+fn find_lld_version_in_logs(output: &Output) -> bool {
     let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
     let stderr = std::str::from_utf8(&output.stderr).unwrap();
     stderr.lines().any(|line| lld_version_re.is_match(line))
diff --git a/tests/run-make/rust-lld-custom-target/rmake.rs b/tests/run-make/rust-lld-custom-target/rmake.rs
index 9bdb69f47d8..4eb85857463 100644
--- a/tests/run-make/rust-lld-custom-target/rmake.rs
+++ b/tests/run-make/rust-lld-custom-target/rmake.rs
@@ -23,8 +23,9 @@ fn main() {
         .input("lib.rs")
         .run();
     assert!(
-        find_lld_version_in_logs(output),
-        "the LLD version string should be present in the output logs"
+        find_lld_version_in_logs(&output),
+        "the LLD version string should be present in the output logs:\n{}",
+        std::str::from_utf8(&output.stderr).unwrap()
     );
 
     // But it can also be disabled via linker features.
@@ -37,12 +38,13 @@ fn main() {
         .input("lib.rs")
         .run();
     assert!(
-        !find_lld_version_in_logs(output),
-        "the LLD version string should not be present in the output logs"
+        !find_lld_version_in_logs(&output),
+        "the LLD version string should not be present in the output logs:\n{}",
+        std::str::from_utf8(&output.stderr).unwrap()
     );
 }
 
-fn find_lld_version_in_logs(output: Output) -> bool {
+fn find_lld_version_in_logs(output: &Output) -> bool {
     let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
     let stderr = std::str::from_utf8(&output.stderr).unwrap();
     stderr.lines().any(|line| lld_version_re.is_match(line))
diff --git a/tests/run-make/rust-lld/rmake.rs b/tests/run-make/rust-lld/rmake.rs
index feeb82e709e..e186bc700d3 100644
--- a/tests/run-make/rust-lld/rmake.rs
+++ b/tests/run-make/rust-lld/rmake.rs
@@ -21,8 +21,9 @@ fn main() {
         .input("main.rs")
         .run();
     assert!(
-        find_lld_version_in_logs(output),
-        "the LLD version string should be present in the output logs"
+        find_lld_version_in_logs(&output),
+        "the LLD version string should be present in the output logs:\n{}",
+        std::str::from_utf8(&output.stderr).unwrap()
     );
 
     // It should not be used when we explictly opt-out of lld.
@@ -33,8 +34,9 @@ fn main() {
         .input("main.rs")
         .run();
     assert!(
-        !find_lld_version_in_logs(output),
-        "the LLD version string should not be present in the output logs"
+        !find_lld_version_in_logs(&output),
+        "the LLD version string should not be present in the output logs:\n{}",
+        std::str::from_utf8(&output.stderr).unwrap()
     );
 
     // While we're here, also check that the last linker feature flag "wins" when passed multiple
@@ -50,12 +52,13 @@ fn main() {
         .input("main.rs")
         .run();
     assert!(
-        find_lld_version_in_logs(output),
-        "the LLD version string should be present in the output logs"
+        find_lld_version_in_logs(&output),
+        "the LLD version string should be present in the output logs:\n{}",
+        std::str::from_utf8(&output.stderr).unwrap()
     );
 }
 
-fn find_lld_version_in_logs(output: Output) -> bool {
+fn find_lld_version_in_logs(output: &Output) -> bool {
     let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
     let stderr = std::str::from_utf8(&output.stderr).unwrap();
     stderr.lines().any(|line| lld_version_re.is_match(line))