Skip to content

Commit

Permalink
Run miri on CI (#350)
Browse files Browse the repository at this point in the history
* Run miri on nightly

* Exclude tests under miri on CI that take over a minute to run
  • Loading branch information
zrhoffman committed Jul 26, 2023
1 parent a6b30d8 commit dd17d00
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Expand Up @@ -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"]
6 changes: 6 additions & 0 deletions src/tests.rs
Expand Up @@ -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| {
Expand All @@ -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| {
Expand All @@ -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(
Expand Down Expand Up @@ -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) {
Expand All @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit dd17d00

Please sign in to comment.