about summary refs log tree commit diff stats
path: root/062scheduler.cc
diff options
context:
space:
mode:
Diffstat (limited to '062scheduler.cc')
-rw-r--r--062scheduler.cc43
1 files changed, 41 insertions, 2 deletions
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")