Skip to content

Commit

Permalink
Rollup merge of #126712 - Oneirical:bootest-constestllation, r=jieyouxu
Browse files Browse the repository at this point in the history
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
  • Loading branch information
workingjubilee committed Jun 22, 2024
2 parents e7956cd + 3c0a4bc commit 84b0922
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 43 deletions.
3 changes: 0 additions & 3 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions tests/run-make/crate-name-priority/Makefile

This file was deleted.

18 changes: 18 additions & 0 deletions tests/run-make/crate-name-priority/rmake.rs
Original file line number Diff line number Diff line change
@@ -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"));
}
8 changes: 0 additions & 8 deletions tests/run-make/error-writing-dependencies/Makefile

This file was deleted.

17 changes: 17 additions & 0 deletions tests/run-make/error-writing-dependencies/rmake.rs
Original file line number Diff line number Diff line change
@@ -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");
}
20 changes: 0 additions & 20 deletions tests/run-make/relocation-model/Makefile

This file was deleted.

24 changes: 24 additions & 0 deletions tests/run-make/relocation-model/rmake.rs
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit 84b0922

Please sign in to comment.