mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-26 00:00:20 +02:00
CI: run test suite in Miri (#456)
This commit is contained in:
@@ -123,6 +123,13 @@ jobs:
|
|||||||
run: rustup component add rust-src
|
run: rustup component add rust-src
|
||||||
- name: ASAN / TSAN
|
- name: ASAN / TSAN
|
||||||
run: . ci/tsan.sh
|
run: . ci/tsan.sh
|
||||||
|
miri:
|
||||||
|
name: miri
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Miri
|
||||||
|
run: ci/miri.sh
|
||||||
|
|
||||||
# Loom
|
# Loom
|
||||||
loom:
|
loom:
|
||||||
|
|||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
|
||||||
|
echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
|
||||||
|
rustup set profile minimal
|
||||||
|
rustup default "$MIRI_NIGHTLY"
|
||||||
|
rustup component add miri
|
||||||
|
|
||||||
|
cargo miri test
|
||||||
|
cargo miri test --target mips64-unknown-linux-gnuabi64
|
||||||
+4
-3
@@ -461,6 +461,7 @@ fn reserve_allocates_at_least_original_capacity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // Miri is too slow
|
||||||
fn reserve_max_original_capacity_value() {
|
fn reserve_max_original_capacity_value() {
|
||||||
const SIZE: usize = 128 * 1024;
|
const SIZE: usize = 128 * 1024;
|
||||||
|
|
||||||
@@ -608,15 +609,15 @@ fn advance_past_len() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
// Only run these tests on little endian systems. CI uses qemu for testing
|
// Only run these tests on little endian systems. CI uses qemu for testing
|
||||||
// little endian... and qemu doesn't really support threading all that well.
|
// big endian... and qemu doesn't really support threading all that well.
|
||||||
#[cfg(target_endian = "little")]
|
#[cfg(any(miri, target_endian = "little"))]
|
||||||
fn stress() {
|
fn stress() {
|
||||||
// Tests promoting a buffer from a vec -> shared in a concurrent situation
|
// Tests promoting a buffer from a vec -> shared in a concurrent situation
|
||||||
use std::sync::{Arc, Barrier};
|
use std::sync::{Arc, Barrier};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
const THREADS: usize = 8;
|
const THREADS: usize = 8;
|
||||||
const ITERS: usize = 1_000;
|
const ITERS: usize = if cfg!(miri) { 100 } else { 1_000 };
|
||||||
|
|
||||||
for i in 0..ITERS {
|
for i in 0..ITERS {
|
||||||
let data = [i as u8; 256];
|
let data = [i as u8; 256];
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
//! Test using `Bytes` with an allocator that hands out "odd" pointers for
|
//! Test using `Bytes` with an allocator that hands out "odd" pointers for
|
||||||
//! vectors (pointers where the LSB is set).
|
//! vectors (pointers where the LSB is set).
|
||||||
|
|
||||||
|
#![cfg(not(miri))] // Miri does not support custom allocators (also, Miri is "odd" by default with 50% chance)
|
||||||
|
|
||||||
use std::alloc::{GlobalAlloc, Layout, System};
|
use std::alloc::{GlobalAlloc, Layout, System};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user