Skip to content

Commit

Permalink
Auto merge of #3307 - RalfJung:macos-unreliable, r=RalfJung
Browse files Browse the repository at this point in the history
tests/pass/concurrency/sync: try to make it less likely for the test to fail on macOS

We're already sleeping a full second though. How can our test be stalled for an entire second, what are these CI runners doing?!?
  • Loading branch information
bors committed Feb 19, 2024
2 parents f743422 + 385479c commit 99df708
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tools/miri/tests/pass/concurrency/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ fn check_conditional_variables_timed_wait_timeout() {
let cvar = Condvar::new();
let guard = lock.lock().unwrap();
let now = Instant::now();
let (_guard, timeout) = cvar.wait_timeout(guard, Duration::from_millis(100)).unwrap();
let (_guard, timeout) = cvar.wait_timeout(guard, Duration::from_millis(10)).unwrap();
assert!(timeout.timed_out());
let elapsed_time = now.elapsed().as_millis();
assert!(100 <= elapsed_time && elapsed_time <= 1000);
assert!(10 <= elapsed_time && elapsed_time <= 1000);
}

/// Test that signaling a conditional variable when waiting with a timeout works
Expand All @@ -79,7 +79,7 @@ fn check_conditional_variables_timed_wait_notimeout() {
let guard = lock.lock().unwrap();

let handle = thread::spawn(move || {
thread::sleep(Duration::from_millis(100)); // Make sure the other thread is waiting by the time we call `notify`.
thread::sleep(Duration::from_millis(1)); // Make sure the other thread is waiting by the time we call `notify`.
let (_lock, cvar) = &*pair2;
cvar.notify_one();
});
Expand Down

0 comments on commit 99df708

Please sign in to comment.