Skip to content

Commit

Permalink
Merge pull request #8 from asynchronics/feature-miri-tests
Browse files Browse the repository at this point in the history
Customize tests for Miri & add Miri to CI
  • Loading branch information
sbarral authored Apr 22, 2024
2 parents 9534cdd + 4d4ca61 commit aa1a72d
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 97 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,7 @@ jobs:
toolchain: ${{ matrix.rust }}

- name: Run cargo check
run: cargo check --benches

check-no-atomic-u64:
name: Check (no AtomicU64)
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: mips-unknown-linux-gnu

- name: Run cargo check
run: cargo check --target mips-unknown-linux-gnu --no-default-features
run: cargo check

test:
name: Test suite
Expand Down Expand Up @@ -71,6 +56,23 @@ jobs:
LOOM_MAX_PREEMPTIONS: 3
RUSTFLAGS: --cfg st3_loom

miri:
name: Miri
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: miri

- name: Run cargo miri
run: cargo miri test
env:
MIRIFLAGS: -Zmiri-strict-provenance

lints:
name: Lints
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions src/fifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use alloc::sync::Arc;

use core::alloc::Layout;
use core::iter::FusedIterator;
use core::mem::{drop, transmute, MaybeUninit};
use core::mem::{transmute, MaybeUninit};
use core::panic::{RefUnwindSafe, UnwindSafe};
use core::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};

Expand Down Expand Up @@ -280,8 +280,8 @@ impl<T> Worker<T> {
/// can in particular be used to perform a cheap equality check with another
/// `Stealer` and verify that it is associated to the same `Worker`.
pub fn stealer_ref(&self) -> &Stealer<T> {
// Sanity checks to assess that `queue` has indeed the size and
// alignment of a `Stealer` (this assert is optimized in release mode).
// Sanity check to assess that `queue` has indeed the size and alignment
// of a `Stealer` (this assert is optimized away in release mode).
assert_eq!(Layout::for_value(&self.queue), Layout::new::<Stealer<T>>());

// Safety: `self.queue` has the size and alignment of `Stealer` since
Expand Down
6 changes: 3 additions & 3 deletions src/lifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use alloc::sync::Arc;

use core::alloc::Layout;
use core::iter::FusedIterator;
use core::mem::{drop, transmute, MaybeUninit};
use core::mem::{transmute, MaybeUninit};
use core::panic::{RefUnwindSafe, UnwindSafe};
use core::sync::atomic::Ordering::{Acquire, Relaxed, Release};

Expand Down Expand Up @@ -324,8 +324,8 @@ impl<T> Worker<T> {
/// can in particular be used to perform a cheap equality check with another
/// `Stealer` and verify that it is associated to the same `Worker`.
pub fn stealer_ref(&self) -> &Stealer<T> {
// Sanity checks to assess that `queue` has indeed the size and
// alignment of a `Stealer` (this assert is optimized in release mode).
// Sanity check to assess that `queue` has indeed the size and alignment
// of a `Stealer` (this assert is optimized away in release mode).
assert_eq!(Layout::for_value(&self.queue), Layout::new::<Stealer<T>>());

// Safety: `self.queue` has the size and alignment of `Stealer` since
Expand Down
Loading

0 comments on commit aa1a72d

Please sign in to comment.