diff options
-rw-r--r-- | testsuite/driver/runtests.py | 4 | ||||
-rw-r--r-- | testsuite/driver/testlib.py | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 66e3bf4d5e..f6581db8b3 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -261,6 +261,8 @@ for file in t_files: if config.use_threads: t.running_threads=0 for oneTest in parallelTests: + if stopping(): + break oneTest() if config.use_threads: t.thread_pool.acquire() @@ -269,6 +271,8 @@ if config.use_threads: t.thread_pool.release() config.use_threads = False for oneTest in aloneTests: + if stopping(): + break oneTest() summary(t, sys.stdout) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 40ecf86d67..9f1f759642 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -32,6 +32,14 @@ if config.use_threads: import threading import thread +global wantToStop +wantToStop = False +def stopNow(): + global wantToStop + wantToStop = True +def stopping(): + return wantToStop + # Options valid for all the tests in the current "directory". After # each test, we reset the options to these. To change the options for # multiple tests, the function setTestOpts() below can be used to alter @@ -726,6 +734,8 @@ def test_common_work (name, opts, func, args): if not config.clean_only: # Run the required tests... for way in do_ways: + if stopping(): + break do_test (name, way, func, args) for way in all_ways: @@ -888,7 +898,7 @@ def do_test(name, way, func, args): else: framework_fail(name, way, 'bad result ' + passFail) except KeyboardInterrupt: - raise + stopNow() except: framework_fail(name, way, 'do_test exception') traceback.print_exc() @@ -2249,6 +2259,9 @@ def summary(t, file): if config.check_files_written: checkForFilesWrittenProblems(file) + if stopping(): + file.write('WARNING: Testsuite run was terminated early\n') + def printPassingTestInfosSummary(file, testInfos): directories = testInfos.keys() directories.sort() |