diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-04-20 19:44:11 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-04-20 19:44:11 -0700 |
commit | 6abdff2707bbe9d7df8b8d7eb08bb3c4ea75ab59 (patch) | |
tree | 4d04b2c72a6deb7cea1cd72d21f19c26912e8685 | |
parent | fb1fcbc99e0383c9d5ac45eb75bb8fc76ea8a62c (diff) | |
download | mu-6abdff2707bbe9d7df8b8d7eb08bb3c4ea75ab59.tar.gz |
2848
Turns out one of my chessboard tests has been silently deadlocking and therefore not actually checking its results since at least commit 1620 last June.
-rw-r--r-- | 050scenario.cc | 1 | ||||
-rw-r--r-- | 062scheduler.cc | 43 |
2 files changed, 42 insertions, 2 deletions
diff --git a/050scenario.cc b/050scenario.cc index ea376179..ef0ef4ff 100644 --- a/050scenario.cc +++ b/050scenario.cc @@ -154,6 +154,7 @@ void run_mu_scenario(const scenario& s) { Passed = false; ++Num_failures; } + // End Mu Test Teardown if (not_already_inside_test && Trace_stream) { teardown(); ofstream fout((Trace_dir+Trace_file).c_str()); diff --git a/062scheduler.cc b/062scheduler.cc index c2438b03..00e6c58a 100644 --- a/062scheduler.cc +++ b/062scheduler.cc @@ -72,9 +72,8 @@ void run(routine* rr) { bool all_routines_done() { for (int i = 0; i < SIZE(Routines); ++i) { - if (Routines.at(i)->state == RUNNING) { + if (Routines.at(i)->state == RUNNING) return false; - } } return true; } @@ -474,6 +473,46 @@ if (Current_routine->limit >= 0) { } } +:(before "End Test Teardown") +if (Passed && any_routines_with_error()) { + Passed = false; + raise << "some routines died with errors\n" << end(); + ++Num_failures; +} +if (Passed && any_routines_waiting()) { + Passed = false; + raise << "deadlock!\n" << end(); + ++Num_failures; +} +:(before "End Mu Test Teardown") +if (Passed && any_routines_with_error()) { + Passed = false; + raise << Current_scenario->name << ": some routines died with errors\n" << end(); + ++Num_failures; +} +if (Passed && any_routines_waiting()) { + Passed = false; + raise << Current_scenario->name << ": deadlock!\n" << end(); + ++Num_failures; +} + +:(code) +bool any_routines_with_error() { + for (int i = 0; i < SIZE(Routines); ++i) { + if (Routines.at(i)->state == DISCONTINUED) + return true; + } + return false; +} + +bool any_routines_waiting() { + for (int i = 0; i < SIZE(Routines); ++i) { + if (Routines.at(i)->state == WAITING) + return true; + } + return false; +} + :(before "End routine Fields") int limit; :(before "End routine Constructor") |