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):
|
def runTest(self):
|
||||||
# Run the test.
|
# 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.
|
# Adapt the result to unittest.
|
||||||
result = self._test.result
|
|
||||||
if result.code is lit.Test.UNRESOLVED:
|
if result.code is lit.Test.UNRESOLVED:
|
||||||
raise UnresolvedError(result.output)
|
raise UnresolvedError(result.output)
|
||||||
elif result.code.isFailure:
|
elif result.code.isFailure:
|
||||||
|
|
|
@ -79,17 +79,17 @@ class Run(object):
|
||||||
if self.hit_max_failures:
|
if self.hit_max_failures:
|
||||||
return
|
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,
|
# Update the parent process copy of the test. This includes the result,
|
||||||
# XFAILS, REQUIRES, and UNSUPPORTED statuses.
|
# XFAILS, REQUIRES, and UNSUPPORTED statuses.
|
||||||
assert self.tests[test_index].file_path == test_with_result.file_path, \
|
test.setResult(result)
|
||||||
"parent and child disagree on test path"
|
|
||||||
self.tests[test_index] = test_with_result
|
self.progress_callback(test)
|
||||||
self.progress_callback(test_with_result)
|
|
||||||
|
|
||||||
# If we've finished all the tests or too many tests have failed, notify
|
# If we've finished all the tests or too many tests have failed, notify
|
||||||
# the main thread that we've stopped testing.
|
# 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 \
|
if self.lit_config.maxFailures and \
|
||||||
self.failure_count == self.lit_config.maxFailures:
|
self.failure_count == self.lit_config.maxFailures:
|
||||||
self.hit_max_failures = True
|
self.hit_max_failures = True
|
||||||
|
@ -101,8 +101,8 @@ class SerialRun(Run):
|
||||||
def _execute(self, deadline):
|
def _execute(self, deadline):
|
||||||
# TODO(yln): ignores deadline
|
# TODO(yln): ignores deadline
|
||||||
for test_index, test in enumerate(self.tests):
|
for test_index, test in enumerate(self.tests):
|
||||||
lit.worker._execute_test(test, self.lit_config)
|
result = lit.worker._execute_test(test, self.lit_config)
|
||||||
self._consume_test_result((test_index, test))
|
self._consume_test_result((test_index, result))
|
||||||
if self.hit_max_failures:
|
if self.hit_max_failures:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,9 @@ def run_one_test(test_index, test):
|
||||||
the display.
|
the display.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
_execute_test_in_parallelism_group(test, _lit_config,
|
result = _execute_test_in_parallelism_group(test, _lit_config,
|
||||||
_parallelism_semaphores)
|
_parallelism_semaphores)
|
||||||
return (test_index, test)
|
return (test_index, result)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
# If a worker process gets an interrupt, abort it immediately.
|
# If a worker process gets an interrupt, abort it immediately.
|
||||||
lit.util.abort_now()
|
lit.util.abort_now()
|
||||||
|
@ -50,11 +50,11 @@ def _execute_test_in_parallelism_group(test, lit_config, parallelism_semaphores)
|
||||||
semaphore = parallelism_semaphores[pg]
|
semaphore = parallelism_semaphores[pg]
|
||||||
try:
|
try:
|
||||||
semaphore.acquire()
|
semaphore.acquire()
|
||||||
_execute_test(test, lit_config)
|
return _execute_test(test, lit_config)
|
||||||
finally:
|
finally:
|
||||||
semaphore.release()
|
semaphore.release()
|
||||||
else:
|
else:
|
||||||
_execute_test(test, lit_config)
|
return _execute_test(test, lit_config)
|
||||||
|
|
||||||
|
|
||||||
def _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
|
result.elapsed = end - start
|
||||||
resolve_result_code(result, test)
|
resolve_result_code(result, test)
|
||||||
|
|
||||||
test.setResult(result)
|
return result
|
||||||
|
|
||||||
|
|
||||||
# TODO(yln): is this the right place to deal with this?
|
# TODO(yln): is this the right place to deal with this?
|
||||||
|
|
Loading…
Reference in New Issue