diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 47282234..49e91ad3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,6 +36,7 @@ jobs: profile: minimal toolchain: ${{ matrix.toolchain }} override: true + components: ${{ matrix.toolchain == 'nightly' && 'miri,rust-src' || '' }} - name: Cargo build run: cargo build ${{ matrix.features }} @@ -50,6 +51,10 @@ jobs: run: cargo build working-directory: macros + - name: Cargo miri test + if: "matrix.toolchain == 'nightly'" + run: cargo miri test --features skip_long_tests ${{ matrix.features }} + build_result: name: Result runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index 89310a57..f35bdc75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,8 @@ smallvec = "1.0" [features] bench = [] dummy_match_byte = [] +# Useful for skipping tests when execution is slow, e.g., under miri +skip_long_tests = [] [workspace] members = [".", "./macros", "./procedural-masquerade"] diff --git a/src/tests.rs b/src/tests.rs index 64e995e5..fac0b6be 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -373,6 +373,7 @@ fn color3() { }) } +#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)] #[test] fn color3_hsl() { run_color_tests(include_str!("css-parsing-tests/color3_hsl.json"), |c| { @@ -395,6 +396,7 @@ fn color3_keywords() { ) } +#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)] #[test] fn color4_hwb() { run_color_tests(include_str!("css-parsing-tests/color4_hwb.json"), |c| { @@ -404,6 +406,7 @@ fn color4_hwb() { }) } +#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)] #[test] fn color4_lab_lch_oklab_oklch() { run_color_tests( @@ -939,6 +942,7 @@ fn unquoted_url(b: &mut Bencher) { }) } +#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)] #[cfg(feature = "bench")] #[bench] fn numeric(b: &mut Bencher) { @@ -953,6 +957,7 @@ fn numeric(b: &mut Bencher) { struct JsonParser; +#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)] #[test] fn no_stack_overflow_multiple_nested_blocks() { let mut input: String = "{{".into(); @@ -1413,6 +1418,7 @@ fn parse_sourceurl_comments() { } } +#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)] #[test] fn roundtrip_percentage_token() { fn test_roundtrip(value: &str) {