diff options
| author | Scott Gasch <[email protected]> | 2022-06-03 17:12:38 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2022-06-03 17:12:38 -0700 |
| commit | bf6386e82fcc7f0be1b15891e56d60ed818926e2 (patch) | |
| tree | ec2955ea5ee1378035772e5949b39d4c00fa7e66 /tests | |
| parent | 7641e2ac7bf22ddfa0ef6c12b127e72dfbfb7f28 (diff) | |
Take a lock before reading cross thread.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/run_tests.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/run_tests.py b/tests/run_tests.py index c96f882..3e5ee07 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -141,6 +141,7 @@ class TestRunner(ABC, thread_utils.ThreadWithReturnValue): tests_timed_out=[], ) self.tests_started = 0 + self.lock = threading.Lock() @abstractmethod def get_name(self) -> str: @@ -149,7 +150,8 @@ class TestRunner(ABC, thread_utils.ThreadWithReturnValue): def get_status(self) -> Tuple[int, TestResults]: """Ask the TestRunner for its status.""" - return (self.tests_started, self.test_results) + with self.lock: + return (self.tests_started, self.test_results) @abstractmethod def begin(self, params: TestingParameters) -> TestResults: |
