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 501069 7943fd2406300abe14a6aedbae8eb5c1d988443e
parent 501068 9ca3d0b3e93a8561ad1f18bcdace54e73f025ecc
child 501070 0b925d9a30ccb4e020f4dc8ef5a7d24e2b5dcbfa
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, test-only
bugs1503687
milestone64.0
Bug 1503687 - Avoid python attribute errors for some infrequent xpcshell timeouts. r=jmaher, a=test-only
testing/xpcshell/runxpcshelltests.py
--- 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:
             f.write(stdout)
 
     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: