Skip to content

Commit dd17d00

Browse files
authored
Run miri on CI (#350)
* Run miri on nightly * Exclude tests under miri on CI that take over a minute to run
1 parent a6b30d8 commit dd17d00

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

.github/workflows/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
profile: minimal
3737
toolchain: ${{ matrix.toolchain }}
3838
override: true
39+
components: ${{ matrix.toolchain == 'nightly' && 'miri,rust-src' || '' }}
3940

4041
- name: Cargo build
4142
run: cargo build ${{ matrix.features }}
@@ -50,6 +51,10 @@ jobs:
5051
run: cargo build
5152
working-directory: macros
5253

54+
- name: Cargo miri test
55+
if: "matrix.toolchain == 'nightly'"
56+
run: cargo miri test --features skip_long_tests ${{ matrix.features }}
57+
5358
build_result:
5459
name: Result
5560
runs-on: ubuntu-latest

Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ smallvec = "1.0"
3030
[features]
3131
bench = []
3232
dummy_match_byte = []
33+
# Useful for skipping tests when execution is slow, e.g., under miri
34+
skip_long_tests = []
3335

3436
[workspace]
3537
members = [".", "./macros", "./procedural-masquerade"]

src/tests.rs

+6
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ fn color3() {
373373
})
374374
}
375375

376+
#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)]
376377
#[test]
377378
fn color3_hsl() {
378379
run_color_tests(include_str!("css-parsing-tests/color3_hsl.json"), |c| {
@@ -395,6 +396,7 @@ fn color3_keywords() {
395396
)
396397
}
397398

399+
#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)]
398400
#[test]
399401
fn color4_hwb() {
400402
run_color_tests(include_str!("css-parsing-tests/color4_hwb.json"), |c| {
@@ -404,6 +406,7 @@ fn color4_hwb() {
404406
})
405407
}
406408

409+
#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)]
407410
#[test]
408411
fn color4_lab_lch_oklab_oklch() {
409412
run_color_tests(
@@ -939,6 +942,7 @@ fn unquoted_url(b: &mut Bencher) {
939942
})
940943
}
941944

945+
#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)]
942946
#[cfg(feature = "bench")]
943947
#[bench]
944948
fn numeric(b: &mut Bencher) {
@@ -953,6 +957,7 @@ fn numeric(b: &mut Bencher) {
953957

954958
struct JsonParser;
955959

960+
#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)]
956961
#[test]
957962
fn no_stack_overflow_multiple_nested_blocks() {
958963
let mut input: String = "{{".into();
@@ -1413,6 +1418,7 @@ fn parse_sourceurl_comments() {
14131418
}
14141419
}
14151420

1421+
#[cfg_attr(all(miri, feature = "skip_long_tests"), ignore)]
14161422
#[test]
14171423
fn roundtrip_percentage_token() {
14181424
fn test_roundtrip(value: &str) {

0 commit comments

Comments
 (0)