Bug 1325197 - Add logging around mach python-test; r=gps
authorMike Shal <mshal@mozilla.com>
Wed, 21 Dec 2016 11:12:55 -0500
changeset 327411 de38be7ff5bf0e2a18cb68acfd4b8c63e3c04390
parent 327410 cf567de3d61404d42cfa5e21765a3b9027576d3d
child 327412 9adbefe23a9587ff14d9d5c9915fa4568fa0850f
push id31131
push userkwierso@gmail.com
push dateThu, 29 Dec 2016 00:00:38 +0000
treeherdermozilla-central@b882b98ee9dd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1325197, 1308472
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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]
                 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
+        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))
                 _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;)
 	$(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 \