Skip to content

Commit cd3fe6d

Browse files
committed
rewrite libtest-thread-limit to rmake
1 parent a1f1565 commit cd3fe6d

File tree

7 files changed

+31
-9
lines changed

7 files changed

+31
-9
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -3148,6 +3148,7 @@ dependencies = [
31483148
"bstr",
31493149
"build_helper",
31503150
"gimli 0.31.0",
3151+
"libc",
31513152
"object 0.36.2",
31523153
"regex",
31533154
"similar",

src/tools/run-make-support/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ wasmparser = { version = "0.214", default-features = false, features = ["std"] }
1111
regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
1212
gimli = "0.31.0"
1313
build_helper = { path = "../build_helper" }
14+
libc = "0.2"

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

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub mod rfs {
3636
// Re-exports of third-party library crates.
3737
pub use bstr;
3838
pub use gimli;
39+
pub use libc;
3940
pub use object;
4041
pub use regex;
4142
pub use wasmparser;

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ run-make/jobserver-error/Makefile
1313
run-make/libs-through-symlinks/Makefile
1414
run-make/libtest-json/Makefile
1515
run-make/libtest-junit/Makefile
16-
run-make/libtest-thread-limit/Makefile
1716
run-make/long-linker-command-lines-cmd-exe/Makefile
1817
run-make/long-linker-command-lines/Makefile
1918
run-make/min-global-align/Makefile

tests/run-make/libtest-thread-limit/Makefile

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// libtest used to panic if it hit the thread limit. This often resulted in spurious test failures
2+
// (thread 'main' panicked at 'called Result::unwrap() on an Err value: Os
3+
// { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }' ...
4+
// error: test failed, to rerun pass '--lib').
5+
// Since the fix in #81546, the test should continue to run synchronously
6+
// if it runs out of threads. Therefore, this test's final execution step
7+
// should succeed without an error.
8+
// See https://github.com/rust-lang/rust/pull/81546
9+
10+
//@ only-linux
11+
// Reason: thread limit modification
12+
13+
use run_make_support::{libc, run, rustc};
14+
15+
fn main() {
16+
rustc().input("test.rs").arg("--test").run();
17+
let rlimit = libc::rlimit {
18+
rlim_cur: 1, // or 1, needs testing
19+
rlim_max: 1, // or 1, needs testing
20+
};
21+
let ptr = &rlimit as *const libc::rlimit;
22+
unsafe {
23+
libc::setrlimit(0, ptr);
24+
}
25+
run("test");
26+
}

tests/run-make/macos-deployment-target/rmake.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// See https://github.com/rust-lang/rust/pull/105123
55

66
//@ only-macos
7+
// Reason: this test exercises an OSX-specific issue
78

89
use run_make_support::{cmd, rustc};
910

@@ -18,7 +19,7 @@ fn main() {
1819
} else {
1920
"version 10.13"
2021
};
21-
// XXX: The check is for either the x86_64 minimum OR the aarch64 minimum
22+
// NOTE: The check is for either the x86_64 minimum OR the aarch64 minimum
2223
// (M1 starts at macOS 11). They also use different load commands, so we let that change with
2324
// each too. The aarch64 check isn't as robust as the x86 one, but testing both seems unneeded.
2425
cmd("vtool")

0 commit comments

Comments
 (0)