mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
make assert_stderr_contains print its contents on panic
This commit is contained in:
+1
-1
Submodule src/doc/book updated: 5228bfac82...45c1a6d69e
+1
-1
Submodule src/tools/cargo updated: 4dcbca118a...a1f47ec3f7
@@ -236,18 +236,6 @@ pub fn link_args(&mut self, link_args: &str) -> &mut Self {
|
||||
self
|
||||
}
|
||||
|
||||
/// Add an extra argument to prepend the linker invocation, via `-Zpre-link-arg`.
|
||||
pub fn pre_link_arg(&mut self, link_arg: &str) -> &mut Self {
|
||||
self.cmd.arg(format!("-Zpre-link-arg={link_arg}"));
|
||||
self
|
||||
}
|
||||
|
||||
/// Add multiple extra arguments to the linker invocation, via `-Zpre-link-args`.
|
||||
pub fn pre_link_args(&mut self, link_args: &str) -> &mut Self {
|
||||
self.cmd.arg(format!("-Zpre-link-args={link_args}"));
|
||||
self
|
||||
}
|
||||
|
||||
/// Specify a stdin input
|
||||
pub fn stdin<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self {
|
||||
self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice());
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
// checks that linker arguments remain intact and in the order they were originally passed in.
|
||||
// See https://github.com/rust-lang/rust/pull/70665
|
||||
|
||||
//@ ignore-msvc
|
||||
// Reason: the ld linker does not exist on Windows.
|
||||
|
||||
use run_make_support::rustc;
|
||||
|
||||
fn main() {
|
||||
@@ -10,18 +13,18 @@ fn main() {
|
||||
.input("empty.rs")
|
||||
.linker_flavor("ld")
|
||||
.link_arg("a")
|
||||
.link_args("\"b c\"")
|
||||
.link_args("\"d e\"")
|
||||
.link_args("b c")
|
||||
.link_args("d e")
|
||||
.link_arg("f")
|
||||
.run_fail()
|
||||
.assert_stderr_contains("\"a\" \"b\" \"c\" \"d\" \"e\" \"f\"");
|
||||
.assert_stderr_contains(r#""a" "b" "c" "d" "e" "f""#);
|
||||
rustc()
|
||||
.input("empty.rs")
|
||||
.linker_flavor("ld")
|
||||
.pre_link_arg("a")
|
||||
.pre_link_args("\"b c\"")
|
||||
.pre_link_args("\"d e\"")
|
||||
.pre_link_arg("f")
|
||||
.arg("-Zpre-link-arg=a")
|
||||
.arg("-Zpre-link-args=b c")
|
||||
.arg("-Zpre-link-args=d e")
|
||||
.arg("-Zpre-link-arg=f")
|
||||
.run_fail()
|
||||
.assert_stderr_contains("\"a\" \"b\" \"c\" \"d\" \"e\" \"f\"");
|
||||
.assert_stderr_contains(r#""a" "b" "c" "d" "e" "f""#);
|
||||
}
|
||||
|
||||
@@ -8,18 +8,12 @@
|
||||
//@ ignore-cross-compile
|
||||
|
||||
use run_make_support::fs_wrapper;
|
||||
use run_make_support::{cwd, run, rustc};
|
||||
use run_make_support::{run, rust_lib_name, rustc, test_while_readonly};
|
||||
|
||||
fn main() {
|
||||
rustc().input("lib.rs").run();
|
||||
let entries = fs_wrapper::read_dir(cwd());
|
||||
for entry in entries {
|
||||
if entry.path().extension().and_then(|s| s.to_str()) == Some("rlib") {
|
||||
let mut perms = fs_wrapper::metadata(entry.path()).permissions();
|
||||
perms.set_readonly(true);
|
||||
fs_wrapper::set_permissions(entry.path(), perms);
|
||||
}
|
||||
}
|
||||
rustc().input("main.rs").arg("-Clto").run();
|
||||
run("main");
|
||||
test_while_readonly(rust_lib_name("lib"), || {
|
||||
rustc().input("main.rs").arg("-Clto").run();
|
||||
run("main");
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user