diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py index 3131202ed65..897cedcec5d 100644 --- a/testing/xpcshell/runxpcshelltests.py +++ b/testing/xpcshell/runxpcshelltests.py @@ -898,75 +898,27 @@ class XPCShellTests(object): 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()[1]) - self.log.error(message) - print_stdout(stdout) - print_stdout(traceback.format_exc()) + self.log.info("TEST-INFO | Failed to remove profile directory. Waiting.") + + # We suspect the filesystem may still be making changes. Wait a + # little bit and try again. + time.sleep(5) - # What follows is code to dump the directory listing similar to ls. - # This should only be needed until we track down the source of - # failures on the buildbot machines. try: - import pwd - import grp - except ImportError: - pwd = None - grp = None + self.removeDir(self.profileDir) + except Exception: + message = "TEST-UNEXPECTED-FAIL | %s | Failed to clean up the test profile directory: %s" % (name, sys.exc_info()[1]) + self.log.error(message) + print_stdout(stdout) + print_stdout(traceback.format_exc()) - def get_username(uid): - if pwd is None: - return None - - try: - return pwd.getpwuid(uid).pw_name - except KeyError: - return '%d missing' % uid - - def get_groupname(gid): - if grp is None: - return None - - try: - return grp.getgrgid(gid).gr_name - except KeyError: - return '%d missing' % gid - - self.log.info('Files in profile directory:') - def on_error(error): - self.log.info('OS Error while performing os.walk!') - self.log.info(traceback.format_exc()) - - for d, dirs, files in os.walk(self.profileDir, onerror=on_error): - try: - d_stat = os.stat(d) - except Exception: - self.log.info('Could not stat directory %s' % d) - self.log.info(traceback.format_exc()) - else: - self.log.info('%o %s %s %s/' % (d_stat.st_mode, - get_username(d_stat.st_uid), - get_groupname(d_stat.st_gid), d)) - - for f in files: - path = os.path.join(d, f) - - try: - f_stat = os.stat(path) - except Exception: - self.log.info('Could not stat file %s' % path) - self.log.info(traceback.format_exc()) - else: - self.log.info('%o %s %s %s' % (f_stat.st_mode, - get_username(f_stat.st_uid), - get_groupname(f_stat.st_gid), path)) - - self.failCount += 1 - xunitResult["passed"] = False - xunitResult["failure"] = { - "type": "TEST-UNEXPECTED-FAIL", - "message": message, - "text": "%s\n%s" % (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