testsuite: Print summary even if interrupted
authorBen Gamari <bgamari.foss@gmail.com>
Thu, 14 Jun 2018 09:33:35 +0000 (12:33 +0300)
committerÖmer Sinan Ağacan <omeragacan@gmail.com>
Thu, 14 Jun 2018 09:33:53 +0000 (12:33 +0300)
Fixes #15265.

Reviewers: osa1

Reviewed By: osa1

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15265

Differential Revision: https://phabricator.haskell.org/D4841

testsuite/driver/runtests.py

index 622e2ea..811a6e0 100644 (file)
@@ -308,21 +308,24 @@ else:
     watcher = Watcher(len(parallelTests))
 
     # Now run all the tests
-    for oneTest in parallelTests:
-        if stopping():
-            break
-        oneTest(watcher)
-
-    # wait for parallel tests to finish
-    if not stopping():
-        watcher.wait()
-
-    # Run the following tests purely sequential
-    config.use_threads = False
-    for oneTest in aloneTests:
-        if stopping():
-            break
-        oneTest(watcher)
+    try:
+        for oneTest in parallelTests:
+            if stopping():
+                break
+            oneTest(watcher)
+
+        # wait for parallel tests to finish
+        if not stopping():
+            watcher.wait()
+
+        # Run the following tests purely sequential
+        config.use_threads = False
+        for oneTest in aloneTests:
+            if stopping():
+                break
+            oneTest(watcher)
+    except KeyboardInterrupt:
+        pass
 
     # flush everything before we continue
     sys.stdout.flush()