diff options
-rw-r--r-- | testsuite/driver/runtests.py | 3 | ||||
-rw-r--r-- | testsuite/driver/testglobals.py | 1 | ||||
-rw-r--r-- | testsuite/driver/testlib.py | 34 |
3 files changed, 13 insertions, 25 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 8a0524248b..02014e70f0 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -150,7 +150,6 @@ config.broken_tests |= {TestName(t) for t in args.broken_test} if args.threads: config.threads = args.threads - config.use_threads = True if args.verbose is not None: config.verbose = args.verbose @@ -497,7 +496,7 @@ else: watcher.wait() # Run the following tests purely sequential - config.use_threads = False + config.threads = 1 for oneTest in aloneTests: if stopping(): break diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index ea0b03b3c1..aadafbc25f 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -174,7 +174,6 @@ class TestConfig: # threads self.threads = 1 - self.use_threads = False # tests which should be considered to be broken during this testsuite # run. diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index ff245a6b04..c1434cfeb9 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -37,9 +37,8 @@ from threading import Timer from collections import OrderedDict global pool_sema -if config.use_threads: - import threading - pool_sema = threading.BoundedSemaphore(value=config.threads) +import threading +pool_sema = threading.BoundedSemaphore(value=config.threads) global wantToStop wantToStop = False @@ -84,12 +83,7 @@ def get_all_ways() -> Set[WayName]: # testdir_testopts after each test). global testopts_local -if config.use_threads: - testopts_local = threading.local() -else: - class TestOpts_Local: - pass - testopts_local = TestOpts_Local() # type: ignore +testopts_local = threading.local() def getTestOpts() -> TestOptions: return testopts_local.x @@ -1009,15 +1003,12 @@ aloneTests = [] allTestNames = set([]) # type: Set[TestName] def runTest(watcher, opts, name: TestName, func, args): - if config.use_threads: - pool_sema.acquire() - t = threading.Thread(target=test_common_thread, + pool_sema.acquire() + t = threading.Thread(target=test_common_thread, name=name, args=(watcher, name, opts, func, args)) - t.daemon = False - t.start() - else: - test_common_work(watcher, name, opts, func, args) + t.daemon = False + t.start() # name :: String # setup :: [TestOpt] -> IO () @@ -1062,12 +1053,11 @@ def test(name: TestName, parallelTests.append(thisTest) allTestNames.add(name) -if config.use_threads: - def test_common_thread(watcher, name, opts, func, args): - try: - test_common_work(watcher, name, opts, func, args) - finally: - pool_sema.release() +def test_common_thread(watcher, name, opts, func, args): + try: + test_common_work(watcher, name, opts, func, args) + finally: + pool_sema.release() def get_package_cache_timestamp() -> float: if config.package_conf_cache_file is None: |