Rollup merge of #126712 - Oneirical:bootest-constestllation, r=jieyouxu

Migrate `relocation-model`, `error-writing-dependencies` and `crate-name-priority` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Needs MSVC try-job due to #28026, almost guaranteed to fail, but let's see anyways.

try-job: aarch64-gnu
`/* try-job: x86_64-msvc */`
try-job: x86_64-apple-1
try-job: armhf-gnu
try-job: test-various
This commit is contained in:
Jubilee 2024-06-21 21:02:26 -07:00 committed by GitHub
commit 84b0922565
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 59 additions and 43 deletions

View File

@ -14,7 +14,6 @@ run-make/compiler-lookup-paths-2/Makefile
run-make/compiler-lookup-paths/Makefile run-make/compiler-lookup-paths/Makefile
run-make/compiler-rt-works-on-mingw/Makefile run-make/compiler-rt-works-on-mingw/Makefile
run-make/crate-hash-rustc-version/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-clang/Makefile
run-make/cross-lang-lto-pgo-smoketest/Makefile run-make/cross-lang-lto-pgo-smoketest/Makefile
run-make/cross-lang-lto-upstream-rlibs/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-stack-sizes/Makefile
run-make/emit-to-stdout/Makefile run-make/emit-to-stdout/Makefile
run-make/env-dep-info/Makefile run-make/env-dep-info/Makefile
run-make/error-writing-dependencies/Makefile
run-make/export-executable-symbols/Makefile run-make/export-executable-symbols/Makefile
run-make/extern-diff-internal-name/Makefile run-make/extern-diff-internal-name/Makefile
run-make/extern-flag-disambiguates/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-link-ordinal/Makefile
run-make/raw-dylib-stdcall-ordinal/Makefile run-make/raw-dylib-stdcall-ordinal/Makefile
run-make/redundant-libs/Makefile run-make/redundant-libs/Makefile
run-make/relocation-model/Makefile
run-make/relro-levels/Makefile run-make/relro-levels/Makefile
run-make/remap-path-prefix-dwarf/Makefile run-make/remap-path-prefix-dwarf/Makefile
run-make/remap-path-prefix/Makefile run-make/remap-path-prefix/Makefile

View File

@ -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)

View File

@ -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"));
}

View File

@ -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"

View File

@ -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");
}

View File

@ -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

View File

@ -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();
}