Bug 781711 - Make mochitest manifests work properly with both runtests and excludetests, r=jmaher

This commit is contained in:
Jonathan Griffin 2012-08-10 09:44:50 -07:00
parent 9c483afff4
commit f7f07c0f74
2 changed files with 48 additions and 39 deletions

View File

@ -631,7 +631,7 @@ class Mochitest(object):
self.urlOpts.append("testname=%s" % ("/").join([self.TEST_PATH, options.testPath]))
if options.testManifest:
self.urlOpts.append("testManifest=%s" % options.testManifest)
if options.runOnly:
if hasattr(options, 'runOnly') and options.runOnly:
self.urlOpts.append("runOnly=true")
else:
self.urlOpts.append("runOnly=false")

View File

@ -199,8 +199,9 @@ function filterTests(filterFile, runOnly) {
var runtests = {};
var excludetests = {};
if (filterFile == null)
if (filterFile == null) {
return gTestList;
}
var datafile = "http://mochi.test:8888/" + filterFile;
var objXml = new XMLHttpRequest();
@ -224,48 +225,56 @@ function filterTests(filterFile, runOnly) {
} else
excludetests = filter;
}
//Filter out 'exclude tests' from gTestList
for (var i = 0; i < gTestList.length; ++i) {
var found = false;
var test_path = gTestList[i];
var tmp_path = test_path.replace(/^\//, '');
for (var f in excludetests) {
// Remove leading /tests/ if exists
file = f.replace(/^\//, '')
file = file.replace(/^tests\//, '')
// Match directory or filename, gTestList has tests/<path>
if (tmp_path.match("^tests/" + file) != null) {
found = true;
break;
}
}
if (!found)
removedTests.push(test_path);
}
if (JSON.stringify(runtests) == "{}") {
return removedTests;
}
// Start with gTestList, and put everything that's in 'runtests' in
// filteredTests.
if (Object.keys(runtests).length) {
for (var i = 0; i < gTestList.length; i++) {
var test_path = gTestList[i];
var tmp_path = test_path.replace(/^\//, '');
for (var f in runtests) {
// Remove leading /tests/ if exists
file = f.replace(/^\//, '')
file = file.replace(/^tests\//, '')
for (var i = 0; i < removedTests.length; ++i) {
var found = false;
var test_path = gTestList[i];
var tmp_path = test_path.replace(/^\//, '');
for (var f in runtests) {
// Remove leading /tests/ if exists
file = f.replace(/^\//, '')
file = file.replace(/^tests\//, '')
// Match directory or filename, gTestList has tests/<path>
if (tmp_path.match("^tests/" + file) != null) {
filteredTests.push(test_path);
found = true;
break;
// Match directory or filename, gTestList has tests/<path>
if (tmp_path.match("^tests/" + file) != null) {
filteredTests.push(test_path);
break;
}
}
}
}
else {
filteredTests = gTestList.slice(0);
}
// Continue with filteredTests, and deselect everything that's in
// excludedtests.
if (Object.keys(excludetests).length) {
var refilteredTests = [];
for (var i = 0; i < filteredTests.length; i++) {
var found = false;
var test_path = filteredTests[i];
var tmp_path = test_path.replace(/^\//, '');
for (var f in excludetests) {
// Remove leading /tests/ if exists
file = f.replace(/^\//, '')
file = file.replace(/^tests\//, '')
// Match directory or filename, gTestList has tests/<path>
if (tmp_path.match("^tests/" + file) != null) {
found = true;
break;
}
}
if (!found) {
refilteredTests.push(test_path);
}
}
filteredTests = refilteredTests;
}
return filteredTests;
}