Bug 1503687 - Avoid python attribute errors for some infrequent xpcshell timeouts. r=jmaher, a=test-only
authorGeoff Brown <gbrown@mozilla.com>
Tue, 06 Nov 2018 15:33:47 -0700
changeset 498358 7943fd2406300abe14a6aedbae8eb5c1d988443e
parent 498357 9ca3d0b3e93a8561ad1f18bcdace54e73f025ecc
child 498359 0b925d9a30ccb4e020f4dc8ef5a7d24e2b5dcbfa
push id10125
push userryanvm@gmail.com
push dateWed, 07 Nov 2018 13:55:37 +0000
treeherdermozilla-beta@7943fd240630 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, test-only
Bug 1503687 - Avoid python attribute errors for some infrequent xpcshell timeouts. r=jmaher, a=test-only
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -220,17 +220,19 @@ class XPCShellTestThread(Thread):
         with open(test_file + ".log", "w") as f:
     def getReturnCode(self, proc):
           Simple wrapper to get the return code for a given process.
           On a remote system we overload this to work with the remote process management.
-        return proc.returncode
+        if proc is not None and hasattr(proc, "returncode"):
+            return proc.returncode
+        return -1
     def communicate(self, proc):
           Simple wrapper to communicate with a process.
           On a remote system, this is overloaded to handle remote process communication.
         # Processing of incremental output put here to
         # sidestep issues on remote platforms, where what we know
@@ -277,17 +279,20 @@ class XPCShellTestThread(Thread):
         self.log.info("%s | current directory: %r" % (name, testdir))
         # Show only those environment variables that are changed from
         # the ambient environment.
         changedEnv = (set("%s=%s" % i for i in self.env.iteritems())
                       - set("%s=%s" % i for i in os.environ.iteritems()))
         self.log.info("%s | environment: %s" % (name, list(changedEnv)))
     def killTimeout(self, proc):
-        mozcrash.kill_and_get_minidump(proc.pid, self.tempDir, utility_path=self.utility_path)
+        if proc is not None and hasattr(proc, "pid"):
+            mozcrash.kill_and_get_minidump(proc.pid, self.tempDir, utility_path=self.utility_path)
+        else:
+            self.log.info("not killing -- proc or pid unknown")
     def postCheck(self, proc):
         """Checks for a still-running test process, kills it and fails the test if found.
         We can sometimes get here before the process has terminated, which would
         cause removeDir() to fail - so check for the process and kill it if needed.
         if proc and self.poll(proc) is None:
             if HAVE_PSUTIL: