Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run miri on CI #350

Merged
merged 2 commits into from Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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