Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions build/buildlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,20 @@ pub(crate) mod tests {
one.send(()).unwrap();
}

/// Alone in a process ([`rerun`]): a sibling test's fork holds every lock
/// description this process has locked until it execs, so a queue left
/// held by the first guest's dropped handle would read as the wide one
/// queued.
#[test]
fn a_narrow_guest_does_not_overtake_a_wide_one_waiting() {
let out = rerun("buildlock::tests::a_narrow_guest_behind_a_wide_one").output().expect("run the scenario alone");
let said = String::from_utf8_lossy(&out.stdout).into_owned() + &String::from_utf8_lossy(&out.stderr);
assert!(out.status.success() && said.contains("test result: ok. 1 passed"), "{said}");
}

#[test]
#[ignore = "the scenario of the test above, alone in its process; never runs on its own"]
fn a_narrow_guest_behind_a_wide_one() {
let store = scratch("guest-cpus-queue");
let (tx, done) = std::sync::mpsc::channel();
let first = guest(&store, 3, 4, "first", tx.clone());
Expand Down

This file was deleted.

This file was deleted.

12 changes: 7 additions & 5 deletions sdk/toyos/src/log/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,19 @@ fn a_lane_gives_its_reader_every_record_in_order_or_counts_it_refused() {
let mut reader = Reader::new();
let mut got = Vec::new();
let mut counted = 0;
loop {
let finished = writer.is_finished();
let mut read = || {
while let Some((_, seq)) = reader.next_lane(&*lane) {
got.push(seq);
}
counted += reader.refused(&*lane);
if finished {
break;
}
};
while !writer.is_finished() {
read();
}
// The join orders the writer's last push before the last read;
// `is_finished` orders nothing.
let refused = writer.join().unwrap() as u64;
read();
assert_eq!(counted, refused);
assert_eq!(got.len() as u64 + counted, EACH);
assert!(got.windows(2).all(|w| w[0] < w[1]), "a lane reordered its records");
Expand Down