From b3c51323b507192521cfa264a6ab129fcdb85b34 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Sun, 9 Jun 2024 16:43:24 -0400 Subject: [PATCH] make assert_stderr_contains print its contents on panic --- src/doc/book | 2 +- src/tools/cargo | 2 +- src/tools/run-make-support/src/rustc.rs | 12 ------------ tests/run-make/link-args-order/rmake.rs | 19 +++++++++++-------- tests/run-make/lto-readonly-lib/rmake.rs | 16 +++++----------- 5 files changed, 18 insertions(+), 33 deletions(-) diff --git a/src/doc/book b/src/doc/book index 5228bfac8267a..45c1a6d69edfd 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 5228bfac8267ad24659a81b92ec5417976b5edbc +Subproject commit 45c1a6d69edfd1fc91fb7504cb73958dbd09441e diff --git a/src/tools/cargo b/src/tools/cargo index 4dcbca118ab7f..a1f47ec3f7cd0 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 4dcbca118ab7f9ffac4728004c983754bc6a04ff +Subproject commit a1f47ec3f7cd076986f1bfcd7061f2e8cb1a726e diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs index 7e5a637e20e15..289d847a5728c 100644 --- a/src/tools/run-make-support/src/rustc.rs +++ b/src/tools/run-make-support/src/rustc.rs @@ -236,18 +236,6 @@ impl Rustc { 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>(&mut self, input: I) -> &mut Self { self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice()); diff --git a/tests/run-make/link-args-order/rmake.rs b/tests/run-make/link-args-order/rmake.rs index 4530251c7a585..d238ad23f27c7 100644 --- a/tests/run-make/link-args-order/rmake.rs +++ b/tests/run-make/link-args-order/rmake.rs @@ -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""#); } diff --git a/tests/run-make/lto-readonly-lib/rmake.rs b/tests/run-make/lto-readonly-lib/rmake.rs index bf1dafee697dc..9eb135addd9ec 100644 --- a/tests/run-make/lto-readonly-lib/rmake.rs +++ b/tests/run-make/lto-readonly-lib/rmake.rs @@ -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"); + }); }