Skip to content

Commit df7acab

Browse files
authored
Rollup merge of #125421 - Oneirical:bundle-them-yet-again, r=jieyouxu
Rewrite `core-no-oom-handling`, `issue-24445` and `issue-38237` `run-make` tests to new `rmake.rs` format Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). The test which is now called `non-pie-thread-local` has an unexplained "only-linux" flag. Could it be worth trying to remove it and changing the CI to test non-Linux platforms on it?
2 parents 01a1248 + 1f17e27 commit df7acab

File tree

17 files changed

+85
-30
lines changed

17 files changed

+85
-30
lines changed

src/tools/run-make-support/src/cc.rs

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ impl Cc {
4545
self
4646
}
4747

48+
/// Adds directories to the list that the linker searches for libraries.
49+
/// Equivalent to `-L`.
50+
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
51+
self.cmd.arg("-L");
52+
self.cmd.arg(path.as_ref());
53+
self
54+
}
55+
4856
/// Specify `-o` or `-Fe`/`-Fo` depending on platform/compiler. This assumes that the executable
4957
/// is under `$TMPDIR`.
5058
pub fn out_exe(&mut self, name: &str) -> &mut Self {

src/tools/run-make-support/src/rustc.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,20 @@ impl Rustc {
174174
self
175175
}
176176

177-
/// Add a directory to the library search path. Equivalent to `-L`` in rustc.
177+
/// Add a directory to the library search path. Equivalent to `-L` in rustc.
178178
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
179179
self.cmd.arg("-L");
180180
self.cmd.arg(path.as_ref());
181181
self
182182
}
183183

184+
/// Override the system root. Equivalent to `--sysroot` in rustc.
185+
pub fn sysroot<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
186+
self.cmd.arg("--sysroot");
187+
self.cmd.arg(path.as_ref());
188+
self
189+
}
190+
184191
/// Specify the edition year.
185192
pub fn edition(&mut self, edition: &str) -> &mut Self {
186193
self.cmd.arg("--edition");

src/tools/tidy/src/allowed_run_make_makefiles.txt

-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ run-make/compiler-rt-works-on-mingw/Makefile
2424
run-make/compressed-debuginfo/Makefile
2525
run-make/const-prop-lint/Makefile
2626
run-make/const_fn_mir/Makefile
27-
run-make/core-no-oom-handling/Makefile
2827
run-make/crate-data-smoke/Makefile
2928
run-make/crate-hash-rustc-version/Makefile
3029
run-make/crate-name-priority/Makefile
@@ -96,7 +95,6 @@ run-make/issue-15460/Makefile
9695
run-make/issue-18943/Makefile
9796
run-make/issue-20626/Makefile
9897
run-make/issue-22131/Makefile
99-
run-make/issue-24445/Makefile
10098
run-make/issue-25581/Makefile
10199
run-make/issue-26006/Makefile
102100
run-make/issue-26092/Makefile
@@ -106,7 +104,6 @@ run-make/issue-35164/Makefile
106104
run-make/issue-36710/Makefile
107105
run-make/issue-37839/Makefile
108106
run-make/issue-37893/Makefile
109-
run-make/issue-38237/Makefile
110107
run-make/issue-40535/Makefile
111108
run-make/issue-46239/Makefile
112109
run-make/issue-47384/Makefile

tests/run-make/alloc-no-oom-handling/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This test checks that alloc can still compile correctly
1+
// This test checks that alloc can still compile successfully
22
// when the unstable no_global_oom_handling feature is turned on.
33
// See https://github.com/rust-lang/rust/pull/84266
44

tests/run-make/alloc-no-rc/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This test checks that alloc can still compile correctly
1+
// This test checks that alloc can still compile successfully
22
// when the unstable no_rc feature is turned on.
33
// See https://github.com/rust-lang/rust/pull/84266
44

tests/run-make/alloc-no-sync/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This test checks that alloc can still compile correctly
1+
// This test checks that alloc can still compile successfully
22
// when the unstable no_sync feature is turned on.
33
// See https://github.com/rust-lang/rust/pull/84266
44

tests/run-make/core-no-oom-handling/Makefile

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This test checks that the core library can still compile successfully
2+
// when the no_global_oom_handling feature is turned on.
3+
// See https://github.com/rust-lang/rust/pull/110649
4+
5+
use run_make_support::{rustc, tmp_dir};
6+
7+
fn main() {
8+
rustc()
9+
.edition("2021")
10+
.arg("-Dwarnings")
11+
.crate_type("rlib")
12+
.input("../../../library/core/src/lib.rs")
13+
.sysroot(tmp_dir().join("fakeroot"))
14+
.cfg("no_global_oom_handling")
15+
.run();
16+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// A very specific set of circumstances (mainly, implementing Deref, and
2+
// having a procedural macro and a Debug derivation in external crates) caused
3+
// an internal compiler error (ICE) when trying to use rustdoc. This test
4+
// reproduces the exact circumstances which caused the bug and checks
5+
// that it does not happen again.
6+
// See https://github.com/rust-lang/rust/issues/38237
7+
8+
//@ ignore-cross-compile
9+
10+
use run_make_support::{rustc, rustdoc, tmp_dir};
11+
12+
fn main() {
13+
rustc().input("foo.rs").run();
14+
rustc().input("bar.rs").run();
15+
rustdoc().input("baz.rs").library_search_path(tmp_dir()).output(tmp_dir()).run();
16+
}

tests/run-make/issue-24445/Makefile

-11
This file was deleted.

tests/run-make/issue-38237/Makefile

-6
This file was deleted.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// It was once required to use a position-independent executable (PIE)
2+
// in order to use the thread_local! macro, or some symbols would contain
3+
// a NULL address. This was fixed, and this test checks a non-PIE, then a PIE
4+
// build to see if this bug makes a resurgence.
5+
// See https://github.com/rust-lang/rust/pull/24448
6+
7+
//@ ignore-cross-compile
8+
//@ only-linux
9+
10+
use run_make_support::{cc, run, rustc, tmp_dir};
11+
12+
fn main() {
13+
rustc().input("foo.rs").run();
14+
cc().input("foo.c")
15+
.arg("-lfoo")
16+
.library_search_path(tmp_dir())
17+
.arg("-Wl,--gc-sections")
18+
.arg("-lpthread")
19+
.arg("-ldl")
20+
.out_exe("foo")
21+
.run();
22+
run("foo");
23+
cc().input("foo.c")
24+
.arg("-lfoo")
25+
.library_search_path(tmp_dir())
26+
.arg("-Wl,--gc-sections")
27+
.arg("-lpthread")
28+
.arg("-ldl")
29+
.arg("-pie")
30+
.arg("-fPIC")
31+
.out_exe("foo")
32+
.run();
33+
run("foo");
34+
}

0 commit comments

Comments
 (0)