Bug 778921 - Fix "warning: invalid manifest line element "pref(javascript.options.xml.content,true)" running JS tests in the shell with jstests.py. r=luke.

This commit is contained in:
Jason Orendorff 2012-07-31 11:55:45 -05:00
Родитель fadf76901f
Коммит fc4841ff57
10 изменённых файлов: 24 добавлений и 13 удалений

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

@ -1,4 +1,4 @@
// |reftest| skip-if(!xulRuntime.shell) // |reftest| pref(javascript.options.xml.content,true) skip-if(!xulRuntime.shell)
/* /*
* Any copyright is dedicated to the Public Domain. * Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/ * http://creativecommons.org/licenses/publicdomain/

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

@ -1,4 +1,4 @@
// |reftest| skip-if(!xulRuntime.shell) // |reftest| pref(javascript.options.xml.content,true) skip-if(!xulRuntime.shell)
// -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- // -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// Any copyright is dedicated to the Public Domain. // Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/ // http://creativecommons.org/licenses/publicdomain/

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

@ -1,4 +1,4 @@
// |reftest| skip-if(!xulRuntime.shell) // |reftest| pref(javascript.options.xml.content,true) skip-if(!xulRuntime.shell)
// -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- // -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// Any copyright is dedicated to the Public Domain. // Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/ // http://creativecommons.org/licenses/publicdomain/

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

@ -1,4 +1,4 @@
// |reftest| skip-if(!xulRuntime.shell) // |reftest| pref(javascript.options.xml.content,true) skip-if(!xulRuntime.shell)
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* /*
* Any copyright is dedicated to the Public Domain. * Any copyright is dedicated to the Public Domain.

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

@ -1,4 +1,4 @@
// |reftest| fails-if(!xulRuntime.shell) // |reftest| pref(javascript.options.xml.content,true) fails-if(!xulRuntime.shell)
// Any copyright is dedicated to the Public Domain. // Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/ // http://creativecommons.org/licenses/publicdomain/
// Contributors: Gary Kwong <gary@rumblingedge.com>, Brendan Eich <brendan@mozilla.com> // Contributors: Gary Kwong <gary@rumblingedge.com>, Brendan Eich <brendan@mozilla.com>

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

@ -1,3 +1,4 @@
// |reftest| pref(javascript.options.xml.content,true)
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* /*
* Any copyright is dedicated to the Public Domain. * Any copyright is dedicated to the Public Domain.

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

@ -1,4 +1,4 @@
// |reftest| skip-if(!xulRuntime.shell) -- uses evalcx // |reftest| pref(javascript.options.xml.content,true) skip-if(!xulRuntime.shell) -- uses evalcx
/* /*
* Any copyright is dedicated to the Public Domain. * Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/ * http://creativecommons.org/licenses/publicdomain/

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

@ -112,6 +112,7 @@ def _parse_one(parts, xul_tester):
random = False random = False
slow = False slow = False
debugMode = False debugMode = False
allowXml = False
pos = 0 pos = 0
while pos < len(parts): while pos < len(parts):
@ -174,11 +175,14 @@ def _parse_one(parts, xul_tester):
if xul_tester.test("xulRuntime.OS == 'Darwin'"): if xul_tester.test("xulRuntime.OS == 'Darwin'"):
expect = enable = False expect = enable = False
pos += 1 pos += 1
elif parts[pos] == 'pref(javascript.options.xml.content,true)':
allowXml = True
pos += 1
else: else:
print 'warning: invalid manifest line element "%s"'%parts[pos] print 'warning: invalid manifest line element "%s"'%parts[pos]
pos += 1 pos += 1
return script, (enable, expect, random, slow, debugMode) return script, (enable, expect, random, slow, debugMode, allowXml)
def _map_prefixes_left(test_list): def _map_prefixes_left(test_list):
""" """
@ -282,6 +286,7 @@ def _parse_test_header(fullpath, testcase, xul_tester):
testcase.random = properties[2] testcase.random = properties[2]
testcase.slow = properties[3] testcase.slow = properties[3]
testcase.debugMode = properties[4] testcase.debugMode = properties[4]
testcase.allowXml = properties[5]
def load(location, xul_tester, reldir = ''): def load(location, xul_tester, reldir = ''):
""" """
@ -319,7 +324,8 @@ def load(location, xul_tester, reldir = ''):
expect = True, expect = True,
random = False, random = False,
slow = False, slow = False,
debugMode = False) debugMode = False,
allowXml = False)
_parse_test_header(fullpath, testcase, xul_tester) _parse_test_header(fullpath, testcase, xul_tester)
tests.append(testcase) tests.append(testcase)
return tests return tests

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

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

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

@ -607,14 +607,15 @@ function optionsInit() {
function optionsClear() { function optionsClear() {
// turn off current settings // turn off current settings
// except jit. // except jit and allow_xml.
var optionNames = options().split(','); var optionNames = options().split(',');
for (var i = 0; i < optionNames.length; i++) for (var i = 0; i < optionNames.length; i++)
{ {
var optionName = optionNames[i]; var optionName = optionNames[i];
if (optionName && if (optionName &&
optionName != "methodjit" && optionName != "methodjit" &&
optionName != "methodjit_always") optionName != "methodjit_always" &&
optionName != "allow_xml")
{ {
options(optionName); options(optionName);
} }
@ -679,7 +680,6 @@ if (typeof options == 'function')
{ {
optionsInit(); optionsInit();
optionsClear(); optionsClear();
options("allow_xml");
} }
function getTestCaseResult(expected, actual) function getTestCaseResult(expected, actual)