Bug 1325197 - Add logging around mach python-test; r?gps
In
bug 1308472 we are seeing 'make -k check' fail intermittently with
the only apparent error message something like:
make: *** [check] Error 245
This debug should make it more clear which test (if any) is responsible
for setting the return code in 'mach python-test', and whether or not
'mach python-test' is actually reaching the end of the function.
MozReview-Commit-ID: 6IQrZQqs8ij
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -141,29 +141,32 @@ class MachCommands(MachCommandBase):
return_code = 0
with ThreadPoolExecutor(max_workers=self.jobs) as executor:
futures = [executor.submit(self._run_python_test, test['path'])
for test in tests]
try:
for future in as_completed(futures):
- output, ret = future.result()
+ output, ret, test_path = future.result()
for line in output:
self.log(logging.INFO, 'python-test', {'line': line.rstrip()}, '{line}')
+ if ret and not return_code:
+ self.log(logging.ERROR, 'python-test', {'test_path': test_path, 'ret': ret}, 'Setting retcode to {ret} from {test_path}')
return_code = return_code or ret
except KeyboardInterrupt:
# Hack to force stop currently running threads.
# https://gist.github.com/clchiou/f2608cbe54403edb0b13
executor._threads.clear()
thread._threads_queues.clear()
raise
+ self.log(logging.INFO, 'python-test', {'return_code': return_code}, 'Return code from mach python-test: {return_code}')
return return_code
def _run_python_test(self, test_path):
from mozprocess import ProcessHandler
output = []
def _log(line):
@@ -199,9 +202,9 @@ class MachCommands(MachCommandBase):
'call?): {}'.format(test_path))
if self.verbose:
if return_code != 0:
_log('Test failed: {}'.format(test_path))
else:
_log('Test passed: {}'.format(test_path))
- return output, return_code
+ return output, return_code, test_path
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -309,17 +309,19 @@ TEST_EXTENSIONS := \
stage-extensions: make-stage-dir
$(NSINSTALL) -D $(PKG_STAGE)/extensions/
@$(foreach ext,$(TEST_EXTENSIONS), cp -RL $(DIST)/xpi-stage/$(ext) $(PKG_STAGE)/extensions;)
check::
$(eval cores=$(shell $(PYTHON) -c 'import multiprocessing; print(multiprocessing.cpu_count())'))
+ @echo "Starting 'mach python-test' with -j$(cores)"
@$(topsrcdir)/mach --log-no-times python-test -j$(cores)
+ @echo "Finished 'mach python-test' successfully"
.PHONY: \
reftest \
crashtest \
xpcshell-tests \
jstestbrowser \
package-tests \