changeset 21320:e5eed8ded168

run-tests: handle interrupted in Test.run()
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 19 Apr 2014 20:27:18 -0700
parents 44c96e2bab20
children d06b09dc80a5
files tests/run-tests.py
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sat Apr 19 20:22:32 2014 -0700
+++ b/tests/run-tests.py	Sat Apr 19 20:27:18 2014 -0700
@@ -551,7 +551,8 @@
     runs cannot be run concurrently.
     """
 
-    def __init__(self, path, options, count, refpath):
+    def __init__(self, test, path, options, count, refpath):
+        self._test = test
         self._path = path
         self._options = options
         self._count = count
@@ -598,7 +599,9 @@
             result.out = out
         except KeyboardInterrupt:
             updateduration()
-            result.interrupted = True
+            log('INTERRUPTED: %s (after %d seconds)' % (self._test,
+                                                        result.duration))
+            raise
         except Exception, e:
             updateduration()
             result.exception = e
@@ -673,7 +676,6 @@
         self.ret = None
         self.out = None
         self.duration = None
-        self.interrupted = False
         self.exception = None
         self.refout = None
 
@@ -1091,15 +1093,11 @@
     if os.path.exists(err):
         os.remove(err)       # Remove any previous output files
 
-    t = runner(testpath, options, count, ref)
+    t = runner(test, testpath, options, count, ref)
     res = TestResult()
     t.run(res)
     t.cleanup()
 
-    if res.interrupted:
-        log('INTERRUPTED: %s (after %d seconds)' % (test, res.duration))
-        raise KeyboardInterrupt()
-
     if res.exception:
         return fail('Exception during execution: %s' % res.exception, 255)