Skip to content

Commit

Permalink
Auto merge of #127822 - Oneirical:amazon-rainfortest, r=<try>
Browse files Browse the repository at this point in the history
Migrate `issue-85401-static-mir`, `missing-crate-dependency` and `unstable-flag-required` `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).

try-job: armhf-gnu
try-job: test-various
try-job: x86_64-msvc
try-job: aarch64-apple
try-job: dist-x86_64-linux
  • Loading branch information
bors committed Jul 18, 2024
2 parents e35364a + 3ba62f0 commit f50c909
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 32 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 @@ -54,7 +54,6 @@ 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-85401-static-mir/Makefile
run-make/issue-88756-default-output/Makefile
run-make/issue-97463-abi-param-passing/Makefile
run-make/jobserver-error/Makefile
Expand All @@ -76,7 +75,6 @@ run-make/macos-deployment-target/Makefile
run-make/macos-fat-archive/Makefile
run-make/manual-link/Makefile
run-make/min-global-align/Makefile
run-make/missing-crate-dependency/Makefile
run-make/native-link-modifier-bundle/Makefile
run-make/native-link-modifier-whole-archive/Makefile
run-make/no-alloc-shim/Makefile
Expand Down Expand Up @@ -122,5 +120,4 @@ run-make/test-benches/Makefile
run-make/thumb-none-cortex-m/Makefile
run-make/thumb-none-qemu/Makefile
run-make/translation/Makefile
run-make/unstable-flag-required/Makefile
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions tests/run-make/ice-static-mir/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Trying to access mid-level internal representation (MIR) in statics
// used to cause an internal compiler error (ICE), now handled as a proper
// error since #100211. This test checks that the correct error is printed
// during the linking process, and not the ICE.
// See https://github.com/rust-lang/rust/issues/85401

use run_make_support::{bin_name, rust_lib_name, rustc};

fn main() {
rustc()
.crate_type("rlib")
.crate_name("foo")
.arg("-Crelocation-model=pic")
.edition("2018")
.input("foo.rs")
.arg("-Zalways-encode-mir=yes")
.emit("metadata")
.output("libfoo.rmeta")
.run();
rustc()
.crate_type("rlib")
.crate_name("bar")
.arg("-Crelocation-model=pic")
.edition("2018")
.input("bar.rs")
.output(rust_lib_name("bar"))
.extern_("foo", "libfoo.rmeta")
.run();
rustc()
.crate_type("bin")
.crate_name("baz")
.arg("-Crelocation-model=pic")
.edition("2018")
.input("baz.rs")
.output(bin_name("baz"))
.extern_("bar", rust_lib_name("bar"))
.run_fail()
.assert_stderr_contains(
"crate `foo` required to be available in rlib format, but was not found in this form",
)
.assert_stdout_not_contains("internal compiler error");
}
16 changes: 0 additions & 16 deletions tests/run-make/issue-85401-static-mir/Makefile

This file was deleted.

9 changes: 0 additions & 9 deletions tests/run-make/missing-crate-dependency/Makefile

This file was deleted.

17 changes: 17 additions & 0 deletions tests/run-make/missing-crate-dependency/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// A simple smoke test to check that rustc fails compilation
// and outputs a helpful message when a dependency is missing
// in a dependency chain.
// See https://github.com/rust-lang/rust/issues/12146

use run_make_support::{rfs, rust_lib_name, rustc};

fn main() {
rustc().crate_type("rlib").input("crateA.rs").run();
rustc().crate_type("rlib").input("crateB.rs").run();
rfs::remove_file(rust_lib_name("crateA"));
// Ensure that crateC fails to compile, as the crateA dependency is missing.
rustc()
.input("crateC.rs")
.run_fail()
.assert_stderr_contains("can't find crate for `crateA` which `crateB` depends on");
}
4 changes: 0 additions & 4 deletions tests/run-make/unstable-flag-required/Makefile

This file was deleted.

12 changes: 12 additions & 0 deletions tests/run-make/unstable-flag-required/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// The flag `--output-format` is unauthorized on beta and stable releases, which led
// to confusion for maintainers doing testing on nightly. Tying it to an unstable flag
// elucidates this, and this test checks that `--output-format` cannot be passed on its
// own.
// See https://github.com/rust-lang/rust/pull/82497

use run_make_support::{diff, rustdoc};

fn main() {
let out = rustdoc().output_format("json").input("x.html").run_fail().stderr_utf8();
diff().expected_file("output-format-json.stderr").actual_text("actual-json", out).run();
}

0 comments on commit f50c909

Please sign in to comment.