Skip to content

Commit 9ed6941

Browse files
committed
run miri on CI
1 parent 9beb753 commit 9ed6941

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ matrix:
2222
- rust: nightly
2323
env:
2424
- FEATURES='array-sizes-33-128 array-sizes-129-255'
25+
- name: "miri"
26+
script: sh ci/miri.sh
2527
branches:
2628
only:
2729
- master

ci/miri.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env sh
2+
3+
set -ex
4+
5+
export CARGO_NET_RETRY=5
6+
export CARGO_NET_TIMEOUT=10
7+
8+
MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
9+
echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
10+
rustup default "$MIRI_NIGHTLY"
11+
12+
rustup component add miri
13+
cargo miri setup
14+
15+
cargo miri test -- -- -Zunstable-options --exclude-should-panic

src/char.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ pub unsafe fn encode_utf8(ch: char, ptr: *mut u8, len: usize) -> Result<usize, E
6363

6464

6565
#[test]
66+
#[cfg(not(miri))] // Miri is too slow
6667
fn test_encode_utf8() {
6768
// Test that all codepoints are encoded correctly
6869
let mut data = [0u8; 16];

tests/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ fn test_drop() {
165165
}
166166

167167
#[test]
168+
#[cfg(not(miri))] // Miri does not support unwinding
168169
fn test_drop_panics() {
169170
use std::cell::Cell;
170171
use std::panic::catch_unwind;

0 commit comments

Comments
 (0)