From 94f3f03a7e9985cf8f3a236ced7aad8eccbb9ee3 Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Mon, 18 Sep 2023 22:08:00 -0700 Subject: [PATCH] [miri] Skip running UI tests (#400) Mark UI tests as `#[cfg_attr(miri, ignore)]`. In CI, remove `-- --skip ui` from our Miri invocation. --- .github/workflows/ci.yml | 5 +---- tests/trybuild.rs | 2 ++ zerocopy-derive/tests/trybuild.rs | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92019f1f8f..29b321845d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,14 +168,11 @@ 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 - # 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 }} done # Only nightly has a working Miri, so we skip installing on all other # toolchains. diff --git a/tests/trybuild.rs b/tests/trybuild.rs index 08ab6d8b04..6319df4325 100644 --- a/tests/trybuild.rs +++ b/tests/trybuild.rs @@ -23,6 +23,7 @@ const SOURCE_FILES_DIR: &str = "tests/ui-stable"; const SOURCE_FILES_DIR: &str = "tests/ui-msrv"; #[test] +#[cfg_attr(miri, ignore)] fn ui() { let t = trybuild::TestCases::new(); t.compile_fail(format!("{SOURCE_FILES_DIR}/*.rs")); @@ -37,6 +38,7 @@ fn ui() { // tests the correct behavior when the "derive" feature is enabled. #[cfg(feature = "derive")] #[test] +#[cfg_attr(miri, ignore)] fn ui_invalid_impls() { let t = trybuild::TestCases::new(); t.compile_fail(format!("{SOURCE_FILES_DIR}/invalid-impls/*.rs")); diff --git a/zerocopy-derive/tests/trybuild.rs b/zerocopy-derive/tests/trybuild.rs index 32f38cc94a..f4489b56fd 100644 --- a/zerocopy-derive/tests/trybuild.rs +++ b/zerocopy-derive/tests/trybuild.rs @@ -23,6 +23,7 @@ const SOURCE_FILES_GLOB: &str = "tests/ui-stable/*.rs"; const SOURCE_FILES_GLOB: &str = "tests/ui-msrv/*.rs"; #[test] +#[cfg_attr(miri, ignore)] fn ui() { let t = trybuild::TestCases::new(); t.compile_fail(SOURCE_FILES_GLOB);