From 1400a029044d7ee90787f9d21ac6f52c8653b824 Mon Sep 17 00:00:00 2001 From: Parker Timmerman Date: Mon, 3 Jan 2022 12:54:59 -0500 Subject: [PATCH 1/3] branch start, add Miri to CI --- .github/workflows/ci.yml | 18 ++++++++++++++++++ compact_str/src/repr/heap/arc.rs | 1 + compact_str/src/tests.rs | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ecc661e..cbe8fc3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,24 @@ jobs: command: test args: --all-features + miri: + name: cargo miri test + runs-on: ubuntu-latest + env: + # We reduce the number of "randomized runs" because Miri is quite slow + RANDOMIZED_RUNS: 1000 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: miri + - name: Run Miri + run: | + cargo miri test + example-serde: name: example - serde runs-on: ubuntu-latest diff --git a/compact_str/src/repr/heap/arc.rs b/compact_str/src/repr/heap/arc.rs index 693786bf..cdf53e6c 100644 --- a/compact_str/src/repr/heap/arc.rs +++ b/compact_str/src/repr/heap/arc.rs @@ -230,6 +230,7 @@ mod test { proptest! { #[test] + #[cfg_attr(miri, ignore)] fn test_strings_roundtrip(word in rand_unicode()) { let arc_str = ArcString::from(word.as_str()); prop_assert_eq!(&word, arc_str.as_str()); diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs index 895307be..d523b12e 100644 --- a/compact_str/src/tests.rs +++ b/compact_str/src/tests.rs @@ -22,6 +22,7 @@ fn rand_unicode_collection() -> impl Strategy> { proptest! { #[test] + #[cfg_attr(miri, ignore)] fn test_strings_roundtrip(word in rand_unicode()) { let compact = CompactStr::new(&word); prop_assert_eq!(&word, &compact); @@ -29,6 +30,7 @@ proptest! { #[test] + #[cfg_attr(miri, ignore)] fn test_strings_allocated_properly(word in rand_unicode()) { let compact = CompactStr::new(&word); @@ -42,12 +44,14 @@ proptest! { } #[test] + #[cfg_attr(miri, ignore)] fn test_char_iterator_roundtrips(word in rand_unicode()) { let compact: CompactStr = word.clone().chars().collect(); prop_assert_eq!(&word, &compact) } #[test] + #[cfg_attr(miri, ignore)] fn test_string_iterator_roundtrips(collection in rand_unicode_collection()) { let compact: CompactStr = collection.clone().into_iter().collect(); let word: String = collection.into_iter().collect(); From 680ca856b31bef225dca8268a4c73db656249260 Mon Sep 17 00:00:00 2001 From: Parker Timmerman Date: Mon, 3 Jan 2022 13:00:46 -0500 Subject: [PATCH 2/3] update miri workflow to use --nocapture --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbe8fc3f..0b750133 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: components: miri - name: Run Miri run: | - cargo miri test + cargo miri test -- --nocapture example-serde: name: example - serde From 7adbe967a86881ea48ebffccf48e81c93dc103fa Mon Sep 17 00:00:00 2001 From: Parker Timmerman Date: Mon, 3 Jan 2022 13:21:51 -0500 Subject: [PATCH 3/3] get rid of --nocapture --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b750133..cbe8fc3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: components: miri - name: Run Miri run: | - cargo miri test -- --nocapture + cargo miri test example-serde: name: example - serde