Bug 1110940 - mochitest - support configurable tests.json manifest file name, r=jmaher.

This commit is contained in:
Bob Clary 2014-12-14 18:18:39 -08:00
Родитель 4fee9d910f
Коммит cf6709f516
2 изменённых файлов: 17 добавлений и 7 удалений

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

@ -311,6 +311,13 @@ class MochitestOptions(optparse.OptionParser):
"help": ".ini format of tests to run.",
"default": None,
}],
[["--testrun-manifest-file"],
{ "action": "store",
"type": "string",
"dest": "testRunManifestFile",
"help": "Overrides the default filename of the tests.json manifest file that is created from the manifest and used by the test runners to run the tests. Only useful when running multiple test runs simulatenously on the same machine.",
"default": 'tests.json',
}],
[["--failure-file"],
{ "action": "store",
"type": "string",

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

@ -671,9 +671,9 @@ class MochitestUtilsMixin(object):
paths.append(test)
# Bug 883865 - add this functionality into manifestparser
with open(os.path.join(SCRIPT_DIR, 'tests.json'), 'w') as manifestFile:
with open(os.path.join(SCRIPT_DIR, options.testRunManifestFile), 'w') as manifestFile:
manifestFile.write(json.dumps({'tests': paths}))
options.manifestFile = 'tests.json'
options.manifestFile = options.testRunManifestFile
return self.buildTestURL(options)
@ -1315,9 +1315,10 @@ class Mochitest(MochitestUtilsMixin):
def cleanup(self, options):
""" remove temporary files and profile """
if self.manifest is not None:
if hasattr(self, 'manifest') and self.manifest is not None:
os.remove(self.manifest)
del self.profile
if hasattr(self, 'profile'):
del self.profile
if options.pidFile != "":
try:
os.remove(options.pidFile)
@ -1822,8 +1823,8 @@ class Mochitest(MochitestUtilsMixin):
testURL = self.buildTestPath(options, testsToFilter)
# read the number of tests here, if we are not going to run any, terminate early
if os.path.exists(os.path.join(SCRIPT_DIR, 'tests.json')):
with open(os.path.join(SCRIPT_DIR, 'tests.json')) as fHandle:
if os.path.exists(os.path.join(SCRIPT_DIR, options.testRunManifestFile)):
with open(os.path.join(SCRIPT_DIR, options.testRunManifestFile)) as fHandle:
tests = json.load(fHandle)
count = 0
for test in tests['tests']:
@ -2119,7 +2120,7 @@ class Mochitest(MochitestUtilsMixin):
def getTestManifest(self, options):
if isinstance(options.manifestFile, TestManifest):
manifest = options.manifestFile
manifest = options.manifestFile
elif options.manifestFile and os.path.isfile(options.manifestFile):
manifestFileAbs = os.path.abspath(options.manifestFile)
assert manifestFileAbs.startswith(SCRIPT_DIR)
@ -2134,6 +2135,8 @@ class Mochitest(MochitestUtilsMixin):
if os.path.exists(masterPath):
manifest = TestManifest([masterPath], strict=False)
else:
self._log.warning('TestManifest masterPath %s does not exist' % masterPath)
return manifest