Skip to content

Commit f18cb8a

Browse files
committed
add info to rust-ldd tests failures
1 parent 4e82ed5 commit f18cb8a

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
@@ -19,8 +19,9 @@ fn main() {
1919
.input("main.rs")
2020
.run();
2121
assert!(
22-
find_lld_version_in_logs(output),
23-
"the LLD version string should be present in the output logs"
22+
find_lld_version_in_logs(&output),
23+
"the LLD version string should be present in the output logs:\n{}",
24+
std::str::from_utf8(&output.stderr).unwrap()
2425
);
2526

2627
// But it can still be disabled by turning the linker feature off.
@@ -31,12 +32,13 @@ fn main() {
3132
.input("main.rs")
3233
.run();
3334
assert!(
34-
!find_lld_version_in_logs(output),
35-
"the LLD version string should not be present in the output logs"
35+
!find_lld_version_in_logs(&output),
36+
"the LLD version string should not be present in the output logs:\n{}",
37+
std::str::from_utf8(&output.stderr).unwrap()
3638
);
3739
}
3840

39-
fn find_lld_version_in_logs(output: Output) -> bool {
41+
fn find_lld_version_in_logs(output: &Output) -> bool {
4042
let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
4143
let stderr = std::str::from_utf8(&output.stderr).unwrap();
4244
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)