Skip to content

Commit

Permalink
split miri test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Sep 15, 2024
1 parent 381c9e5 commit a870049
Show file tree
Hide file tree
Showing 27 changed files with 1,761 additions and 1,736 deletions.
102 changes: 46 additions & 56 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,68 +217,58 @@ jobs:
run: ci/sanitizer_generic.sh
if: matrix.os != 'ubuntu-latest'

miri-tb-unsync:
name: miri-tb-unsync
strategy:
matrix:
os:
- ubuntu-latest
# - macos-latest
# - windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache cargo build and registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-miri-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-miri-
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Miri (Linux)
run: ci/miri_tb_unsync.sh
if: matrix.os == 'ubuntu-latest'
# miri-tb-unsync:
# name: miri-tb-unsync
# strategy:
# matrix:
# os:
# - ubuntu-latest
# # - macos-latest
# # - windows-latest
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v3
# - name: Cache cargo build and registry
# uses: actions/cache@v3
# with:
# path: |
# ~/.cargo/registry
# ~/.cargo/git
# target
# key: ${{ runner.os }}-miri-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: |
# ${{ runner.os }}-miri-
# - name: Install cargo-hack
# run: cargo install cargo-hack
# - name: Miri (Linux)
# run: ci/miri_tb_unsync.sh
# if: matrix.os == 'ubuntu-latest'

miri-tb-swmr:
name: miri-tb-swmr
strategy:
matrix:
os:
- ubuntu-latest
# - macos-latest
# - windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache cargo build and registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-miri-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-miri-
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Miri (Linux)
run: ci/miri_tb_swmr.sh
if: matrix.os == 'ubuntu-latest'

miri-tb-swmr-generic:
name: miri-tb-swmr-generic
miri-tb:
name: miri-tb-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.features }}
strategy:
matrix:
os:
- ubuntu-latest
# - macos-latest
# - windows-latest
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
features:
- test-unsync-insert
- test-unsync-iters
- test-unsync-get
- test-unsync-constructor
- test-swmr-insert
- test-swmr-iters
- test-swmr-get
- test-swmr-constructor
- test-swmr-generic-insert
- test-swmr-generic-iters
- test-swmr-generic-get
- test-swmr-generic-constructor
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -295,7 +285,7 @@ jobs:
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Miri (Linux)
run: ci/miri_tb_swmr_generic.sh
run: ci/miri_tb.sh
if: matrix.os == 'ubuntu-latest'

# miri-sb:
Expand Down
18 changes: 15 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,21 @@ xxhash3 = ["dbutils/xxhash3", "std"]
xxhash64 = ["dbutils/xxhash64", "std"]

## only for miri testing
test-unsync = ["std"]
test-swmr = ["std"]
test-swmr-generic = ["std"]
test-unsync-insert = ["std"]
test-unsync-iters = ["std"]
test-unsync-get = ["std"]
test-unsync-constructor = ["std"]

test-swmr-insert = ["std"]
test-swmr-iters = ["std"]
test-swmr-get = ["std"]
test-swmr-constructor = ["std"]

test-swmr-generic-insert = ["std"]
test-swmr-generic-iters = ["std"]
test-swmr-generic-get = ["std"]
test-swmr-generic-constructor = ["std"]


[dependencies]
among = { version = "0.1", default-features = false, features = ["either"] }
Expand Down
14 changes: 10 additions & 4 deletions ci/miri_tb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup

# Default target platform and features if none are passed
TARGET=${1:-x86_64-unknown-linux-gnu}
FEATURES=${2:-test-swmr}

export MIRIFLAGS="-Zmiri-symbolic-alignment-check -Zmiri-disable-isolation -Zmiri-tree-borrows"

cargo miri test --tests --target x86_64-unknown-linux-gnu --all-features
# cargo miri test --tests --target aarch64-unknown-linux-gnu #crossbeam_utils has problem on this platform
cargo miri test --tests --target i686-unknown-linux-gnu --all-features
cargo miri test --tests --target powerpc64-unknown-linux-gnu --all-features
cargo miri test --tests --target $TARGET --features $FEATURES --lib

# cargo miri test --tests --target x86_64-unknown-linux-gnu --all-features
# # cargo miri test --tests --target aarch64-unknown-linux-gnu #crossbeam_utils has problem on this platform
# cargo miri test --tests --target i686-unknown-linux-gnu --all-features
# cargo miri test --tests --target powerpc64-unknown-linux-gnu --all-features
10 changes: 0 additions & 10 deletions ci/miri_tb_generic.sh

This file was deleted.

13 changes: 0 additions & 13 deletions ci/miri_tb_swmr.sh

This file was deleted.

13 changes: 0 additions & 13 deletions ci/miri_tb_swmr_generic.sh

This file was deleted.

13 changes: 0 additions & 13 deletions ci/miri_tb_unsync.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const MAGIC_TEXT_SIZE: usize = MAGIC_TEXT.len();
const MAGIC_VERSION_SIZE: usize = mem::size_of::<u16>();
const HEADER_SIZE: usize = MAGIC_TEXT_SIZE + MAGIC_VERSION_SIZE;

#[cfg(all(test, any(feature = "test-swmr", feature = "test-unsync")))]
#[cfg(test)]
#[macro_use]
mod tests;

Expand Down
2 changes: 1 addition & 1 deletion src/swmr/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub use reader::*;
mod iter;
pub use iter::*;

#[cfg(all(test, feature = "test-swmr-generic"))]
#[cfg(test)]
mod tests;

#[doc(hidden)]
Expand Down
Loading

0 comments on commit a870049

Please sign in to comment.