Bug 793855 - runxpcshelltests.py should catch shutil.rmtree(dirname) exceptions and output a TBPL-compatible error; r=gps
authorEd Morley <emorley@mozilla.com>
Sun, 07 Oct 2012 21:21:52 +0100
changeset 109577 db8552af8d73696e8cd058c1721018a169a5e979
parent 109576 9a685a97bfec20125e350d1d7d9b9c5a89106050
child 109578 454595726fd913c274f3a5125d8c32b5730bf523
push id23634
push userphilringnalda@gmail.com
push dateMon, 08 Oct 2012 01:32:21 +0000
treeherdermozilla-central@e6df45a28902 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs793855
milestone18.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 793855 - runxpcshelltests.py should catch shutil.rmtree(dirname) exceptions and output a TBPL-compatible error; r=gps
testing/xpcshell/runxpcshelltests.py
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -1,15 +1,15 @@
 #!/usr/bin/env python
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-import re, sys, os, os.path, logging, shutil, signal, math, time
+import re, sys, os, os.path, logging, shutil, signal, math, time, traceback
 import xml.dom.minidom
 from glob import glob
 from optparse import OptionParser
 from subprocess import Popen, PIPE, STDOUT
 from tempfile import mkdtemp, gettempdir
 import manifestparser
 import mozinfo
 import random
@@ -886,17 +886,31 @@ class XPCShellTests(object):
             "type": "TEST-UNEXPECTED-FAIL",
             "message": message,
             "text": stdout
           }
           self.kill(proc)
         # We don't want to delete the profile when running check-interactive
         # or check-one.
         if self.profileDir and not self.interactive and not self.singleFile:
-          self.removeDir(self.profileDir)
+          try:
+            self.removeDir(self.profileDir)
+          except Exception:
+            message = "TEST-UNEXPECTED-FAIL | %s | Failed to clean up the test profile directory: %s" % (name, sys.exc_info()[0])
+            self.log.error(message)
+            print_stdout(stdout)
+            print_stdout(traceback.format_exc())
+            self.failCount += 1
+            xunitResult["passed"] = False
+            xunitResult["failure"] = {
+              "type": "TEST-UNEXPECTED-FAIL",
+              "message": message,
+              "text": "%s\n%s" % (stdout, traceback.format_exc())
+            }
+
       if gotSIGINT:
         xunitResult["passed"] = False
         xunitResult["time"] = "0.0"
         xunitResult["failure"] = {
           "type": "SIGINT",
           "message": "Received SIGINT",
           "text": "Received SIGINT (control-C) during test execution."
         }