-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshuttle_test.rs
34 lines (30 loc) · 935 Bytes
/
shuttle_test.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#![cfg(feature = "shuttle")]
mod common;
use common::concurrency_test;
use kcas::ArcStateWrapper;
use shuttle::scheduler::RandomScheduler;
use shuttle::{Config, PortfolioRunner};
use std::fs::File;
use std::io::Read;
use test_log::test;
#[test]
fn two_thread_shuttle_test() {
let mut portfolio_runner = PortfolioRunner::new(true, Config::new());
for i in 0..32 {
portfolio_runner.add(RandomScheduler::new(10000usize));
}
portfolio_runner.run(|| {
common::concurrency_test::<2, 3>();
});
}
fn replay_test<const NUM_THREADS: usize, const NUM_WORDS: usize>(path_to_failing_iteration: &str) {
let mut file: File = File::open(path_to_failing_iteration).unwrap();
let mut replay_string: String = String::new();
file.read_to_string(&mut replay_string);
shuttle::replay(
|| {
concurrency_test::<NUM_THREADS, NUM_WORDS>();
},
&*replay_string,
);
}