Skip to content

Commit

Permalink
rewrite libtest-thread-limit to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Aug 5, 2024
1 parent a1f1565 commit 97485af
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 8 deletions.
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3148,6 +3148,7 @@ dependencies = [
"bstr",
"build_helper",
"gimli 0.31.0",
"libc",
"object 0.36.2",
"regex",
"similar",
Expand Down
1 change: 1 addition & 0 deletions src/tools/run-make-support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ wasmparser = { version = "0.214", default-features = false, features = ["std"] }
regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
gimli = "0.31.0"
build_helper = { path = "../build_helper" }
libc = "0.2"
1 change: 1 addition & 0 deletions src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub mod rfs {
// Re-exports of third-party library crates.
pub use bstr;
pub use gimli;
pub use libc;
pub use object;
pub use regex;
pub use wasmparser;
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ run-make/jobserver-error/Makefile
run-make/libs-through-symlinks/Makefile
run-make/libtest-json/Makefile
run-make/libtest-junit/Makefile
run-make/libtest-thread-limit/Makefile
run-make/long-linker-command-lines-cmd-exe/Makefile
run-make/long-linker-command-lines/Makefile
run-make/min-global-align/Makefile
Expand Down
7 changes: 0 additions & 7 deletions tests/run-make/libtest-thread-limit/Makefile

This file was deleted.

26 changes: 26 additions & 0 deletions tests/run-make/libtest-thread-limit/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// libtest used to panic if it hit the thread limit. This often resulted in spurious test failures
// (thread 'main' panicked at 'called Result::unwrap() on an Err value: Os
// { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }' ...
// error: test failed, to rerun pass '--lib').
// Since the fix in #81546, the test should continue to run synchronously
// if it runs out of threads. Therefore, this test's final execution step
// should succeed without an error.
// See https://github.com/rust-lang/rust/pull/81546

//@ only-linux
// Reason: thread limit modification

use run_make_support::{libc, run, rustc};

fn main() {
rustc().input("test.rs").arg("--test").run();
let rlimit = libc::rlimit {
rlim_cur: 1, // or 1, needs testing
rlim_max: 1, // or 1, needs testing
};
let ptr = &rlimit as *const libc::rlimit;
unsafe {
libc::setrlimit(0, ptr);
}
run("test");
}
1 change: 1 addition & 0 deletions tests/run-make/macos-deployment-target/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// See https://github.com/rust-lang/rust/pull/105123

//@ only-macos
// Reason: this test exercises an OSX-specific issue

use run_make_support::{cmd, rustc};

Expand Down

0 comments on commit 97485af

Please sign in to comment.