Bug 1274395 - Delete pending crash reports before running tests; r=jmaher

This commit is contained in:
Geoff Brown 2016-05-25 14:48:42 -06:00
Родитель c7bf361fbb
Коммит dd65ba7f12
8 изменённых файлов: 55 добавлений и 0 удалений

Просмотреть файл

@ -217,6 +217,12 @@ class ReftestArgumentsParser(argparse.ArgumentParser):
default=None,
help=argparse.SUPPRESS)
self.add_argument("--cleanup-crashes",
action = "store_true",
dest = "cleanupCrashes",
default = False,
help = "Delete pending crash reports before running tests.")
self.add_argument("tests",
metavar="TEST_PATH",
nargs="*",

Просмотреть файл

@ -412,6 +412,9 @@ class RefTest(object):
self.killNamedOrphans('ssltunnel')
self.killNamedOrphans('xpcshell')
if options.cleanupCrashes:
mozcrash.cleanup_pending_crash_reports()
manifests = self.resolver.resolveManifests(options, tests)
if options.filter:
manifests[""] = options.filter

Просмотреть файл

@ -559,6 +559,13 @@ class MochitestArguments(ArgumentContainer):
"help": "Timeout while waiting to receive a message from the marionette server.",
"suppress": True,
}],
[["--cleanup-crashes"],
{"action": "store_true",
"dest": "cleanupCrashes",
"default": False,
"help": "Delete pending crash reports before running tests.",
"suppress": True,
}],
]
defaults = {

Просмотреть файл

@ -2206,6 +2206,9 @@ class MochitestDesktop(MochitestBase):
self.killNamedOrphans('ssltunnel')
self.killNamedOrphans('xpcshell')
if options.cleanupCrashes:
mozcrash.cleanup_pending_crash_reports()
# Until we have all green, this only runs on bc*/dt*/mochitest-chrome
# jobs, not jetpack*, a11yr (for perf reasons), or plain

Просмотреть файл

@ -7,6 +7,7 @@ __all__ = [
'check_for_java_exception',
'kill_and_get_minidump',
'log_crashes',
'cleanup_pending_crash_reports',
]
import glob
@ -491,6 +492,35 @@ def kill_and_get_minidump(pid, dump_directory, utility_path=None):
if needs_killing:
kill_pid(pid)
def cleanup_pending_crash_reports():
"""
Delete any pending crash reports.
The presence of pending crash reports may be reported by the browser,
affecting test results; it is best to ensure that these are removed
before starting any browser tests.
Firefox stores pending crash reports in "<UAppData>/Crash Reports".
If the browser is not running, it cannot provide <UAppData>, so this
code tries to anticipate its value.
See dom/system/OSFileConstants.cpp for platform variations of <UAppData>.
"""
if mozinfo.isWin:
location = os.path.expanduser("~\\AppData\\Roaming\\Mozilla\\Firefox\\Crash Reports")
elif mozinfo.isMac:
location = os.path.expanduser("~/Library/Application Support/firefox/Crash Reports")
else:
location = os.path.expanduser("~/.mozilla/firefox/Crash Reports")
logger = get_logger()
if os.path.exists(location):
try:
mozfile.remove(location)
logger.info("Removed pending crash reports at '%s'" % location)
except:
pass
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()

Просмотреть файл

@ -129,6 +129,7 @@ config = {
"--log-errorsummary=%(error_summary_file)s",
"--use-test-media-devices",
"--screenshot-on-fail",
"--cleanup-crashes",
],
"run_filename": "runtests.py",
"testsdir": "mochitest"
@ -159,6 +160,7 @@ config = {
"--symbols-path=%(symbols_path)s",
"--log-raw=%(raw_log_file)s",
"--log-errorsummary=%(error_summary_file)s",
"--cleanup-crashes",
],
"run_filename": "runreftest.py",
"testsdir": "reftest"

Просмотреть файл

@ -83,6 +83,7 @@ config = {
"--log-raw=%(raw_log_file)s",
"--log-errorsummary=%(error_summary_file)s",
"--screenshot-on-fail",
"--cleanup-crashes",
],
"run_filename": "runtests.py",
"testsdir": "mochitest"
@ -111,6 +112,7 @@ config = {
"--utility-path=tests/bin",
"--extra-profile-file=tests/bin/plugins",
"--symbols-path=%(symbols_path)s"
"--cleanup-crashes",
],
"run_filename": "runreftest.py",
"testsdir": "reftest"

Просмотреть файл

@ -94,6 +94,7 @@ config = {
"--log-raw=%(raw_log_file)s",
"--log-errorsummary=%(error_summary_file)s",
"--screenshot-on-fail",
"--cleanup-crashes",
],
"run_filename": "runtests.py",
"testsdir": "mochitest"
@ -124,6 +125,7 @@ config = {
"--symbols-path=%(symbols_path)s",
"--log-raw=%(raw_log_file)s",
"--log-errorsummary=%(error_summary_file)s",
"--cleanup-crashes",
],
"run_filename": "runreftest.py",
"testsdir": "reftest"