diff options
author | Cheng Shao <terrorjack@type.dance> | 2023-02-06 12:08:34 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-02-08 18:42:16 -0500 |
commit | 633f2799e697ddaf63c4c91820c0b5a7c9b17db7 (patch) | |
tree | 77c2b7835fd3d09932dd08a58cc4d75bfe43a088 | |
parent | 7eac2468a726f217dd97c5e2884f6b552e8ef11d (diff) | |
download | haskell-633f2799e697ddaf63c4c91820c0b5a7c9b17db7.tar.gz |
testsuite: remove config.use_threads
This patch simplifies the testsuite driver by removing the use_threads
config field. It's just a degenerate case of threads=1.
-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 14bbdc96bc..d49ada96f4 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -151,7 +151,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 @@ -496,7 +495,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 8c52f7f148..62643f2acc 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -177,7 +177,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 46c7c45c93..10c0314afc 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 @@ -1021,15 +1015,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 () @@ -1074,12 +1065,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: |