diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70c4847..dc3e10e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,24 @@ jobs: - name: Run tests 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: name: Minimal versions check runs-on: ${{ matrix.os }} diff --git a/src/handler.rs b/src/handler.rs index b5f9993..3aca572 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -261,6 +261,7 @@ impl MietteHandlerOpts { } } + #[cfg(not(miri))] pub(crate) fn get_width(&self) -> usize { self.width.unwrap_or_else(|| { terminal_size::terminal_size() @@ -269,6 +270,14 @@ impl MietteHandlerOpts { .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) + } } /** diff --git a/tests/compiletest.rs b/tests/compiletest.rs index f9aea23..7974a62 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -1,4 +1,5 @@ #[rustversion::attr(not(nightly), ignore)] +#[cfg_attr(miri, ignore)] #[test] fn ui() { let t = trybuild::TestCases::new();