Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide better debugging facilities for nondeterministic tests #184

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
path: fix panic from branch_spurious
  • Loading branch information
Bryan Donlan committed Oct 26, 2020
commit cf0efdb45f79234595017ab72502e82dce315e73
16 changes: 10 additions & 6 deletions src/rt/path.rs
Original file line number Diff line number Diff line change
@@ -202,10 +202,14 @@ impl Path {
/// Asserts that the current branching point matches the given trace. Should
/// be calling when processing pre-existing entries in `branches`.
fn check_trace(&mut self, trace: &Trace) {
let expected = self
.schedule_trace
.get(self.pos)
.expect("Trace record imbalance");
let expected = match self.schedule_trace.get(self.pos) {
Some(t) => t,
None => {
self.inconsistent = true;
self.trace_mismatch(Trace::opaque("{missing}"), trace);
return;
}
};

if expected != trace {
// drop the reference before making a call on mut self
@@ -315,12 +319,12 @@ impl Path {

/// Branch on spurious notifications
pub(super) fn branch_spurious(&mut self, trace: &Trace) -> bool {
self.check_trace(trace);

if self.is_traversed() {
assert_path_len!(self.branches);

self.push_new_schedule_trace(trace, Spurious(false));
} else {
self.check_trace(trace);
}

let spurious = object::Ref::from_usize(self.pos)