Backout 1ff1bb2115c0 (bug 778383), d6fc07492b92 (bug 777589) for bustage

This commit is contained in:
Ed Morley 2012-07-31 17:44:07 +01:00
Родитель 92eab1c482
Коммит a552c935ce
3 изменённых файлов: 71 добавлений и 47 удалений

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

@ -99,9 +99,14 @@ function test2()
test file and assumes the path to the test case
is a subdirectory of the directory containing jsDriver.pl
*/
var expectedLine = 109;
var expectedLine = 114;
var expectedFileName = 'js1_5/extensions/regress-50447-1.js';
if (typeof document != "undefined") {
if (typeof document == "undefined")
{
expectedFileName = './' + expectedFileName;
}
else
{
expectedFileName = document.location.href.
replace(/[^\/]*(\?.*)$/, '') +
expectedFileName;
@ -132,7 +137,12 @@ function test3()
enterFunc ("test3");
var expectedFileName = 'js1_5/extensions/regress-50447-1.js';
if (typeof document != "undefined") {
if (typeof document == "undefined")
{
expectedFileName = './' + expectedFileName;
}
else
{
expectedFileName = document.location.href.
replace(/[^\/]*(\?.*)$/, '') +
expectedFileName;
@ -158,7 +168,7 @@ function test4()
/* generate an error with only msg and filename properties */
enterFunc ("test4");
var expectedLine = 163;
var expectedLine = 173;
var e = new InternalError ("msg", "file");
reportCompare ("(new InternalError(\"msg\", \"file\", " + expectedLine + "))",

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

@ -105,23 +105,29 @@ class NullXULInfoTester:
def test(self, cond):
return False
def _parse_one(testcase, xul_tester):
def _parse_one(parts, xul_tester):
script = None
enable = True
expect = True
random = False
slow = False
debugMode = False
pos = 0
parts = testcase.terms.split()
while pos < len(parts):
if parts[pos] == 'fails':
testcase.expect = False
expect = False
pos += 1
elif parts[pos] == 'skip':
testcase.expect = testcase.enable = False
expect = enable = False
pos += 1
elif parts[pos] == 'random':
testcase.random = True
random = True
pos += 1
elif parts[pos].startswith('fails-if'):
cond = parts[pos][len('fails-if('):-1]
if xul_tester.test(cond):
testcase.expect = False
expect = False
pos += 1
elif parts[pos].startswith('asserts-if'):
# This directive means we may flunk some number of
@ -130,55 +136,49 @@ def _parse_one(testcase, xul_tester):
elif parts[pos].startswith('skip-if'):
cond = parts[pos][len('skip-if('):-1]
if xul_tester.test(cond):
testcase.expect = testcase.enable = False
expect = enable = False
pos += 1
elif parts[pos].startswith('random-if'):
cond = parts[pos][len('random-if('):-1]
if xul_tester.test(cond):
testcase.random = True
random = True
pos += 1
elif parts[pos].startswith('require-or'):
cond = parts[pos][len('require-or('):-1]
(preconditions, fallback_action) = re.split(",", cond)
for precondition in re.split("&&", preconditions):
if precondition == 'debugMode':
testcase.options.append('-d')
debugMode = True
elif precondition == 'true':
pass
else:
if fallback_action == "skip":
testcase.expect = testcase.enable = False
expect = enable = False
elif fallback_action == "fail":
testcase.expect = False
expect = False
elif fallback_action == "random":
testcase.random = True
random = True
else:
raise Exception(("Invalid precondition '%s' or fallback " +
" action '%s'") % (precondition, fallback_action))
break
pos += 1
elif parts[pos] == 'script':
script = parts[pos+1]
pos += 2
elif parts[pos] == 'slow':
testcase.slow = True
slow = True
pos += 1
elif parts[pos] == 'silentfail':
# silentfails use tons of memory, and Darwin doesn't support ulimit.
if xul_tester.test("xulRuntime.OS == 'Darwin'"):
testcase.expect = testcase.enable = False
expect = enable = False
pos += 1
else:
print 'warning: invalid manifest line element "%s"'%parts[pos]
pos += 1
def _build_manifest_script_entry(t):
line = []
if t.terms:
line.append(t.terms)
line.append("script")
line.append(k)
if t.comment:
line.append("#")
line.append(t.comment)
return ' '.join(line)
return script, (enable, expect, random, slow, debugMode)
def _map_prefixes_left(test_list):
"""
@ -196,12 +196,6 @@ def _map_prefixes_left(test_list):
return byprefix
def _emit_manifest_at(location, relative, test_list, depth):
"""
location - str: absolute path where we want to write the manifest
relative - str: relative path from topmost manifest directory to current
test_list - [str]: list of all test paths and directorys
depth - int: number of dirs we are below the topmost manifest dir
"""
manifests = _map_prefixes_left(test_list)
filename = os.path.join(location, 'jstests.list')
@ -216,8 +210,16 @@ def _emit_manifest_at(location, relative, test_list, depth):
else:
numTestFiles += 1
assert(len(test_list) == 1)
line = _build_manifest_script_entry(test_list[0])
manifest.append(line)
t = test_list[0]
line = []
if t.terms:
line.append(t.terms)
line.append("script")
line.append(k)
if t.comment:
line.append("#")
line.append(t.comment)
manifest.append(' '.join(line))
# Always present our manifest in sorted order.
manifest.sort()
@ -274,7 +276,12 @@ def _parse_test_header(fullpath, testcase, xul_tester):
testcase.terms = matches.group(2)
testcase.comment = matches.group(4)
_parse_one(testcase, xul_tester)
_, properties = _parse_one(testcase.terms.split(), xul_tester)
testcase.enable = properties[0]
testcase.expect = properties[1]
testcase.random = properties[2]
testcase.slow = properties[3]
testcase.debugMode = properties[4]
def load(location, xul_tester, reldir = ''):
"""
@ -307,7 +314,12 @@ def load(location, xul_tester, reldir = ''):
continue
# Parse the test header and load the test.
testcase = TestCase(os.path.join(reldir, filename))
testcase = TestCase(os.path.join(reldir, filename),
enable = True,
expect = True,
random = False,
slow = False,
debugMode = False)
_parse_test_header(fullpath, testcase, xul_tester)
tests.append(testcase)
return tests

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

@ -81,8 +81,10 @@ class Test(object):
def get_command(self, js_cmd_prefix):
dirname, filename = os.path.split(self.path)
cmd = js_cmd_prefix + Test.prefix_command(dirname)
cmd += self.options
cmd += [ '-f', self.path ]
if self.debugMode:
cmd += [ '-d' ]
# There is a test that requires the path to start with './'.
cmd += [ '-f', './' + self.path ]
return cmd
def run(self, js_cmd_prefix, timeout=30.0):
@ -94,13 +96,13 @@ class TestCase(Test):
"""A test case consisting of a test and an expected result."""
js_cmd_prefix = None
def __init__(self, path):
def __init__(self, path, enable, expect, random, slow, debugMode):
Test.__init__(self, path)
self.enable = True # bool: True => run test, False => don't run
self.expect = True # bool: expected result, True => pass
self.random = False # bool: True => ignore output as 'random'
self.slow = False # bool: True => test may run slowly
self.options = [] # [str]: Extra options to pass to the shell
self.enable = enable # bool: True => run test, False => don't run
self.expect = expect # bool: expected result, True => pass
self.random = random # bool: True => ignore output as 'random'
self.slow = slow # bool: True => test may run slowly
self.debugMode = debugMode # bool: True => must be run in debug mode
# The terms parsed to produce the above properties.
self.terms = None
@ -121,7 +123,7 @@ class TestCase(Test):
ans += ', random'
if self.slow:
ans += ', slow'
if '-d' in self.options:
if self.debugMode:
ans += ', debugMode'
return ans