Skip to content

Commit b3c5132

Browse files
committed
make assert_stderr_contains print its contents on panic
1 parent 03a4259 commit b3c5132

File tree

5 files changed

+18
-33
lines changed

5 files changed

+18
-33
lines changed

src/tools/cargo

Submodule cargo updated 74 files

src/tools/run-make-support/src/rustc.rs

-12
Original file line numberDiff line numberDiff line change
@@ -236,18 +236,6 @@ impl Rustc {
236236
self
237237
}
238238

239-
/// Add an extra argument to prepend the linker invocation, via `-Zpre-link-arg`.
240-
pub fn pre_link_arg(&mut self, link_arg: &str) -> &mut Self {
241-
self.cmd.arg(format!("-Zpre-link-arg={link_arg}"));
242-
self
243-
}
244-
245-
/// Add multiple extra arguments to the linker invocation, via `-Zpre-link-args`.
246-
pub fn pre_link_args(&mut self, link_args: &str) -> &mut Self {
247-
self.cmd.arg(format!("-Zpre-link-args={link_args}"));
248-
self
249-
}
250-
251239
/// Specify a stdin input
252240
pub fn stdin<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self {
253241
self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice());

tests/run-make/link-args-order/rmake.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,28 @@
33
// checks that linker arguments remain intact and in the order they were originally passed in.
44
// See https://github.com/rust-lang/rust/pull/70665
55

6+
//@ ignore-msvc
7+
// Reason: the ld linker does not exist on Windows.
8+
69
use run_make_support::rustc;
710

811
fn main() {
912
rustc()
1013
.input("empty.rs")
1114
.linker_flavor("ld")
1215
.link_arg("a")
13-
.link_args("\"b c\"")
14-
.link_args("\"d e\"")
16+
.link_args("b c")
17+
.link_args("d e")
1518
.link_arg("f")
1619
.run_fail()
17-
.assert_stderr_contains("\"a\" \"b\" \"c\" \"d\" \"e\" \"f\"");
20+
.assert_stderr_contains(r#""a" "b" "c" "d" "e" "f""#);
1821
rustc()
1922
.input("empty.rs")
2023
.linker_flavor("ld")
21-
.pre_link_arg("a")
22-
.pre_link_args("\"b c\"")
23-
.pre_link_args("\"d e\"")
24-
.pre_link_arg("f")
24+
.arg("-Zpre-link-arg=a")
25+
.arg("-Zpre-link-args=b c")
26+
.arg("-Zpre-link-args=d e")
27+
.arg("-Zpre-link-arg=f")
2528
.run_fail()
26-
.assert_stderr_contains("\"a\" \"b\" \"c\" \"d\" \"e\" \"f\"");
29+
.assert_stderr_contains(r#""a" "b" "c" "d" "e" "f""#);
2730
}

tests/run-make/lto-readonly-lib/rmake.rs

+5-11
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,12 @@
88
//@ ignore-cross-compile
99

1010
use run_make_support::fs_wrapper;
11-
use run_make_support::{cwd, run, rustc};
11+
use run_make_support::{run, rust_lib_name, rustc, test_while_readonly};
1212

1313
fn main() {
1414
rustc().input("lib.rs").run();
15-
let entries = fs_wrapper::read_dir(cwd());
16-
for entry in entries {
17-
if entry.path().extension().and_then(|s| s.to_str()) == Some("rlib") {
18-
let mut perms = fs_wrapper::metadata(entry.path()).permissions();
19-
perms.set_readonly(true);
20-
fs_wrapper::set_permissions(entry.path(), perms);
21-
}
22-
}
23-
rustc().input("main.rs").arg("-Clto").run();
24-
run("main");
15+
test_while_readonly(rust_lib_name("lib"), || {
16+
rustc().input("main.rs").arg("-Clto").run();
17+
run("main");
18+
});
2519
}

0 commit comments

Comments
 (0)