Skip to content

Commit

Permalink
Rollup merge of rust-lang#94645 - RalfJung:available-parallelism-miri…
Browse files Browse the repository at this point in the history
…, r=the8472

do not attempt to open cgroup files under Miri

Since rust-lang#92697, `cargo miri test` always fails under default flags, and one would have to use `MIRIFLAGS=-Zmiri-disable-isolation cargo miri test` instead. This PR fixes that problem.

Cc `@the8472` `@joshtriplett`
  • Loading branch information
RalfJung authored Mar 5, 2022
2 parents 49d20c4 + 51b4ea2 commit 00fd87e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions library/std/src/sys/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ fn cgroup2_quota() -> usize {
use crate::path::PathBuf;

let mut quota = usize::MAX;
if cfg!(miri) {
// Attempting to open a file fails under default flags due to isolation.
// And Miri does not have parallelism anyway.
return quota;
}

let _: Option<()> = try {
let mut buf = Vec::with_capacity(128);
Expand Down

0 comments on commit 00fd87e

Please sign in to comment.