From 3c0a4bc915616855f2d3b6aa16ae77f621a24d5d Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 19 Jun 2024 16:52:36 -0400 Subject: [PATCH] rewrite crate-name-priority to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/crate-name-priority/Makefile | 12 ------------ tests/run-make/crate-name-priority/rmake.rs | 18 ++++++++++++++++++ tests/run-make/relocation-model/rmake.rs | 2 -- 4 files changed, 18 insertions(+), 15 deletions(-) delete mode 100644 tests/run-make/crate-name-priority/Makefile create mode 100644 tests/run-make/crate-name-priority/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 d5b981a5083..df104ca9787 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -16,7 +16,6 @@ run-make/compiler-lookup-paths/Makefile run-make/compiler-rt-works-on-mingw/Makefile run-make/compressed-debuginfo/Makefile run-make/crate-hash-rustc-version/Makefile -run-make/crate-name-priority/Makefile run-make/cross-lang-lto-clang/Makefile run-make/cross-lang-lto-pgo-smoketest/Makefile run-make/cross-lang-lto-upstream-rlibs/Makefile diff --git a/tests/run-make/crate-name-priority/Makefile b/tests/run-make/crate-name-priority/Makefile deleted file mode 100644 index 4adaa75a71c..00000000000 --- a/tests/run-make/crate-name-priority/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: - $(RUSTC) foo.rs - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-name bar - rm $(TMPDIR)/$(call BIN,bar) - $(RUSTC) foo1.rs - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo1.rs -o $(TMPDIR)/$(call BIN,bar1) - rm $(TMPDIR)/$(call BIN,bar1) diff --git a/tests/run-make/crate-name-priority/rmake.rs b/tests/run-make/crate-name-priority/rmake.rs new file mode 100644 index 00000000000..b7cb2c99711 --- /dev/null +++ b/tests/run-make/crate-name-priority/rmake.rs @@ -0,0 +1,18 @@ +// The `crate_name` rustc flag should have higher priority +// over `#![crate_name = "foo"]` defined inside the source code. +// This test has a conflict between crate_names defined in the .rs files +// and the compiler flags, and checks that the flag is favoured each time. +// See https://github.com/rust-lang/rust/pull/15518 + +use run_make_support::{bin_name, fs_wrapper, rustc}; + +fn main() { + rustc().input("foo.rs").run(); + fs_wrapper::remove_file(bin_name("foo")); + rustc().input("foo.rs").crate_name("bar").run(); + fs_wrapper::remove_file(bin_name("bar")); + rustc().input("foo1.rs").run(); + fs_wrapper::remove_file(bin_name("foo")); + rustc().input("foo1.rs").output(bin_name("bar1")).run(); + fs_wrapper::remove_file(bin_name("bar1")); +} diff --git a/tests/run-make/relocation-model/rmake.rs b/tests/run-make/relocation-model/rmake.rs index 978e2f685a6..9cf85d6d730 100644 --- a/tests/run-make/relocation-model/rmake.rs +++ b/tests/run-make/relocation-model/rmake.rs @@ -9,8 +9,6 @@ use run_make_support::{run, rustc}; fn main() { - // FIXME(Oneirical): This first one will likely fail on MSVC due to #28026. - // Remove this after try-job rustc().arg("-Crelocation-model=static").input("foo.rs").run(); run("foo"); rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run();