Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ jobs:
cd benchmark
cargo run --release --bin mutex -- 2 1 0 1 2
cargo run --release --bin rwlock -- 1 1 1 0 1 2
miri:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: bash ci/miri.sh
22 changes: 22 additions & 0 deletions ci/miri.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -ex

export CARGO_NET_RETRY=5
export CARGO_NET_TIMEOUT=10

rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup

# We use different seeds for the different features to get a bit more test coverage.
SEED=0
for FEATURE in arc_lock serde deadlock_detection nightly hardware-lock-elision; do
export MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-seed=$SEED"
if [ "$FEATURE" = "deadlock_detection" ]; then
# There's a background thread that never goes away, so Miri can't check for leaks.
MIRIFLAGS="$MIRIFLAGS -Zmiri-ignore-leaks"
fi
cargo miri test --features=$FEATURE
SEED=$(( $SEED+1 ))
done
1 change: 1 addition & 0 deletions src/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ mod tests {
/// This module contains an integration test that is heavily inspired from WebKit's own integration
/// tests for it's own Condvar.
#[cfg(test)]
#[cfg(not(miri))] // Miri is too slow
mod webkit_queue_test {
use crate::{Condvar, Mutex, MutexGuard};
use std::{collections::VecDeque, sync::Arc, thread, time::Duration};
Expand Down
2 changes: 1 addition & 1 deletion src/fair_mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ mod tests {

#[test]
fn lots_and_lots() {
const J: u32 = 1000;
const J: u32 = if cfg!(miri) { 200 } else { 1000 };
const K: u32 = 3;

let m = Arc::new(FairMutex::new(0));
Expand Down
2 changes: 1 addition & 1 deletion src/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ mod tests {

#[test]
fn lots_and_lots() {
const J: u32 = 1000;
const J: u32 = if cfg!(miri) { 200 } else { 1000 };
const K: u32 = 3;

let m = Arc::new(Mutex::new(0));
Expand Down
2 changes: 1 addition & 1 deletion src/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ mod tests {
#[test]
fn frob() {
const N: u32 = 10;
const M: u32 = 1000;
const M: u32 = if cfg!(miri) { 100 } else { 1000 };

let r = Arc::new(RwLock::new(()));

Expand Down