Bug 1503687 - Avoid python attribute errors for some infrequent xpcshell timeouts; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Tue, 06 Nov 2018 15:33:47 -0700
changeset 444772 8352f46310c7ecb0f96f50e7dae9615c1a2c9aac
parent 444771 a5e9d42be7b3437129a0074da6f039e25f613ff1
child 444773 4c0b9a5d991c1bdfe5f4a754cab6044b8b360a0e
push id35002
push userncsoregi@mozilla.com
push dateWed, 07 Nov 2018 09:53:22 +0000
treeherdermozilla-central@070757a0160c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1503687
milestone65.0a1
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 1503687 - Avoid python attribute errors for some infrequent xpcshell timeouts; r=jmaher
testing/xpcshell/runxpcshelltests.py
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -222,17 +222,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
@@ -279,17 +281,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: