Bug 496923 - Move the Intl test harness scripts into a new js/src/tests/supporting/ directory, and make the test402 update script copy them into place from there. r=terrence

--HG--
extra : rebase_source : bca104253e86ec5d5bfe4136d504de8da8381c97
This commit is contained in:
Jeff Walden 2013-05-31 14:41:50 -07:00
parent da5553ad05
commit 7acfa0b8ac
6 changed files with 97 additions and 5 deletions

View File

@ -19,7 +19,8 @@ Adding a test
<fineprint> Some names are forbidden. Do not name your test browser.js,
shell.js, jsref.js, template.js, user.js, js-test-driver-begin.js, or
js-test-driver-end.js. </fineprint>
js-test-driver-end.js, or any of the names of the files in supporting/.
</fineprint>
Adjusting when and how a test runs
----------------------------------

View File

@ -215,7 +215,7 @@ def _emit_manifest_at(location, relative, test_list, depth):
_emit_manifest_at(fullpath, relpath, test_list, depth + 1)
else:
numTestFiles += 1
assert(len(test_list) == 1)
assert len(test_list) == 1
line = _build_manifest_script_entry(k, test_list[0])
manifest.append(line)
@ -344,7 +344,8 @@ def load(location, xul_tester, reldir = ''):
# Any file whose basename matches something in this set is ignored.
EXCLUDED = set(('browser.js', 'shell.js', 'jsref.js', 'template.js',
'user.js', 'js-test-driver-begin.js', 'js-test-driver-end.js'))
'user.js', 'test402-browser.js', 'test402-shell.js',
'js-test-driver-begin.js', 'js-test-driver-end.js'))
manifestFile = os.path.join(location, 'jstests.list')
externalManifestEntries = _parse_external_manifest(manifestFile, '')

View File

@ -0,0 +1,9 @@
================================
= DANGER!!!!!!!!1!!!cos(0)!!!! =
================================
Any *.js files you add in this directory *will* be considered to be tests by the
test-staging Makefile target, used to package up JS tests for running on
Tinderbox. You are now probably sorry this is the case. But there is a
hackaround! To make the packaging algorithm ignore a *.js file here, add it to
the EXCLUDED set in lib/manifest.py.

View File

@ -0,0 +1,40 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Undo at least the damage done by taintArray so that the jstests
* harness won't die. The properties added to Object.prototype by the various
* tests have names that are less likely to cause trouble.
*/
setRestoreFunction((function () {
var Array_indexOf = Array.prototype.indexOf;
var Array_join = Array.prototype.join;
var Array_push = Array.prototype.push;
var Array_slice = Array.prototype.slice;
var Array_sort = Array.prototype.sort;
return function () {
delete Array.prototype["0"];
Array.prototype.indexOf = Array_indexOf;
Array.prototype.join = Array_join;
Array.prototype.push = Array_push;
Array.prototype.slice = Array_slice;
Array.prototype.sort = Array_sort;
};
}()));
/*
* Loading include files into the browser from a script so that they become
* synchronously available to that same script is difficult. Instead, request
* all of them to be loaded before we start.
*/
include("test402/lib/testBuiltInObject.js");
include("test402/lib/testIntl.js");
/*
* Test262 function $INCLUDE loads a file with support functions for the tests.
* Since we've already loaded all of these files, just ignore the call.
* This function replaces one in shell.js.
*/
function $INCLUDE(file) {
}

View File

@ -0,0 +1,33 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Test402 tests pass unless they throw. Note that this isn't true for all
* Test262 test cases - for the ones marked @negative the logic is inverted.
*/
testPassesUnlessItThrows();
/*
* Test262 function $ERROR throws an error with the message provided. Test262
* test cases call it to indicate failure.
*/
function $ERROR(msg) {
throw new Error("Test402 error: " + msg);
}
/*
* Test262 function $INCLUDE loads a file with support functions for the tests.
* This function is replaced in browser.js.
*/
function $INCLUDE(file) {
loadRelativeToScript("lib/" + file);
}
/*
* Test262 function fnGlobalObject returns the global object.
*/
var __globalObject = Function("return this;")();
function fnGlobalObject() {
return __globalObject;
}

View File

@ -11,6 +11,9 @@
# E.g.: update-test402.sh http://hg.ecmascript.org/tests/test262/
# Note that test402 is part of the test262 repository.
# Abort when an error occurs.
set -e
if [ $# -lt 1 ]; then
echo "Usage: update-test402.sh <URL of test262 hg>"
exit 1
@ -47,8 +50,8 @@ for dir in `find test402/ch* -type d -print` ; do
done
# Restore our own jstests adapter files.
hg revert --no-backup test402/browser.js
hg revert --no-backup test402/shell.js
cp supporting/test402-browser.js test402/browser.js
cp supporting/test402-shell.js test402/shell.js
# Keep a record of what we imported.
echo "URL: $1" > ${test402_dir}/HG-INFO
@ -59,3 +62,8 @@ hg addremove ${test402_dir}
# Get rid of the Test262 clone.
rm -rf ${tmp_dir}
# The alert reader may now be wondering: what about test402 tests we don't
# currently pass? We disable such tests in js/src/tests/jstests.list, one by
# one. This has the moderate benefit that if a bug is fixed, only that one file
# must be updated, and we don't have to rerun this script.