Skip to content

Commit ee10f84

Browse files
authored
Add miri test (#655)
* Add miri test Signed-off-by: Moritz Hoffmann <[email protected]> * Add miri component Signed-off-by: Moritz Hoffmann <[email protected]> * too slow Signed-off-by: Moritz Hoffmann <[email protected]> * ignore doc tests, unignore scaling test Signed-off-by: Moritz Hoffmann <[email protected]> * missing guard Signed-off-by: Moritz Hoffmann <[email protected]> * Disable miri on pull request Signed-off-by: Moritz Hoffmann <[email protected]> --------- Signed-off-by: Moritz Hoffmann <[email protected]>
1 parent d361f41 commit ee10f84

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

.github/workflows/miri.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "Test Suite (miri)"
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
test:
9+
name: cargo miri test on ubuntu, rust nightly
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions-rust-lang/setup-rust-toolchain@v1
14+
with:
15+
toolchain: nightly
16+
- name: Install miri
17+
run: rustup component add miri
18+
- name: Cargo test
19+
run: cargo miri test

timely/src/dataflow/operators/core/capture/capture.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ pub trait Capture<T: Timestamp, C: Container + Data> {
7272
/// use timely::dataflow::operators::{Capture, ToStream, Inspect};
7373
/// use timely::dataflow::operators::capture::{EventReader, EventWriter, Replay, Extract};
7474
///
75+
/// # #[cfg(miri)] fn main() {}
76+
/// # #[cfg(not(miri))]
77+
/// # fn main() {
7578
/// // get send and recv endpoints, wrap send to share
7679
/// let (send0, recv0) = ::std::sync::mpsc::channel();
7780
/// let send0 = Arc::new(Mutex::new(send0));
@@ -102,6 +105,7 @@ pub trait Capture<T: Timestamp, C: Container + Data> {
102105
/// }).unwrap();
103106
///
104107
/// assert_eq!(recv0.extract()[0].1, (0..10).collect::<Vec<_>>());
108+
/// # }
105109
/// ```
106110
fn capture_into<P: EventPusher<T, C>+'static>(&self, pusher: P);
107111

timely/src/dataflow/operators/core/capture/event.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,13 @@ pub mod link {
116116

117117
#[test]
118118
fn avoid_stack_overflow_in_drop() {
119+
#[cfg(miri)]
120+
let limit = 1_000;
121+
#[cfg(not(miri))]
122+
let limit = 1_000_000;
119123
let mut event1 = Rc::new(EventLink::<(),()>::new());
120124
let _event2 = event1.clone();
121-
for _ in 0 .. 1_000_000 {
125+
for _ in 0 .. limit {
122126
event1.push(Event::Progress(vec![]));
123127
}
124128
}

timely/src/dataflow/operators/core/capture/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
//! use timely::dataflow::operators::{Capture, ToStream, Inspect};
2525
//! use timely::dataflow::operators::capture::{EventLink, Replay};
2626
//!
27+
//! # #[cfg(miri)] fn main() {}
28+
//! # #[cfg(not(miri))]
29+
//! # fn main() {
2730
//! timely::execute(timely::Config::thread(), |worker| {
2831
//! let handle1 = Rc::new(EventLink::new());
2932
//! let handle2 = Some(handle1.clone());
@@ -38,6 +41,7 @@
3841
//! .inspect(|x| println!("replayed: {:?}", x));
3942
//! })
4043
//! }).unwrap();
44+
//! # }
4145
//! ```
4246
//!
4347
//! The types `EventWriter<T, D, W>` and `EventReader<T, D, R>` can be
@@ -52,6 +56,9 @@
5256
//! use timely::dataflow::operators::{Capture, ToStream, Inspect};
5357
//! use timely::dataflow::operators::capture::{EventReader, EventWriter, Replay};
5458
//!
59+
//! # #[cfg(miri)] fn main() {}
60+
//! # #[cfg(not(miri))]
61+
//! # fn main() {
5562
//! timely::execute(timely::Config::thread(), |worker| {
5663
//! let list = TcpListener::bind("127.0.0.1:8000").unwrap();
5764
//! let send = TcpStream::connect("127.0.0.1:8000").unwrap();
@@ -71,6 +78,7 @@
7178
//! .inspect(|x| println!("replayed: {:?}", x));
7279
//! })
7380
//! }).unwrap();
81+
//! # }
7482
//! ```
7583
7684
pub use self::capture::Capture;

0 commit comments

Comments
 (0)