Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Dec 28, 2024
1 parent 08f81cf commit 52cb970
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 20 deletions.
59 changes: 56 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ jobs:
run: ci/sanitizer_generic.sh
if: matrix.os != 'ubuntu-latest'

miri-tb:
name: miri-tb-${{ matrix.target }}-${{ matrix.cfg }}
miri-tb-bounded:
name: miri-tb-bounded-${{ matrix.target }}-${{ matrix.cfg }}
strategy:
matrix:
os:
Expand Down Expand Up @@ -311,7 +311,60 @@ jobs:
run: cargo install cargo-hack
- name: Miri
run: |
bash ci/miri_tb.sh ${{ matrix.target }} ${{ matrix.cfg }}
bash ci/miri_tb_bounded.sh ${{ matrix.target }} ${{ matrix.cfg }}
miri-tb-unbounded:
name: miri-tb-unbounded-${{ matrix.target }}-${{ matrix.cfg }}
strategy:
matrix:
os:
- ubuntu-latest
# - macos-latest
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- x86_64-apple-darwin
- aarch64-apple-darwin
cfg:
- generic_insert
- generic_iters
- generic_get
- generic_constructor
- dynamic_insert
- dynamic_iters
- dynamic_get
- dynamic_constructor
# Exclude invalid combinations
exclude:
- os: ubuntu-latest
target: x86_64-apple-darwin
- os: ubuntu-latest
target: aarch64-apple-darwin
# - os: macos-latest
# target: x86_64-unknown-linux-gnu
# - os: macos-latest
# target: i686-unknown-linux-gnu
# - os: macos-latest
# target: powerpc64-unknown-linux-gnu
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Cache cargo build and registry
uses: actions/cache@v4
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
run: |
bash ci/miri_tb_unbounded.sh ${{ matrix.target }} ${{ matrix.cfg }}
# valgrind
valgrind:
Expand Down
2 changes: 1 addition & 1 deletion ci/miri_tb.sh → ci/miri_tb_bounded.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ cargo miri setup
export MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-disable-isolation -Zmiri-symbolic-alignment-check -Zmiri-tree-borrows -Zmiri-ignore-leaks"
export RUSTFLAGS="--cfg test_$CONFIG_FLAGS"

cargo miri test --tests --target $TARGET --lib 2>&1 | ts -i '%.s '
cargo miri test --tests --target $TARGET --lib --no-default-features --features bounded,std 2>&1 | ts -i '%.s '

33 changes: 33 additions & 0 deletions ci/miri_tb_unbounded.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -euxo pipefail
IFS=$'\n\t'

# We need 'ts' for the per-line timing
sudo apt-get -y install moreutils
echo

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

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

TARGET=$1
CONFIG_FLAGS=$2

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

# Zmiri-ignore-leaks needed because of https://github.com/crossbeam-rs/crossbeam/issues/579
# -Zmiri-strict-provenance (crossbeam-epoch is not compatible with this flag)
export MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-symbolic-alignment-check -Zmiri-tree-borrows -Zmiri-ignore-leaks"
export RUSTFLAGS="--cfg test_$CONFIG_FLAGS"

cargo miri test --tests --target $TARGET --lib --no-default-features --features unbounded,std 2>&1 | ts -i '%.s '

6 changes: 4 additions & 2 deletions src/swmr/tests/dynamic/constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ where
}
}

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!(
"unbounded": OrderWal<UnboundedTable> [Default::default()]: UnboundedTable {
zero_reserved,
}
);

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!(
"unbounded": OrderWal<UnboundedTable> [Default::default()]: UnboundedTable {
reserved({
Expand All @@ -50,12 +50,14 @@ expand_unit_tests!(
}
);

#[cfg(feature = "bounded")]
expand_unit_tests!(
"bounded": OrderWal<BoundedTable> [Default::default()]: BoundedTable {
zero_reserved,
}
);

#[cfg(feature = "bounded")]
expand_unit_tests!(
"bounded": OrderWal<BoundedTable> [Default::default()]: BoundedTable {
reserved({
Expand Down
6 changes: 4 additions & 2 deletions src/swmr/tests/dynamic/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{

use super::{Person, MB};

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!("unbounded": OrderWal<UnboundedTable> [Default::default()]: UnboundedTable {
mvcc,
gt,
Expand All @@ -23,6 +23,7 @@ expand_unit_tests!("unbounded": OrderWal<UnboundedTable> [Default::default()]: U
lt,
});

#[cfg(feature = "bounded")]
expand_unit_tests!("bounded": OrderWal<BoundedTable> [Default::default()]: BoundedTable {
mvcc,
gt,
Expand All @@ -31,7 +32,7 @@ expand_unit_tests!("bounded": OrderWal<BoundedTable> [Default::default()]: Bound
lt,
});

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!("unbounded": OrderWal<UnboundedTable> [Default::default()]: UnboundedTable {
insert,
unbounded_insert_with_value_builder,
Expand All @@ -40,6 +41,7 @@ expand_unit_tests!("unbounded": OrderWal<UnboundedTable> [Default::default()]: U
unbounded_insert_with_builders,
});

#[cfg(feature = "bounded")]
expand_unit_tests!("bounded": OrderWal<BoundedTable> [Default::default()]: BoundedTable {
insert,
bounded_insert_with_value_builder,
Expand Down
6 changes: 4 additions & 2 deletions src/swmr/tests/dynamic/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ where
(rp1, output, rp2)
}

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!(
move "unbounded": OrderWal<UnboundedTable> [Default::default()]: UnboundedTable {
concurrent_basic |p, _res| {
Expand All @@ -314,6 +314,7 @@ expand_unit_tests!(
}
);

#[cfg(feature = "unbounded")]
expand_unit_tests!(
move "unbounded": OrderWal<UnboundedTable> [Default::default()]: UnboundedTable {
apply |p, (rp1, data, rp2)| {
Expand Down Expand Up @@ -384,7 +385,7 @@ expand_unit_tests!(
}
);

#[cfg(feature = "std")]
#[cfg(feature = "bounded")]
expand_unit_tests!(
move "bounded": OrderWal<BoundedTable> [Default::default()]: BoundedTable {
concurrent_basic |p, _res| {
Expand All @@ -401,6 +402,7 @@ expand_unit_tests!(
}
);

#[cfg(feature = "bounded")]
expand_unit_tests!(
move "bounded": OrderWal<BoundedTable> [Default::default()]: BoundedTable {
apply |p, (rp1, data, rp2)| {
Expand Down
6 changes: 4 additions & 2 deletions src/swmr/tests/dynamic/iters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ use crate::{

use super::MB;

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!("unbounded": OrderWal<UnboundedTable> [Default::default()]: UnboundedTable {
unbounded_iter_with_tombstone_mvcc,
});

#[cfg(feature = "bounded")]
expand_unit_tests!("bounded": OrderWal<BoundedTable> [Default::default()]: BoundedTable {
bounded_iter_with_tombstone_mvcc,
});

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!("unbounded": OrderWal<UnboundedTable> [Default::default()]: UnboundedTable {
unbounded_iter_with_tombstone_next_by_entry,
unbounded_iter_with_tombstone_next_by_with_tombstone_entry,
Expand All @@ -40,6 +41,7 @@ macro_rules! bounded_builder {
}};
}

#[cfg(feature = "bounded")]
expand_unit_tests!("bounded": OrderWal<BoundedTable> [Default::default()]: BoundedTable {
bounded_iter_with_tombstone_next_by_entry(bounded_builder!()),
bounded_iter_with_tombstone_next_by_with_tombstone_entry(bounded_builder!()),
Expand Down
6 changes: 4 additions & 2 deletions src/swmr/tests/generic/constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ where
}
}

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!(
"unbounded": OrderWal<UnboundedTable<Person, String>> [Default::default()]: UnboundedTable<_, _> {
zero_reserved,
}
);

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!(
"unbounded": OrderWal<UnboundedTable<Person, String>> [Default::default()]: UnboundedTable<_, _> {
reserved({
Expand All @@ -50,12 +50,14 @@ expand_unit_tests!(
}
);

#[cfg(feature = "bounded")]
expand_unit_tests!(
"bounded": OrderWal<BoundedTable<Person, String>> [Default::default()]: BoundedTable<_, _> {
zero_reserved,
}
);

#[cfg(feature = "bounded")]
expand_unit_tests!(
"bounded": OrderWal<BoundedTable<Person, String>> [Default::default()]: BoundedTable<_, _> {
reserved({
Expand Down
6 changes: 4 additions & 2 deletions src/swmr/tests/generic/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{

use super::{Person, MB};

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!("unbounded": OrderWal<UnboundedTable<str, str>> [Default::default()]: UnboundedTable<_, _> {
mvcc,
gt,
Expand All @@ -24,6 +24,7 @@ expand_unit_tests!("unbounded": OrderWal<UnboundedTable<str, str>> [Default::def
lt,
});

#[cfg(feature = "bounded")]
expand_unit_tests!("bounded": OrderWal<BoundedTable<str, str>> [Default::default()]: BoundedTable<_, _> {
mvcc,
gt,
Expand All @@ -32,7 +33,7 @@ expand_unit_tests!("bounded": OrderWal<BoundedTable<str, str>> [Default::default
lt,
});

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!("unbounded": OrderWal<UnboundedTable<Person, String>> [Default::default()]: UnboundedTable<_, _> {
insert,
unbounded_insert_with_value_builder,
Expand All @@ -41,6 +42,7 @@ expand_unit_tests!("unbounded": OrderWal<UnboundedTable<Person, String>> [Defaul
unbounded_insert_with_builders,
});

#[cfg(feature = "bounded")]
expand_unit_tests!("bounded": OrderWal<BoundedTable<Person, String>> [Default::default()]: BoundedTable<_, _> {
insert,
bounded_insert_with_value_builder,
Expand Down
6 changes: 4 additions & 2 deletions src/swmr/tests/generic/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ where
(rp1, output, rp2)
}

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!(
move "unbounded": OrderWal<UnboundedTable<u32, [u8; 4]>> [Default::default()]: UnboundedTable<_, _> {
concurrent_basic |p, _res| {
Expand All @@ -328,6 +328,7 @@ expand_unit_tests!(
}
);

#[cfg(feature = "unbounded")]
expand_unit_tests!(
move "unbounded": OrderWal<UnboundedTable<Person, String>> [Default::default()]: UnboundedTable<_, _> {
apply |p, (rp1, data, rp2)| {
Expand Down Expand Up @@ -385,7 +386,7 @@ expand_unit_tests!(
}
);

#[cfg(feature = "std")]
#[cfg(feature = "bounded")]
expand_unit_tests!(
move "bounded": OrderWal<BoundedTable<u32, [u8; 4]>> [Default::default()]: BoundedTable<_, _> {
concurrent_basic |p, _res| {
Expand All @@ -402,6 +403,7 @@ expand_unit_tests!(
}
);

#[cfg(feature = "bounded")]
expand_unit_tests!(
move "bounded": OrderWal<BoundedTable<Person, String>> [Default::default()]: BoundedTable<_, _> {
apply |p, (rp1, data, rp2)| {
Expand Down
6 changes: 4 additions & 2 deletions src/swmr/tests/generic/iters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ use crate::{

use super::MB;

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!("unbounded": OrderWal<UnboundedTable<str, str>> [Default::default()]: UnboundedTable<_, _> {
unbounded_iter_with_tombstone_mvcc,
});

#[cfg(feature = "bounded")]
expand_unit_tests!("bounded": OrderWal<BoundedTable<str, str>> [Default::default()]: BoundedTable<_, _> {
bounded_iter_with_tombstone_mvcc,
});

#[cfg(feature = "std")]
#[cfg(feature = "unbounded")]
expand_unit_tests!("unbounded": OrderWal<UnboundedTable<String, String>> [Default::default()]: UnboundedTable<_, _> {
unbounded_iter_with_tombstone_next_by_entry,
unbounded_iter_with_tombstone_next_by_with_tombstone_entry,
Expand All @@ -40,6 +41,7 @@ macro_rules! bounded_builder {
}};
}

#[cfg(feature = "bounded")]
expand_unit_tests!("bounded": OrderWal<BoundedTable<String, String>> [Default::default()]: BoundedTable<_, _> {
bounded_iter_with_tombstone_next_by_entry(bounded_builder!()),
bounded_iter_with_tombstone_next_by_with_tombstone_entry(bounded_builder!()),
Expand Down

0 comments on commit 52cb970

Please sign in to comment.