Skip to content

Commit

Permalink
Use preferred miri cfg pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhoo committed Apr 26, 2020
1 parent 81a77af commit 05f397e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ impl<T> Bus<T> {
});

// work around https://github.com/rust-lang/rust/issues/59020
let _ = time::Instant::now().elapsed();
if !cfg!(miri) && cfg!(target = "macos") {
let _ = time::Instant::now().elapsed();
}

// we run a separate thread responsible for unparking
// so we don't have to wait for unpark() to return in broadcast_inner
Expand Down
12 changes: 6 additions & 6 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn it_reads_when_full() {
}

#[test]
#[cfg(not(miri))]
#[cfg_attr(miri, ignore)]
fn it_iterates() {
use std::thread;

Expand All @@ -72,7 +72,7 @@ fn it_iterates() {
}

#[test]
#[cfg(not(miri))]
#[cfg_attr(miri, ignore)]
fn aggressive_iteration() {
for _ in 0..1_000 {
use std::thread;
Expand Down Expand Up @@ -130,7 +130,7 @@ fn it_handles_leaves() {
}

#[test]
#[cfg(not(miri))]
#[cfg_attr(miri, ignore)]
fn it_runs_blocked_writes() {
use std::thread;

Expand All @@ -152,7 +152,7 @@ fn it_runs_blocked_writes() {
}

#[test]
#[cfg(not(miri))]
#[cfg_attr(miri, ignore)]
fn it_runs_blocked_reads() {
use std::sync::mpsc;
use std::thread;
Expand All @@ -172,7 +172,7 @@ fn it_runs_blocked_reads() {
}

#[test]
#[cfg(not(miri))]
#[cfg_attr(miri, ignore)]
fn it_can_count_to_10000() {
use std::thread;

Expand All @@ -193,7 +193,7 @@ fn it_can_count_to_10000() {
}

#[test]
#[cfg(not(miri))]
#[cfg_attr(miri, ignore)]
fn test_busy() {
use std::thread;

Expand Down

0 comments on commit 05f397e

Please sign in to comment.