Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bf8da39

Browse files
authoredJun 26, 2024
Rollup merge of #126964 - Oneirical:total-catestrophe, r=Kobzol
Migrate `lto-empty`, `invalid-so` and `issue-20626` `run-make` tests to rmake.rs Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2 parents 8b3bbee + ee529b7 commit bf8da39

File tree

8 files changed

+50
-32
lines changed

8 files changed

+50
-32
lines changed
 

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-3
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@ run-make/incr-foreign-head-span/Makefile
5555
run-make/interdependent-c-libraries/Makefile
5656
run-make/intrinsic-unreachable/Makefile
5757
run-make/invalid-library/Makefile
58-
run-make/invalid-so/Makefile
5958
run-make/issue-107094/Makefile
6059
run-make/issue-109934-lto-debuginfo/Makefile
6160
run-make/issue-14698/Makefile
6261
run-make/issue-15460/Makefile
6362
run-make/issue-18943/Makefile
64-
run-make/issue-20626/Makefile
6563
run-make/issue-22131/Makefile
6664
run-make/issue-25581/Makefile
6765
run-make/issue-26006/Makefile
@@ -97,7 +95,6 @@ run-make/long-linker-command-lines-cmd-exe/Makefile
9795
run-make/long-linker-command-lines/Makefile
9896
run-make/longjmp-across-rust/Makefile
9997
run-make/lto-dylib-dep/Makefile
100-
run-make/lto-empty/Makefile
10198
run-make/lto-linkage-used-attr/Makefile
10299
run-make/lto-no-link-whole-rlib/Makefile
103100
run-make/lto-smoke-c/Makefile

‎tests/run-make/invalid-so/Makefile

-7
This file was deleted.

‎tests/run-make/invalid-so/rmake.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// When a fake library was given to the compiler, it would
2+
// result in an obscure and unhelpful error message. This test
3+
// creates a false "foo" dylib, and checks that the standard error
4+
// explains that the file exists, but that its metadata is incorrect.
5+
// See https://github.com/rust-lang/rust/pull/88368
6+
7+
use run_make_support::{dynamic_lib_name, fs_wrapper, rustc};
8+
9+
fn main() {
10+
fs_wrapper::create_file(dynamic_lib_name("foo"));
11+
rustc()
12+
.crate_type("lib")
13+
.extern_("foo", dynamic_lib_name("foo"))
14+
.input("bar.rs")
15+
.run_fail()
16+
.assert_stderr_contains("invalid metadata files for crate `foo`");
17+
}

‎tests/run-make/issue-20626/Makefile

-9
This file was deleted.

‎tests/run-make/lto-empty/Makefile

-13
This file was deleted.

‎tests/run-make/lto-empty/rmake.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Compiling Rust code twice in a row with "fat" link-time-optimizations used to cause
2+
// an internal compiler error (ICE). This was due to how the compiler would cache some modules
3+
// to make subsequent compilations faster, at least one of which was required for LTO to link
4+
// into. After this was patched in #63956, this test checks that the bug does not make
5+
// a resurgence.
6+
// See https://github.com/rust-lang/rust/issues/63349
7+
8+
//@ ignore-cross-compile
9+
10+
use run_make_support::rustc;
11+
12+
fn main() {
13+
rustc().input("lib.rs").arg("-Clto=fat").opt_level("3").incremental("inc-fat").run();
14+
rustc().input("lib.rs").arg("-Clto=fat").opt_level("3").incremental("inc-fat").run();
15+
rustc().input("lib.rs").arg("-Clto=thin").opt_level("3").incremental("inc-thin").run();
16+
rustc().input("lib.rs").arg("-Clto=thin").opt_level("3").incremental("inc-thin").run();
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Despite the absence of any unsafe Rust code, foo.rs in this test would,
2+
// because of the raw function pointer,
3+
// cause undefined behavior and fail to print the expected result, "4" -
4+
// only when activating optimizations (opt-level 2). This test checks
5+
// that this bug does not make a resurgence.
6+
// Note that the bug cannot be observed in an assert_eq!, only in the stdout.
7+
// See https://github.com/rust-lang/rust/issues/20626
8+
9+
//@ ignore-cross-compile
10+
11+
use run_make_support::{run, rustc};
12+
13+
fn main() {
14+
rustc().input("foo.rs").opt().run();
15+
run("foo").assert_stdout_equals("4");
16+
}

0 commit comments

Comments
 (0)
Failed to load comments.