зеркало из https://github.com/mozilla/gecko-dev.git
Bug 809071 - Sleep after failure to delete profile directory; r=ted
This should hopefully solve the problem of IOError when deleting profile directories. This also cleans up the temporary code added in bug 799532.
This commit is contained in:
Родитель
4fa1c84fdb
Коммит
4979b172d8
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче