Skip to content

Commit

Permalink
[ci] Don't run ignored tests under Miri (#399)
Browse files Browse the repository at this point in the history
In #376, we introduced `test_validate_rust_layout`, which took a long
time to run under Miri. In order to prevent it from consuming too much
time in CI, we marked it as `#[cfg_attr(miri, ignore)]`, and configured
CI to pass `-- --ignored` to Miri only a small percentage of the time.

This had the unintended side effect of running
`test_validate_cast_and_convert_metadata` under Miri. That test is
marked as `#[cfg_attr(miri, ignore)]` for good reason - it takes far too
long to run under Miri, and doesn't exercise any `unsafe` code, so
doesn't benefit from Miri. Enabling this test has caused CI to timeout.

In the interim, in #395, we optimized `test_validate_rust_layout` so
that it no longer takes an unreasonably long time to run under Miri.
Thus, in this commit, we remove the `#[cfg_attr(miri, ignore)]`
annotation from that test, and no longer pass `-- --ignored` to Miri in
CI.

Closes #397
  • Loading branch information
joshlf authored Sep 19, 2023
1 parent f192b86 commit 53d20b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,14 @@ jobs:
# Run under both the stacked borrows model (default) and under the tree
# borrows model to ensure we're compliant with both.
for EXTRA_FLAGS in "" "-Zmiri-tree-borrows"; do
# On `--skip ui`: Skip the `ui` test since it invokes the compiler,
# which we can't do from Miri (and wouldn't want to do anyway).
#
# On `matrix.features == '--all-features': We mark tests which are
# particularly expensive to run under Miri as
# `#[cfg_attr(miri, ignore)]`. We want to run them once per
# toolchain/target combination, but not once per feature set so we
# keep the expensive computation to a minimum.
#
# TODO(#391): Optimize these tests.
# Skip the `ui` test since it invokes the compiler, which we can't do
# from Miri (and wouldn't want to do anyway).
MIRIFLAGS="$MIRIFLAGS $EXTRA_FLAGS" ./cargo.sh +${{ matrix.toolchain }} \
miri test \
--package ${{ matrix.crate }} \
--target ${{ matrix.target }} \
${{ matrix.features }} \
-- --skip ui \
${{ matrix.features == '--all-features' && '--ignored' || '' }}
-- --skip ui
done
# Only nightly has a working Miri, so we skip installing on all other
# toolchains.
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3325,10 +3325,7 @@ mod tests {
.for_each(validate_behavior);
}

// TODO(#391): Optimize this test so we it consumes less time under Miri in
// CI.
#[test]
#[cfg_attr(miri, ignore)]
#[cfg(__INTERNAL_USE_ONLY_NIGHLTY_FEATURES_IN_TESTS)]
fn test_validate_rust_layout() {
use core::ptr::NonNull;
Expand Down

0 comments on commit 53d20b2

Please sign in to comment.