diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index f32413540498d..970a424d9988d 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -14,7 +14,6 @@ run-make/compiler-lookup-paths-2/Makefile run-make/compiler-lookup-paths/Makefile run-make/compiler-rt-works-on-mingw/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 @@ -31,7 +30,6 @@ run-make/emit-shared-files/Makefile run-make/emit-stack-sizes/Makefile run-make/emit-to-stdout/Makefile run-make/env-dep-info/Makefile -run-make/error-writing-dependencies/Makefile run-make/export-executable-symbols/Makefile run-make/extern-diff-internal-name/Makefile run-make/extern-flag-disambiguates/Makefile @@ -154,7 +152,6 @@ run-make/raw-dylib-inline-cross-dylib/Makefile run-make/raw-dylib-link-ordinal/Makefile run-make/raw-dylib-stdcall-ordinal/Makefile run-make/redundant-libs/Makefile -run-make/relocation-model/Makefile run-make/relro-levels/Makefile run-make/remap-path-prefix-dwarf/Makefile run-make/remap-path-prefix/Makefile diff --git a/tests/run-make/crate-name-priority/Makefile b/tests/run-make/crate-name-priority/Makefile deleted file mode 100644 index 4adaa75a71cf6..0000000000000 --- 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 0000000000000..b7cb2c9971141 --- /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/error-writing-dependencies/Makefile b/tests/run-make/error-writing-dependencies/Makefile deleted file mode 100644 index a5d30a647f817..0000000000000 --- a/tests/run-make/error-writing-dependencies/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - # Let's get a nice error message - $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \ - $(CGREP) "error writing dependencies" - # Make sure the filename shows up - $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | $(CGREP) "baz" diff --git a/tests/run-make/error-writing-dependencies/rmake.rs b/tests/run-make/error-writing-dependencies/rmake.rs new file mode 100644 index 0000000000000..2227f0a1a7f8a --- /dev/null +++ b/tests/run-make/error-writing-dependencies/rmake.rs @@ -0,0 +1,17 @@ +// Invalid paths passed to rustc used to cause internal compilation errors +// alongside an obscure error message. This was turned into a standard error, +// and this test checks that the cleaner error message is printed instead. +// See https://github.com/rust-lang/rust/issues/13517 + +use run_make_support::rustc; + +// NOTE: This cannot be a UI test due to the --out-dir flag, which is +// already present by default in UI testing. + +fn main() { + let out = rustc().input("foo.rs").emit("dep-info").out_dir("foo/bar/baz").run_fail(); + // The error message should be informative. + out.assert_stderr_contains("error writing dependencies"); + // The filename should appear. + out.assert_stderr_contains("baz"); +} diff --git a/tests/run-make/relocation-model/Makefile b/tests/run-make/relocation-model/Makefile deleted file mode 100644 index 8cc5205ed51b4..0000000000000 --- a/tests/run-make/relocation-model/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: others - $(RUSTC) -C relocation-model=dynamic-no-pic foo.rs - $(call RUN,foo) - - $(RUSTC) -C relocation-model=default foo.rs - $(call RUN,foo) - - $(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj - -ifdef IS_MSVC -# FIXME(#28026) -others: -else -others: - $(RUSTC) -C relocation-model=static foo.rs - $(call RUN,foo) -endif diff --git a/tests/run-make/relocation-model/rmake.rs b/tests/run-make/relocation-model/rmake.rs new file mode 100644 index 0000000000000..9cf85d6d73023 --- /dev/null +++ b/tests/run-make/relocation-model/rmake.rs @@ -0,0 +1,24 @@ +// Generation of position-independent code (PIC) can be altered +// through use of the -C relocation-model rustc flag. This test +// uses varied values with this flag and checks that compilation +// succeeds. +// See https://github.com/rust-lang/rust/pull/13340 + +//@ ignore-cross-compile + +use run_make_support::{run, rustc}; + +fn main() { + rustc().arg("-Crelocation-model=static").input("foo.rs").run(); + run("foo"); + rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run(); + run("foo"); + rustc().arg("-Crelocation-model=default").input("foo.rs").run(); + run("foo"); + rustc() + .arg("-Crelocation-model=dynamic-no-pic") + .crate_type("dylib") + .emit("link,obj") + .input("foo.rs") + .run(); +}