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 54f1008
Show file tree
Hide file tree
Showing 31 changed files with 2,047 additions and 1,831 deletions.
10 changes: 4 additions & 6 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ ignore:
- "**/integration/"
- "**/examples/"
- "**/benches/"
- "src/swmr/generic/traits/impls/"
- "src/swmr/generic/traits/impls.rs"
- "src/tests.rs"
- "src/swmr/generic/tests.rs"
- "src/swmr/wal/tests.rs"
- "src/unsync/tests.rs"
- "**/impls/"
- "**/impls.rs"
- "**/tests.rs"
- "**/tests/"

coverage:
status:
Expand Down
103 changes: 47 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,8 @@ jobs:
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Miri (Linux)
run: ci/miri_tb_swmr_generic.sh
run: |
bash ci/miri_tb.sh ${{ matrix.target }} ${{ matrix.features }}
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
22 changes: 17 additions & 5 deletions ci/miri_tb.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#!/bin/bash
set -e

# Check if TARGET and FEATURES are provided, otherwise panic
if [ -z "$1" ]; then
echo "Error: TARGET is not provided"
exit 1
fi

if [ -z "$2" ]; then
echo "Error: FEATURES are not provided"
exit 1
fi

TARGET=$1
FEATURES=$2

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

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

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 54f1008

Please sign in to comment.