From 49be9d8ab7823b25263c0494778e84c1014cb7b2 Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Fri, 10 Mar 2023 11:04:05 +0100 Subject: [PATCH] Add assertion that picked thread is runnable `Path::branch_thread` only picks threads the execution plan considers runnable. Thus, when this assertion fails, it is an indication that the model of execution paths diverged from the actual execution. --- src/rt/execution.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rt/execution.rs b/src/rt/execution.rs index dd9c28fd..85a166b8 100644 --- a/src/rt/execution.rs +++ b/src/rt/execution.rs @@ -202,6 +202,12 @@ impl Execution { } }) }); + if let Some(next) = next { + assert!( + self.threads[next].is_runnable() || self.threads[next].is_yield(), + "Picked a thread for execution that is not actually runnable", + ); + } let switched = Some(self.threads.active_id()) != next;