From 83234a0f21a46536cedfd46dc8d0f2d447565541 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Thu, 11 Jul 2024 15:36:06 -0400 Subject: [PATCH 1/3] rewrite and rename issue-47551 to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/issue-47551/Makefile | 10 ---------- .../eh_frame-terminator.rs | 0 .../link-eh-frame-terminator/rmake.rs | 20 +++++++++++++++++++ 4 files changed, 20 insertions(+), 11 deletions(-) delete mode 100644 tests/run-make/issue-47551/Makefile rename tests/run-make/{issue-47551 => link-eh-frame-terminator}/eh_frame-terminator.rs (100%) create mode 100644 tests/run-make/link-eh-frame-terminator/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index fa340a022132e..2a1b7500e5b8c 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -19,7 +19,6 @@ run-make/foreign-rust-exceptions/Makefile run-make/incr-add-rust-src-component/Makefile run-make/issue-35164/Makefile run-make/issue-36710/Makefile -run-make/issue-47551/Makefile run-make/issue-69368/Makefile run-make/issue-84395-lto-embed-bitcode/Makefile run-make/issue-88756-default-output/Makefile diff --git a/tests/run-make/issue-47551/Makefile b/tests/run-make/issue-47551/Makefile deleted file mode 100644 index 3fe0a6e74e020..0000000000000 --- a/tests/run-make/issue-47551/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# only-linux -# ignore-32bit - -include ../tools.mk - -all: - # --target $(TARGET) ensures the right gcc flags are used for cross compilation - $(RUSTC) --target $(TARGET) eh_frame-terminator.rs - $(call RUN,eh_frame-terminator) | $(CGREP) '1122334455667788' - objdump --dwarf=frames $(TMPDIR)/eh_frame-terminator | $(CGREP) 'ZERO terminator' diff --git a/tests/run-make/issue-47551/eh_frame-terminator.rs b/tests/run-make/link-eh-frame-terminator/eh_frame-terminator.rs similarity index 100% rename from tests/run-make/issue-47551/eh_frame-terminator.rs rename to tests/run-make/link-eh-frame-terminator/eh_frame-terminator.rs diff --git a/tests/run-make/link-eh-frame-terminator/rmake.rs b/tests/run-make/link-eh-frame-terminator/rmake.rs new file mode 100644 index 0000000000000..750d068ac98cf --- /dev/null +++ b/tests/run-make/link-eh-frame-terminator/rmake.rs @@ -0,0 +1,20 @@ +// The gcc driver is supposed to add a terminator to link files, and the rustc +// driver previously failed to do this, resulting in a segmentation fault +// with an older version of LLVM. This test checks that the terminator is present +// after the fix in #85395. +// See https://github.com/rust-lang/rust/issues/47551 + +//FIXME(Oneirical): See if it works on anything other than only linux and 64 bit +// maybe riscv64gc-unknown-linux-gnu + +use run_make_support::{llvm_objdump, run, rustc}; + +fn main() { + rustc().input("eh_frame-terminator.rs").run(); + run("eh_frame-terminator").assert_stdout_contains("1122334455667788"); + llvm_objdump() + .arg("--dwarf=frames") + .input("eh_frame-terminator") + .run() + .assert_stdout_contains("ZERO terminator"); +} From 61a6afe60ced9a6120403158dd8caf40f8a583a4 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Thu, 11 Jul 2024 15:52:04 -0400 Subject: [PATCH 2/3] Rewrite and rename issue-35164 to rmake --- src/tools/run-make-support/src/command.rs | 2 +- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/issue-35164/Makefile | 4 ---- .../{issue-35164 => json-error-no-offset}/main.rs | 0 tests/run-make/json-error-no-offset/rmake.rs | 15 +++++++++++++++ .../submodule/mod.rs | 0 6 files changed, 16 insertions(+), 6 deletions(-) delete mode 100644 tests/run-make/issue-35164/Makefile rename tests/run-make/{issue-35164 => json-error-no-offset}/main.rs (100%) create mode 100644 tests/run-make/json-error-no-offset/rmake.rs rename tests/run-make/{issue-35164 => json-error-no-offset}/submodule/mod.rs (100%) diff --git a/src/tools/run-make-support/src/command.rs b/src/tools/run-make-support/src/command.rs index 47376c401bb67..6f9ff4b9868a0 100644 --- a/src/tools/run-make-support/src/command.rs +++ b/src/tools/run-make-support/src/command.rs @@ -216,7 +216,7 @@ impl CompletedProcess { /// Checks that `stderr` does not contain `unexpected`. #[track_caller] pub fn assert_stderr_not_contains>(&self, unexpected: S) -> &Self { - assert_not_contains(&self.stdout_utf8(), unexpected); + assert_not_contains(&self.stderr_utf8(), unexpected); self } diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 2a1b7500e5b8c..beff9de23719b 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -17,7 +17,6 @@ run-make/foreign-double-unwind/Makefile run-make/foreign-exceptions/Makefile run-make/foreign-rust-exceptions/Makefile run-make/incr-add-rust-src-component/Makefile -run-make/issue-35164/Makefile run-make/issue-36710/Makefile run-make/issue-69368/Makefile run-make/issue-84395-lto-embed-bitcode/Makefile diff --git a/tests/run-make/issue-35164/Makefile b/tests/run-make/issue-35164/Makefile deleted file mode 100644 index 38aa6f1265f1e..0000000000000 --- a/tests/run-make/issue-35164/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) main.rs --error-format json 2>&1 | $(CGREP) -e '"byte_start":23\b' '"byte_end":29\b' diff --git a/tests/run-make/issue-35164/main.rs b/tests/run-make/json-error-no-offset/main.rs similarity index 100% rename from tests/run-make/issue-35164/main.rs rename to tests/run-make/json-error-no-offset/main.rs diff --git a/tests/run-make/json-error-no-offset/rmake.rs b/tests/run-make/json-error-no-offset/rmake.rs new file mode 100644 index 0000000000000..629d9c4c16e44 --- /dev/null +++ b/tests/run-make/json-error-no-offset/rmake.rs @@ -0,0 +1,15 @@ +// The byte positions in json format error logging used to have a small, difficult +// to predict offset. This was changed to be the top of the file every time in #42973, +// and this test checks that the measurements appearing in the standard error are correct. +// See https://github.com/rust-lang/rust/issues/35164 + +use run_make_support::rustc; + +fn main() { + rustc() + .input("main.rs") + .error_format("json") + .run() + .assert_stderr_contains(r#""byte_start":23"#) + .assert_stderr_contains(r#""byte_end":29"#); +} diff --git a/tests/run-make/issue-35164/submodule/mod.rs b/tests/run-make/json-error-no-offset/submodule/mod.rs similarity index 100% rename from tests/run-make/issue-35164/submodule/mod.rs rename to tests/run-make/json-error-no-offset/submodule/mod.rs From 01a266206b4c923a8fbbc49b3be7d630e48eef86 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Thu, 11 Jul 2024 16:00:15 -0400 Subject: [PATCH 3/3] rewrite and rename issue-69368 to rmake --- src/tools/compiletest/src/command-list.rs | 1 + .../tidy/src/allowed_run_make_makefiles.txt | 1 - .../a.rs | 0 .../b.rs | 0 .../c.rs | 0 .../crate-circular-deps-link/rmake.rs | 20 +++++++++++++++++++ tests/run-make/issue-69368/Makefile | 19 ------------------ .../link-eh-frame-terminator/rmake.rs | 11 ++++++---- 8 files changed, 28 insertions(+), 24 deletions(-) rename tests/run-make/{issue-69368 => crate-circular-deps-link}/a.rs (100%) rename tests/run-make/{issue-69368 => crate-circular-deps-link}/b.rs (100%) rename tests/run-make/{issue-69368 => crate-circular-deps-link}/c.rs (100%) create mode 100644 tests/run-make/crate-circular-deps-link/rmake.rs delete mode 100644 tests/run-make/issue-69368/Makefile diff --git a/src/tools/compiletest/src/command-list.rs b/src/tools/compiletest/src/command-list.rs index c356f4266f016..288f90ea12399 100644 --- a/src/tools/compiletest/src/command-list.rs +++ b/src/tools/compiletest/src/command-list.rs @@ -117,6 +117,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "ignore-watchos", "ignore-windows", "ignore-windows-gnu", + "ignore-windows-msvc", "ignore-x32", "ignore-x86", "ignore-x86_64", diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index beff9de23719b..5306e2368b706 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -18,7 +18,6 @@ run-make/foreign-exceptions/Makefile run-make/foreign-rust-exceptions/Makefile run-make/incr-add-rust-src-component/Makefile run-make/issue-36710/Makefile -run-make/issue-69368/Makefile run-make/issue-84395-lto-embed-bitcode/Makefile run-make/issue-88756-default-output/Makefile run-make/jobserver-error/Makefile diff --git a/tests/run-make/issue-69368/a.rs b/tests/run-make/crate-circular-deps-link/a.rs similarity index 100% rename from tests/run-make/issue-69368/a.rs rename to tests/run-make/crate-circular-deps-link/a.rs diff --git a/tests/run-make/issue-69368/b.rs b/tests/run-make/crate-circular-deps-link/b.rs similarity index 100% rename from tests/run-make/issue-69368/b.rs rename to tests/run-make/crate-circular-deps-link/b.rs diff --git a/tests/run-make/issue-69368/c.rs b/tests/run-make/crate-circular-deps-link/c.rs similarity index 100% rename from tests/run-make/issue-69368/c.rs rename to tests/run-make/crate-circular-deps-link/c.rs diff --git a/tests/run-make/crate-circular-deps-link/rmake.rs b/tests/run-make/crate-circular-deps-link/rmake.rs new file mode 100644 index 0000000000000..7cc28ac93e148 --- /dev/null +++ b/tests/run-make/crate-circular-deps-link/rmake.rs @@ -0,0 +1,20 @@ +// Test that previously triggered a linker failure with root cause +// similar to one found in the issue #69368. +// +// The crate that provides oom lang item is missing some other lang +// items. Necessary to prevent the use of start-group / end-group. +// +// The weak lang items are defined in a separate compilation units, +// so that linker could omit them if not used. +// +// The crates that need those weak lang items are dependencies of +// crates that provide them. +// See https://github.com/rust-lang/rust/issues/69371 + +use run_make_support::rustc; + +fn main() { + rustc().input("a.rs").run(); + rustc().input("b.rs").run(); + rustc().input("c.rs").run(); +} diff --git a/tests/run-make/issue-69368/Makefile b/tests/run-make/issue-69368/Makefile deleted file mode 100644 index b1229d1b07fc7..0000000000000 --- a/tests/run-make/issue-69368/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -# Test that previously triggered a linker failure with root cause -# similar to one found in the issue #69368. -# -# The crate that provides oom lang item is missing some other lang -# items. Necessary to prevent the use of start-group / end-group. -# -# The weak lang items are defined in a separate compilation units, -# so that linker could omit them if not used. -# -# The crates that need those weak lang items are dependencies of -# crates that provide them. - -all: - $(RUSTC) a.rs - $(RUSTC) b.rs - $(RUSTC) c.rs diff --git a/tests/run-make/link-eh-frame-terminator/rmake.rs b/tests/run-make/link-eh-frame-terminator/rmake.rs index 750d068ac98cf..6bfae386ea1ab 100644 --- a/tests/run-make/link-eh-frame-terminator/rmake.rs +++ b/tests/run-make/link-eh-frame-terminator/rmake.rs @@ -4,17 +4,20 @@ // after the fix in #85395. // See https://github.com/rust-lang/rust/issues/47551 -//FIXME(Oneirical): See if it works on anything other than only linux and 64 bit -// maybe riscv64gc-unknown-linux-gnu +//@ only-linux +// Reason: the ZERO terminator is unique to the Linux architecture. +//@ ignore-32bit +// Reason: the usage of a large array in the test causes an out-of-memory +// error on 32 bit systems. -use run_make_support::{llvm_objdump, run, rustc}; +use run_make_support::{bin_name, llvm_objdump, run, rustc}; fn main() { rustc().input("eh_frame-terminator.rs").run(); run("eh_frame-terminator").assert_stdout_contains("1122334455667788"); llvm_objdump() .arg("--dwarf=frames") - .input("eh_frame-terminator") + .input(bin_name("eh_frame-terminator")) .run() .assert_stdout_contains("ZERO terminator"); }