improve parallel cycle tests

Before we could not observe the case where:

* thread A is blocked on B
* cycle detected in thread B
* some participants are on thread A and have to be marked

(In particular, I commented out some code that seemed necessary and
didn't see any tests fail)
This commit is contained in:
Niko Matsakis 2021-10-27 06:21:09 -04:00
parent 187bd54fa9
commit 79f8acc3aa
2 changed files with 86 additions and 48 deletions

View file

@ -27,23 +27,21 @@ pub(crate) trait ParDatabase: Knobs {
/// Invokes `sum2_drop_sum`
fn sum3_drop_sum(&self, key: &'static str) -> usize;
// Cycle tests:
//
// A ───────► B
//
// ▲ │
// └──────────┘
// if key > 0
// && should_cycle
#[salsa::cycle(crate::cycles::recover_from_cycle_a1)]
#[salsa::invoke(crate::cycles::recover_cycle_a1)]
fn recover_cycle_a1(&self, key: i32) -> i32;
#[salsa::input]
fn should_cycle(&self) -> bool;
#[salsa::cycle(crate::cycles::recover_cycle)]
#[salsa::invoke(crate::cycles::recover_cycle_a)]
fn recover_cycle_a(&self, key: i32) -> i32;
#[salsa::cycle(crate::cycles::recover_cycle)]
#[salsa::invoke(crate::cycles::recover_cycle_b)]
fn recover_cycle_b(&self, key: i32) -> i32;
#[salsa::cycle(crate::cycles::recover_from_cycle_a2)]
#[salsa::invoke(crate::cycles::recover_cycle_a2)]
fn recover_cycle_a2(&self, key: i32) -> i32;
#[salsa::cycle(crate::cycles::recover_from_cycle_b1)]
#[salsa::invoke(crate::cycles::recover_cycle_b1)]
fn recover_cycle_b1(&self, key: i32) -> i32;
#[salsa::cycle(crate::cycles::recover_from_cycle_b2)]
#[salsa::invoke(crate::cycles::recover_cycle_b2)]
fn recover_cycle_b2(&self, key: i32) -> i32;
#[salsa::invoke(crate::cycles::panic_cycle_a)]
fn panic_cycle_a(&self, key: i32) -> i32;