From 508eb1e0b24f2e7d97aa197350d88e05f4da736c Mon Sep 17 00:00:00 2001 From: Julian Lettner Date: Fri, 18 Oct 2019 17:31:45 +0000 Subject: [PATCH] [lit] Only send back test result from worker process Avoid sending back the whole run.Test object (which needs to be pickled) from the worker process when we are only interested in the test result. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375262 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/lit/lit/LitTestCase.py | 3 +-- utils/lit/lit/run.py | 16 ++++++++-------- utils/lit/lit/worker.py | 12 ++++++------ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/utils/lit/lit/LitTestCase.py b/utils/lit/lit/LitTestCase.py index 8259c7ad94e..c49831323b1 100644 --- a/utils/lit/lit/LitTestCase.py +++ b/utils/lit/lit/LitTestCase.py @@ -27,10 +27,9 @@ class LitTestCase(unittest.TestCase): def runTest(self): # Run the test. - lit.worker._execute_test(self._test, self._lit_config) + result = lit.worker._execute_test(self._test, self._lit_config) # Adapt the result to unittest. - result = self._test.result if result.code is lit.Test.UNRESOLVED: raise UnresolvedError(result.output) elif result.code.isFailure: diff --git a/utils/lit/lit/run.py b/utils/lit/lit/run.py index 3208db75615..c178128c93b 100644 --- a/utils/lit/lit/run.py +++ b/utils/lit/lit/run.py @@ -79,17 +79,17 @@ class Run(object): if self.hit_max_failures: return - (test_index, test_with_result) = pool_result + (test_index, result) = pool_result + test = self.tests[test_index] # Update the parent process copy of the test. This includes the result, # XFAILS, REQUIRES, and UNSUPPORTED statuses. - assert self.tests[test_index].file_path == test_with_result.file_path, \ - "parent and child disagree on test path" - self.tests[test_index] = test_with_result - self.progress_callback(test_with_result) + test.setResult(result) + + self.progress_callback(test) # If we've finished all the tests or too many tests have failed, notify # the main thread that we've stopped testing. - self.failure_count += (test_with_result.result.code == lit.Test.FAIL) + self.failure_count += (result.code == lit.Test.FAIL) if self.lit_config.maxFailures and \ self.failure_count == self.lit_config.maxFailures: self.hit_max_failures = True @@ -101,8 +101,8 @@ class SerialRun(Run): def _execute(self, deadline): # TODO(yln): ignores deadline for test_index, test in enumerate(self.tests): - lit.worker._execute_test(test, self.lit_config) - self._consume_test_result((test_index, test)) + result = lit.worker._execute_test(test, self.lit_config) + self._consume_test_result((test_index, result)) if self.hit_max_failures: break diff --git a/utils/lit/lit/worker.py b/utils/lit/lit/worker.py index a4e77be9d73..283d129bd22 100644 --- a/utils/lit/lit/worker.py +++ b/utils/lit/lit/worker.py @@ -31,9 +31,9 @@ def run_one_test(test_index, test): the display. """ try: - _execute_test_in_parallelism_group(test, _lit_config, - _parallelism_semaphores) - return (test_index, test) + result = _execute_test_in_parallelism_group(test, _lit_config, + _parallelism_semaphores) + return (test_index, result) except KeyboardInterrupt: # If a worker process gets an interrupt, abort it immediately. lit.util.abort_now() @@ -50,11 +50,11 @@ def _execute_test_in_parallelism_group(test, lit_config, parallelism_semaphores) semaphore = parallelism_semaphores[pg] try: semaphore.acquire() - _execute_test(test, lit_config) + return _execute_test(test, lit_config) finally: semaphore.release() else: - _execute_test(test, lit_config) + return _execute_test(test, lit_config) def _execute_test(test, lit_config): @@ -66,7 +66,7 @@ def _execute_test(test, lit_config): result.elapsed = end - start resolve_result_code(result, test) - test.setResult(result) + return result # TODO(yln): is this the right place to deal with this? -- 2.11.4.GIT