Skip to content

Commit aa8f995

Browse files
committed
add info to rust-ldd tests failures
1 parent 86cbabb commit aa8f995

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

tests/run-make/rust-lld-by-default/rmake.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ fn main() {
1717
.input("main.rs")
1818
.run();
1919
assert!(
20-
find_lld_version_in_logs(output),
21-
"the LLD version string should be present in the output logs"
20+
find_lld_version_in_logs(&output),
21+
"the LLD version string should be present in the output logs:\n{}",
22+
std::str::from_utf8(&output.stderr).unwrap()
2223
);
2324

2425
// But it can still be disabled by turning the linker feature off.
@@ -29,12 +30,13 @@ fn main() {
2930
.input("main.rs")
3031
.run();
3132
assert!(
32-
!find_lld_version_in_logs(output),
33-
"the LLD version string should not be present in the output logs"
33+
!find_lld_version_in_logs(&output),
34+
"the LLD version string should not be present in the output logs:\n{}",
35+
std::str::from_utf8(&output.stderr).unwrap()
3436
);
3537
}
3638

37-
fn find_lld_version_in_logs(output: Output) -> bool {
39+
fn find_lld_version_in_logs(output: &Output) -> bool {
3840
let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
3941
let stderr = std::str::from_utf8(&output.stderr).unwrap();
4042
stderr.lines().any(|line| lld_version_re.is_match(line))

tests/run-make/rust-lld-custom-target/rmake.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ fn main() {
2323
.input("lib.rs")
2424
.run();
2525
assert!(
26-
find_lld_version_in_logs(output),
27-
"the LLD version string should be present in the output logs"
26+
find_lld_version_in_logs(&output),
27+
"the LLD version string should be present in the output logs:\n{}",
28+
std::str::from_utf8(&output.stderr).unwrap()
2829
);
2930

3031
// But it can also be disabled via linker features.
@@ -37,12 +38,13 @@ fn main() {
3738
.input("lib.rs")
3839
.run();
3940
assert!(
40-
!find_lld_version_in_logs(output),
41-
"the LLD version string should not be present in the output logs"
41+
!find_lld_version_in_logs(&output),
42+
"the LLD version string should not be present in the output logs:\n{}",
43+
std::str::from_utf8(&output.stderr).unwrap()
4244
);
4345
}
4446

45-
fn find_lld_version_in_logs(output: Output) -> bool {
47+
fn find_lld_version_in_logs(output: &Output) -> bool {
4648
let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
4749
let stderr = std::str::from_utf8(&output.stderr).unwrap();
4850
stderr.lines().any(|line| lld_version_re.is_match(line))

tests/run-make/rust-lld/rmake.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ fn main() {
2121
.input("main.rs")
2222
.run();
2323
assert!(
24-
find_lld_version_in_logs(output),
25-
"the LLD version string should be present in the output logs"
24+
find_lld_version_in_logs(&output),
25+
"the LLD version string should be present in the output logs:\n{}",
26+
std::str::from_utf8(&output.stderr).unwrap()
2627
);
2728

2829
// It should not be used when we explictly opt-out of lld.
@@ -33,8 +34,9 @@ fn main() {
3334
.input("main.rs")
3435
.run();
3536
assert!(
36-
!find_lld_version_in_logs(output),
37-
"the LLD version string should not be present in the output logs"
37+
!find_lld_version_in_logs(&output),
38+
"the LLD version string should not be present in the output logs:\n{}",
39+
std::str::from_utf8(&output.stderr).unwrap()
3840
);
3941

4042
// While we're here, also check that the last linker feature flag "wins" when passed multiple
@@ -50,12 +52,13 @@ fn main() {
5052
.input("main.rs")
5153
.run();
5254
assert!(
53-
find_lld_version_in_logs(output),
54-
"the LLD version string should be present in the output logs"
55+
find_lld_version_in_logs(&output),
56+
"the LLD version string should be present in the output logs:\n{}",
57+
std::str::from_utf8(&output.stderr).unwrap()
5558
);
5659
}
5760

58-
fn find_lld_version_in_logs(output: Output) -> bool {
61+
fn find_lld_version_in_logs(output: &Output) -> bool {
5962
let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
6063
let stderr = std::str::from_utf8(&output.stderr).unwrap();
6164
stderr.lines().any(|line| lld_version_re.is_match(line))

0 commit comments

Comments
 (0)