harness: Added per-machine test timeout.
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Tue, 9 Dec 2014 12:56:32 +0000 (13:56 +0100)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Tue, 9 Dec 2014 12:56:32 +0000 (13:56 +0100)
tools/harness/machines/qemu.py
tools/harness/tests/common.py

index 2b159be..d56a7c5 100644 (file)
@@ -142,6 +142,11 @@ class QEMUMachineMultiproc(QEMUMachineX64):
         # 4core qemu needs a bit longer to boot
         return 240
 
+    def get_test_timeout(self):
+        # give gem5 tests enough time to complete
+        # 20 mins
+        return 10 * 60
+
     def get_ncores(self):
         return 4
 
index c28046b..1225394 100644 (file)
@@ -215,27 +215,33 @@ class InteractiveTest(TestCommon):
 
     def wait_for_fish(self):
         debug.verbose("Waiting for fish.")
-        self.console.expect("fish v0.2 -- pleased to meet you!")
+        self.console.expect("fish v0.2 -- pleased to meet you!",
+                timeout=self.test_timeout)
         self.wait_for_prompt()
 
     def interact(self):
         # Implement interaction with console
         pass
 
+    def set_timeouts(self, machine):
+        self.boot_timeout = machine.get_boot_timeout()
+        if not self.boot_timeout:
+            self.boot_timeout = DEFAULT_BOOT_TIMEOUT.seconds
+        self.test_timeout = machine.get_test_timeout()
+        if not self.test_timeout:
+            self.test_timeout = DEFAULT_TEST_TIMEOUT.seconds
+
     def collect_data(self, machine):
         fh = machine.get_output()
-        
-        if not machine.get_boot_timeout():
-            tt = 180
-        else:
-            tt = machine.get_boot_timeout()
 
-        self.console = fdpexpect.fdspawn(fh, timeout=tt)
+
+        self.console = fdpexpect.fdspawn(fh)
         self.console.logfile = tempfile.NamedTemporaryFile()
 
         while self.boot_attempts < MAX_BOOT_ATTEMPTS:
             index = self.console.expect(["Barrelfish CPU driver starting", 
-                                 pexpect.TIMEOUT, pexpect.EOF])
+                                 pexpect.TIMEOUT, pexpect.EOF],
+                                 timeout=self.boot_timeout)
             if index == 0:
                 self.boot_phase = False
                 break
@@ -259,6 +265,7 @@ class InteractiveTest(TestCommon):
 
     def run(self, build, machine, testdir):
         modules = self.get_modules(build, machine)
+        self.set_timeouts(machine)
         self.boot(machine, modules)
         return self.collect_data(machine)