forked from OSchip/llvm-project
[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. llvm-svn: 375262
This commit is contained in:
parent
9a055dc191
commit
17bb660fb8
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue