Skip to content

Commit

Permalink
Slightly better test logging
Browse files Browse the repository at this point in the history
  • Loading branch information
palfrey committed May 28, 2022
1 parent 7d0a637 commit 96457b8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions serial_test_test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ fn init() {

pub fn test_fn(count: usize) {
init();
println!("Start {}", count);
println!("(non-fs) Start {}", count);
LOCK.store(count, Ordering::Relaxed);
thread::sleep(Duration::from_millis(1000 * (count as u64)));
println!("End {}", count);
println!("(non-fs) End {}", count);
assert_eq!(LOCK.load(Ordering::Relaxed), count);
}

pub fn fs_test_fn(count: usize) {
init();
println!("Start {}", count);
println!("(fs) Start {}", count);
let mut pathbuf = env::temp_dir();
pathbuf.push("serial-test-test");
fs::write(pathbuf.as_path(), count.to_ne_bytes()).unwrap();
thread::sleep(Duration::from_millis(1000 * (count as u64)));
println!("End {}", count);
println!("(fs) End {}", count);

let loaded = fs::read(pathbuf.as_path())
.map(|bytes| usize::from_ne_bytes(bytes.as_slice().try_into().unwrap()))
Expand Down

0 comments on commit 96457b8

Please sign in to comment.