Run miri in CI

This commit is contained in:
Nathan Whitaker 2022-08-22 20:17:35 -07:00
parent 6b6aeb6cf6
commit 550034acdd
3 changed files with 28 additions and 0 deletions

View File

@ -45,6 +45,24 @@ jobs:
- name: Run tests - name: Run tests
run: cargo test --all --verbose --features fancy run: cargo test --all --verbose --features fancy
miri:
name: Miri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: miri,rust-src
override: true
- name: Run tests with miri
env:
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance
run: cargo miri test --all --verbose --features fancy
minimal_versions: minimal_versions:
name: Minimal versions check name: Minimal versions check
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}

View File

@ -261,6 +261,7 @@ impl MietteHandlerOpts {
} }
} }
#[cfg(not(miri))]
pub(crate) fn get_width(&self) -> usize { pub(crate) fn get_width(&self) -> usize {
self.width.unwrap_or_else(|| { self.width.unwrap_or_else(|| {
terminal_size::terminal_size() terminal_size::terminal_size()
@ -269,6 +270,14 @@ impl MietteHandlerOpts {
.0 as usize .0 as usize
}) })
} }
#[cfg(miri)]
// miri doesn't support a syscall (specifically ioctl)
// performed by terminal_size, which causes test execution to fail
// so when miri is running we'll just fallback to a constant
pub(crate) fn get_width(&self) -> usize {
self.width.unwrap_or(80)
}
} }
/** /**

View File

@ -1,4 +1,5 @@
#[rustversion::attr(not(nightly), ignore)] #[rustversion::attr(not(nightly), ignore)]
#[cfg_attr(miri, ignore)]
#[test] #[test]
fn ui() { fn ui() {
let t = trybuild::TestCases::new(); let t = trybuild::TestCases::new();