Skip to content

Commit

Permalink
Auto merge of rust-lang#127000 - Oneirical:no-test-for-the-wicked, r=…
Browse files Browse the repository at this point in the history
…Kobzol

Migrate `use-suggestions-rust-2018`, `overwrite-input`, `lto-dylib-dep` and `many-crates-but-no-match` `run-make` tests to rmake

Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
  • Loading branch information
bors committed Jun 27, 2024
2 parents 9c3bc80 + b94eae5 commit 3cf2d7b
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 76 deletions.
4 changes: 0 additions & 4 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,12 @@ run-make/llvm-ident/Makefile
run-make/long-linker-command-lines-cmd-exe/Makefile
run-make/long-linker-command-lines/Makefile
run-make/longjmp-across-rust/Makefile
run-make/lto-dylib-dep/Makefile
run-make/lto-linkage-used-attr/Makefile
run-make/lto-no-link-whole-rlib/Makefile
run-make/lto-smoke-c/Makefile
run-make/macos-deployment-target/Makefile
run-make/macos-fat-archive/Makefile
run-make/manual-link/Makefile
run-make/many-crates-but-no-match/Makefile
run-make/metadata-dep-info/Makefile
run-make/min-global-align/Makefile
run-make/mingw-export-call-convention/Makefile
Expand All @@ -118,7 +116,6 @@ run-make/optimization-remarks-dir-pgo/Makefile
run-make/optimization-remarks-dir/Makefile
run-make/output-type-permutations/Makefile
run-make/override-aliased-flags/Makefile
run-make/overwrite-input/Makefile
run-make/panic-abort-eh_frame/Makefile
run-make/pass-linker-flags-flavor/Makefile
run-make/pass-linker-flags-from-dep/Makefile
Expand Down Expand Up @@ -192,7 +189,6 @@ run-make/translation/Makefile
run-make/type-mismatch-same-crate-name/Makefile
run-make/unknown-mod-stdin/Makefile
run-make/unstable-flag-required/Makefile
run-make/use-suggestions-rust-2018/Makefile
run-make/used-cdylib-macos/Makefile
run-make/volatile-intrinsics/Makefile
run-make/wasm-exceptions-nostd/Makefile
Expand Down
11 changes: 0 additions & 11 deletions tests/run-make/lto-dylib-dep/Makefile

This file was deleted.

15 changes: 15 additions & 0 deletions tests/run-make/lto-dylib-dep/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Compiling with link-time-optimizations (LTO) would previously run into an internal
// compiler error (ICE) if a dylib was passed as a required library. This was due to a
// misplaced assert! call in the compiler, which is now removed. This test checks that
// this bug does not make a resurgence and that dylib+lto compilation succeeds.
// See https://github.com/rust-lang/rust/issues/59137

//@ ignore-cross-compile

use run_make_support::{run, rustc};

fn main() {
rustc().input("a_dylib.rs").crate_type("dylib").arg("-Cprefer-dynamic").run();
rustc().input("main.rs").arg("-Clto").run();
run("main");
}
35 changes: 0 additions & 35 deletions tests/run-make/many-crates-but-no-match/Makefile

This file was deleted.

31 changes: 31 additions & 0 deletions tests/run-make/many-crates-but-no-match/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// An extended version of the ui/changing-crates.rs test, this test puts
// multiple mismatching crates into the search path of crateC (A2 and A3)
// and checks that the standard error contains helpful messages to indicate
// what should be done to fix the issue.
// See https://github.com/rust-lang/rust/issues/13266

use run_make_support::{fs_wrapper, rustc};

fn main() {
fs_wrapper::create_dir("a1");
fs_wrapper::create_dir("a2");
fs_wrapper::create_dir("a3");
rustc().crate_type("rlib").out_dir("a1").input("crateA1.rs").run();
rustc().crate_type("rlib").library_search_path("a1").input("crateB.rs").run();
rustc().crate_type("rlib").out_dir("a2").input("crateA2.rs").run();
rustc().crate_type("rlib").out_dir("a3").input("crateA3.rs").run();
// Ensure crateC fails to compile since A1 is "missing" and A2/A3 hashes do not match
rustc()
.crate_type("rlib")
.library_search_path("a2")
.library_search_path("a3")
.input("crateC.rs")
.run_fail()
.assert_stderr_contains(
"found possibly newer version of crate `crateA` which `crateB` depends on",
)
.assert_stderr_contains("note: perhaps that crate needs to be recompiled?")
.assert_stderr_contains("crate `crateA`:")
.assert_stderr_contains("crate `crateB`:");
// the 'crate `crateA`' will match two entries.
}
7 changes: 0 additions & 7 deletions tests/run-make/overwrite-input/Makefile

This file was deleted.

4 changes: 1 addition & 3 deletions tests/run-make/overwrite-input/file.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
warning: ignoring --out-dir flag due to -o flag

error: the input file "main.rs" would be overwritten by the generated executable

error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error

4 changes: 1 addition & 3 deletions tests/run-make/overwrite-input/folder.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
warning: ignoring --out-dir flag due to -o flag

error: the generated executable for the input file "main.rs" conflicts with the existing directory "."

error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error

6 changes: 0 additions & 6 deletions tests/run-make/overwrite-input/main.stderr

This file was deleted.

13 changes: 13 additions & 0 deletions tests/run-make/overwrite-input/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// An attempt to set the output `-o` into a directory or a file we cannot write into should indeed
// be an error; but not an ICE (Internal Compiler Error). This test attempts both and checks
// that the standard error matches what is expected.
// See https://github.com/rust-lang/rust/issues/66530

use run_make_support::{diff, rustc};

fn main() {
let file_out = rustc().input("main.rs").output("main.rs").run_fail().stderr_utf8();
let folder_out = rustc().input("main.rs").output(".").run_fail().stderr_utf8();
diff().expected_file("file.stderr").actual_text("actual-file-stderr", file_out).run();
diff().expected_file("folder.stderr").actual_text("actual-folder-stderr", folder_out).run();
}
7 changes: 0 additions & 7 deletions tests/run-make/use-suggestions-rust-2018/Makefile

This file was deleted.

18 changes: 18 additions & 0 deletions tests/run-make/use-suggestions-rust-2018/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// The compilation error caused by calling on an unimported crate
// should have a suggestion to write, say, crate::bar::Foo instead
// of just bar::Foo. However, this suggestion used to only appear for
// extern crate statements, not crate struct. After this was fixed in #51456,
// this test checks that the correct suggestion is printed no matter what.
// See https://github.com/rust-lang/rust/issues/51212

use run_make_support::{rust_lib_name, rustc};

fn main() {
rustc().input("ep-nested-lib.rs").run();
rustc()
.input("use-suggestions.rs")
.edition("2018")
.extern_("ep_nested_lib", rust_lib_name("ep_nested_lib"))
.run_fail()
.assert_stderr_contains("use ep_nested_lib::foo::bar::Baz");
}

0 comments on commit 3cf2d7b

Please sign in to comment.