diff options
author | Cheng Shao <terrorjack@type.dance> | 2023-02-06 13:24:50 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-02-08 18:42:16 -0500 |
commit | ca6673e3cab496bbeed2ced47b40bcf1e0d0b3cd (patch) | |
tree | ad8ef55b3889d0df1fd452c7e7dad7e700f23786 /testsuite/driver/testutil.py | |
parent | 633f2799e697ddaf63c4c91820c0b5a7c9b17db7 (diff) | |
download | haskell-ca6673e3cab496bbeed2ced47b40bcf1e0d0b3cd.tar.gz |
testsuite: use concurrent.futures.ThreadPoolExecutor in the driver
The testsuite driver used to create one thread per test case, and
explicitly use semaphore and locks for rate limiting and
synchronization. This is a bad practice in any language, and
occasionally may result in livelock conditions (e.g. #22889). This
patch uses concurrent.futures.ThreadPoolExecutor for scheduling test
case runs, which is simpler and more robust.
Diffstat (limited to 'testsuite/driver/testutil.py')
-rw-r--r-- | testsuite/driver/testutil.py | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py index e7b6bf2948..f2c63c5a2d 100644 --- a/testsuite/driver/testutil.py +++ b/testsuite/driver/testutil.py @@ -5,8 +5,6 @@ import tempfile from pathlib import Path, PurePath from term_color import Color, colored -import threading - from my_typing import * @@ -125,24 +123,6 @@ else: else: os.symlink(str(src), str(dst)) -class Watcher(object): - def __init__(self, count: int) -> None: - self.pool = count - self.evt = threading.Event() - self.sync_lock = threading.Lock() - if count <= 0: - self.evt.set() - - def wait(self): - self.evt.wait() - - def notify(self): - self.sync_lock.acquire() - self.pool -= 1 - if self.pool <= 0: - self.evt.set() - self.sync_lock.release() - def memoize(f): """ A decorator to memoize a nullary function. |