js/src/tests/update-test262.sh

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rwxr-xr-x

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 #!/bin/sh
michael@0 2 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 5
michael@0 6 # Abort when an error occurs.
michael@0 7 set -e
michael@0 8
michael@0 9 # Updates the jstests copy of the test cases of Test262, the conformance test
michael@0 10 # suite for ECMA-262 and ECMA-402, ECMAScript and its Internationalization API.
michael@0 11
michael@0 12 function usage()
michael@0 13 {
michael@0 14 echo "Usage: update-test262.sh <URL of test262 hg> [clone | copy]"
michael@0 15 echo ""
michael@0 16 echo "The URL will most commonly be http://hg.ecmascript.org/tests/test262/ "
michael@0 17 echo "but may also be a local clone. Don't use a local clone when generating"
michael@0 18 echo "the final import patch"\!" test262/HG-INFO will record the wrong URL"
michael@0 19 echo "if you do so. Local cloning is only useful when editing this script to"
michael@0 20 echo "import a larger test262 subset."
michael@0 21 echo ""
michael@0 22 echo "If a local clone is specified, the optional clone/copy argument will"
michael@0 23 echo "either clone into a temporary directory, or directly copy from the"
michael@0 24 echo "clone's checkout. 'clone' semantics are the default."
michael@0 25 exit 1
michael@0 26 }
michael@0 27
michael@0 28 if [ $# -lt 1 ]; then
michael@0 29 usage
michael@0 30 elif [ $# -eq 1 -o "$2" == "clone" ]; then
michael@0 31 # Beware! 'copy' support requires that the clone performed here *never* be
michael@0 32 # altered. If it were altered, those changes wouldn't appear in the final
michael@0 33 # set of changes as determined by the 'copy' path below.
michael@0 34
michael@0 35 # Mercurial doesn't have a way to download just a part of a repository, or to
michael@0 36 # just get the working copy - we have to clone the entire thing. We use a
michael@0 37 # temporary test262 directory for that.
michael@0 38 unique_dir=`mktemp -d /tmp/test262.XXXX` || exit 1
michael@0 39 tmp_dir=${unique_dir}/test262
michael@0 40
michael@0 41 # Remove the temporary test262 directory on exit.
michael@0 42 function cleanupTempFiles()
michael@0 43 {
michael@0 44 rm -rf ${unique_dir}
michael@0 45 }
michael@0 46 trap cleanupTempFiles EXIT
michael@0 47
michael@0 48 echo "Feel free to get some coffee - this could take a few minutes..."
michael@0 49 hg clone $1 ${tmp_dir}
michael@0 50 elif [ "$2" == "copy" ]; then
michael@0 51 echo "Copying directly from $1; be sure this repository is updated to tip"\!
michael@0 52 tmp_dir="$1"
michael@0 53 else
michael@0 54 usage
michael@0 55 fi
michael@0 56
michael@0 57 # Now to the actual test262 directory.
michael@0 58 js_src_tests_dir=`dirname $0`
michael@0 59 test262_dir=${js_src_tests_dir}/test262
michael@0 60 rm -rf ${test262_dir}
michael@0 61 mkdir ${test262_dir}
michael@0 62
michael@0 63 # Copy over the test262 license.
michael@0 64 cp ${tmp_dir}/LICENSE ${test262_dir}
michael@0 65
michael@0 66 # The test262 tests are in test/suite. The "bestPractice" tests cover non-
michael@0 67 # standard extensions, or are not strictly required by specs, so we don't
michael@0 68 # include them. The remaining tests are currently in "intl402" or "chNN"
michael@0 69 # directories (where NN is an ECMA-262 chapter number). This may change at
michael@0 70 # some point, as there is some dissatisfaction on test262-discuss with using
michael@0 71 # impermanent section numbering (across ES5, ES6, etc.) to identify what's
michael@0 72 # tested.
michael@0 73 #
michael@0 74 # The large quantity of tests at issue here, and the variety of things being
michael@0 75 # tested, motivate importing portions of test262 incrementally. So rather than
michael@0 76 # doing this:
michael@0 77 #
michael@0 78 # cp -r ${tmp_dir}/test/suite/ch* ${test262_dir}
michael@0 79 #
michael@0 80 # ...we instead individually import folders whose tests we pass. (Well, mostly
michael@0 81 # pass -- see the comment at the end of this script.)
michael@0 82 cp -r ${tmp_dir}/test/suite/ch06 ${test262_dir}/ch06
michael@0 83 cp -r ${tmp_dir}/test/suite/ch07 ${test262_dir}/ch07
michael@0 84 cp -r ${tmp_dir}/test/suite/ch08 ${test262_dir}/ch08
michael@0 85 cp -r ${tmp_dir}/test/suite/ch09 ${test262_dir}/ch09
michael@0 86 cp -r ${tmp_dir}/test/suite/ch10 ${test262_dir}/ch10
michael@0 87 cp -r ${tmp_dir}/test/suite/ch11 ${test262_dir}/ch11
michael@0 88 cp -r ${tmp_dir}/test/suite/ch12 ${test262_dir}/ch12
michael@0 89 cp -r ${tmp_dir}/test/suite/ch13 ${test262_dir}/ch13
michael@0 90 cp -r ${tmp_dir}/test/suite/ch14 ${test262_dir}/ch14
michael@0 91
michael@0 92 # The test402 tests are in test/suite/intl402/. For now there are no
michael@0 93 # "bestPractice" tests to omit. The remaining tests are in chNN directories,
michael@0 94 # NN referring to chapters of ECMA-402.
michael@0 95 #
michael@0 96 # All intl402 tests are runnable, and only a few currently fail, so we import
michael@0 97 # them wildcard-style.
michael@0 98 mkdir ${test262_dir}/intl402
michael@0 99 cp -r ${tmp_dir}/test/suite/intl402/ch* ${test262_dir}/intl402
michael@0 100
michael@0 101 # Copy over harness supporting files needed by the test402 tests.
michael@0 102 cp ${tmp_dir}/test/harness/sta.js ${js_src_tests_dir}/supporting/
michael@0 103 cp ${tmp_dir}/test/harness/testBuiltInObject.js ${js_src_tests_dir}/supporting/
michael@0 104 cp ${tmp_dir}/test/harness/testIntl.js ${js_src_tests_dir}/supporting/
michael@0 105
michael@0 106 # Create empty browser.js and shell.js in all test directories to keep
michael@0 107 # jstests happy.
michael@0 108 for dir in `find ${test262_dir} ${test262_dir}/ch* ${test262_dir}/intl402/ch* -type d -print` ; do
michael@0 109 touch $dir/browser.js
michael@0 110 touch $dir/shell.js
michael@0 111 done
michael@0 112
michael@0 113 # Construct the test262 tests' jstests adapter files.
michael@0 114 cp ${js_src_tests_dir}/supporting/test262-browser.js ${test262_dir}/browser.js
michael@0 115 cat ${js_src_tests_dir}/supporting/sta.js ${js_src_tests_dir}/supporting/test262-shell.js > ${test262_dir}/shell.js
michael@0 116
michael@0 117 # Restore the Intl tests' jstests adapter files. Loading include files into the
michael@0 118 # browser from a script so that they become synchronously available to that same
michael@0 119 # script is basically impossible. Instead, just concatenate all the scripts
michael@0 120 # together into one script loaded before the test executes.
michael@0 121 cat ${js_src_tests_dir}/supporting/test402-browser.js \
michael@0 122 ${js_src_tests_dir}/supporting/testBuiltInObject.js \
michael@0 123 ${js_src_tests_dir}/supporting/testIntl.js > ${test262_dir}/intl402/browser.js
michael@0 124 cp ${js_src_tests_dir}/supporting/test402-shell.js ${test262_dir}/intl402/shell.js
michael@0 125
michael@0 126 # Keep a record of what we imported.
michael@0 127 echo "URL: $1" > ${test262_dir}/HG-INFO
michael@0 128 hg -R ${tmp_dir} log -r. >> ${test262_dir}/HG-INFO
michael@0 129
michael@0 130 # Update for the patch.
michael@0 131 hg addremove ${js_src_tests_dir}/supporting
michael@0 132 hg addremove ${test262_dir}
michael@0 133
michael@0 134 # The alert reader may now be wondering: what about test262 tests that we don't
michael@0 135 # pass? (And what about any test262 tests whose format we don't yet support?)
michael@0 136 # We explicitly disable all such tests in js/src/tests/jstests.list one by one.
michael@0 137 # This has the moderate benefit that if a bug is fixed, only that one file must
michael@0 138 # be updated, and we don't have to rerun this script.

mercurial