зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1197541 - Add --dump-tests option to mochitest and xpcshell for all tests that will be run. r=ahal
This commit is contained in:
Родитель
39ddf7f195
Коммит
7ec736a594
|
@ -323,6 +323,12 @@ class MochitestArguments(ArgumentContainer):
|
|||
"multiple test runs simulatenously on the same machine.",
|
||||
"suppress": True,
|
||||
}],
|
||||
[["--dump-tests"],
|
||||
{"dest": "dump_tests",
|
||||
"default": None,
|
||||
"help": "Specify path to a filename to dump all the tests that will be run",
|
||||
"suppress": True,
|
||||
}],
|
||||
[["--failure-file"],
|
||||
{"dest": "failureFile",
|
||||
"default": None,
|
||||
|
|
|
@ -1978,6 +1978,15 @@ class Mochitest(MochitestUtilsMixin):
|
|||
|
||||
paths.sort(path_sort)
|
||||
self._active_tests = paths
|
||||
if options.dump_tests:
|
||||
options.dump_tests = os.path.expanduser(options.dump_tests)
|
||||
assert os.path.exists(os.path.dirname(options.dump_tests))
|
||||
with open(options.dump_tests, 'w') as dumpFile:
|
||||
dumpFile.write(json.dumps({'active_tests': self._active_tests}))
|
||||
|
||||
self.log.info("Dumping active_tests to %s file." % options.dump_tests)
|
||||
sys.exit()
|
||||
|
||||
return self._active_tests
|
||||
|
||||
def logPreamble(self, tests):
|
||||
|
|
|
@ -66,7 +66,7 @@ class XPCShellRunner(MozbuildObject):
|
|||
debugger=None, debuggerArgs=None, debuggerInteractive=None,
|
||||
jsDebugger=False, jsDebuggerPort=None,
|
||||
rerun_failures=False, test_objects=None, verbose=False,
|
||||
log=None, test_tags=None,
|
||||
log=None, test_tags=None, dump_tests=None,
|
||||
# ignore parameters from other platforms' options
|
||||
**kwargs):
|
||||
"""Runs an individual xpcshell test."""
|
||||
|
@ -89,7 +89,7 @@ class XPCShellRunner(MozbuildObject):
|
|||
debuggerInteractive=debuggerInteractive,
|
||||
jsDebugger=jsDebugger, jsDebuggerPort=jsDebuggerPort,
|
||||
rerun_failures=rerun_failures,
|
||||
verbose=verbose, log=log, test_tags=test_tags)
|
||||
verbose=verbose, log=log, test_tags=test_tags, dump_tests=dump_tests)
|
||||
return
|
||||
elif test_paths:
|
||||
test_paths = [self._wrap_path_argument(p).relpath() for p in test_paths]
|
||||
|
@ -125,6 +125,7 @@ class XPCShellRunner(MozbuildObject):
|
|||
'verbose': verbose,
|
||||
'log': log,
|
||||
'test_tags': test_tags,
|
||||
'dump_tests': dump_tests,
|
||||
}
|
||||
|
||||
return self._run_xpcshell_harness(**args)
|
||||
|
@ -134,7 +135,8 @@ class XPCShellRunner(MozbuildObject):
|
|||
keep_going=False, sequential=False,
|
||||
debugger=None, debuggerArgs=None, debuggerInteractive=None,
|
||||
jsDebugger=False, jsDebuggerPort=None,
|
||||
rerun_failures=False, verbose=False, log=None, test_tags=None):
|
||||
rerun_failures=False, verbose=False, log=None, test_tags=None,
|
||||
dump_tests=None):
|
||||
|
||||
# Obtain a reference to the xpcshell test runner.
|
||||
import runxpcshelltests
|
||||
|
@ -173,6 +175,7 @@ class XPCShellRunner(MozbuildObject):
|
|||
'jsDebugger': jsDebugger,
|
||||
'jsDebuggerPort': jsDebuggerPort,
|
||||
'test_tags': test_tags,
|
||||
'dump_tests': dump_tests,
|
||||
'utility_path': self.bindir,
|
||||
}
|
||||
|
||||
|
@ -447,6 +450,8 @@ class MachCommands(MachCommandBase):
|
|||
help='Filter out tests that don\'t have the given tag. Can be used '
|
||||
'multiple times in which case the test must contain at least one '
|
||||
'of the given tags.')
|
||||
@CommandArgument('--dump-tests', default=None, type=str, dest='dump_tests',
|
||||
help='Specify path to a filename to dump all the tests that will be run')
|
||||
@CommandArgument('--devicemanager', default='adb', type=str,
|
||||
help='(Android) Type of devicemanager to use for communication: adb or sut')
|
||||
@CommandArgument('--ip', type=str, default=None,
|
||||
|
|
|
@ -837,6 +837,15 @@ class XPCShellTests(object):
|
|||
"combination of filters: {}".format(
|
||||
mp.fmt_filters()))
|
||||
|
||||
if self.dump_tests:
|
||||
self.dump_tests = os.path.expanduser(self.dump_tests)
|
||||
assert os.path.exists(os.path.dirname(self.dump_tests))
|
||||
with open(self.dump_tests, 'w') as dumpFile:
|
||||
dumpFile.write(json.dumps({'active_tests': self.alltests}))
|
||||
|
||||
self.log.info("Dumping active_tests to %s file." % self.dump_tests)
|
||||
sys.exit()
|
||||
|
||||
def setAbsPath(self):
|
||||
"""
|
||||
Set the absolute path for xpcshell, httpdjspath and xrepath.
|
||||
|
@ -1076,7 +1085,7 @@ class XPCShellTests(object):
|
|||
testsRootDir=None, testingModulesDir=None, pluginsPath=None,
|
||||
testClass=XPCShellTestThread, failureManifest=None,
|
||||
log=None, stream=None, jsDebugger=False, jsDebuggerPort=0,
|
||||
test_tags=None, utility_path=None, **otherOptions):
|
||||
test_tags=None, dump_tests=None, utility_path=None, **otherOptions):
|
||||
"""Run xpcshell tests.
|
||||
|
||||
|xpcshell|, is the xpcshell executable to use to run the tests.
|
||||
|
@ -1160,6 +1169,7 @@ class XPCShellTests(object):
|
|||
self.manifest = manifest
|
||||
self.testdirs = testdirs
|
||||
self.testPath = testPath
|
||||
self.dump_tests = dump_tests
|
||||
self.interactive = interactive
|
||||
self.verbose = verbose
|
||||
self.keepGoing = keepGoing
|
||||
|
@ -1473,6 +1483,9 @@ class XPCShellOptions(OptionParser):
|
|||
self.add_option("--logfiles",
|
||||
action="store_true", dest="logfiles", default=True,
|
||||
help="create log files (default, only used to override --no-logfiles)")
|
||||
self.add_option("--dump-tests",
|
||||
type="string", dest="dump_tests", default=None,
|
||||
help="Specify path to a filename to dump all the tests that will be run")
|
||||
self.add_option("--manifest",
|
||||
type="string", dest="manifest", default=None,
|
||||
help="Manifest of test directories to use")
|
||||
|
|
Загрузка…
Ссылка в новой задаче