Skip to content

Commit cf7b7a1

Browse files
authored
Test 'test262' test suite on Travis CI (#1440)
JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
1 parent 2622e93 commit cf7b7a1

File tree

4 files changed

+69
-86
lines changed

4 files changed

+69
-86
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ env:
88
- OPTS="--check-signed-off-travis --check-cppcheck --check-vera --check-license"
99
- OPTS="--jerry-tests --jerry-test-suite"
1010
- OPTS="--jerry-tests --jerry-test-suite --toolchain=cmake/toolchain_linux_armv7l.cmake" TIMEOUT=300 INSTALL_QEMU_ARM=yes
11-
- OPTS=--buildoption-test
12-
- OPTS=--unittests
11+
- OPTS="--buildoption-test"
12+
- OPTS="--unittests"
13+
- OPTS="--test262"
1314

1415
matrix:
1516
include:
@@ -22,6 +23,7 @@ before_install:
2223
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tools/apt-get-install-deps.sh; fi
2324
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$INSTALL_QEMU_ARM" == "yes" ]]; then tools/apt-get-install-qemu-arm.sh; fi
2425
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tools/brew-install-deps.sh; fi
26+
- if [[ "$OPTS" == "--test262" ]]; then sudo timedatectl set-timezone America/Los_Angeles; fi
2527

2628
install:
2729

tools/run-tests.py

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
parser.add_argument('--jerry-test-suite', action='store_true', default=False, help='Run jerry-test-suite')
3838
parser.add_argument('--unittests', action='store_true', default=False, help='Run unittests')
3939
parser.add_argument('--precommit', action='store_true', default=False, dest='all', help='Run all test')
40+
parser.add_argument('--test262', action='store_true', default=False, help='Run test262')
4041

4142
if len(sys.argv) == 1:
4243
parser.print_help()
@@ -50,11 +51,13 @@
5051
OUTPUT_DIR = path.join(PROJECT_DIR, script_args.outdir)
5152

5253
class Options:
53-
out_dir = ''
54-
build_args = []
55-
test_args = []
54+
def __init__(self, name = '', build_args = None, test_args = None):
55+
if build_args is None:
56+
build_args = []
57+
58+
if test_args is None:
59+
test_args = []
5660

57-
def __init__(self, name = '', build_args = [], test_args = []):
5861
self.out_dir = path.join(OUTPUT_DIR, name)
5962
self.build_args = build_args
6063
self.build_args.append('--builddir=%s' % self.out_dir)
@@ -63,15 +66,15 @@ def __init__(self, name = '', build_args = [], test_args = []):
6366

6467
# Test options for unittests
6568
jerry_unittests_options = [
66-
Options('unittests', ['--unittests', '--error-messages=on', '--snapshot-save=on', '--snapshot-exec=on']),
67-
Options('unittests-debug', ['--unittests', '--debug', '--error-messages=on', '--snapshot-save=on', '--snapshot-exec=on']),
69+
Options('unittests', ['--unittests', '--error-messages=on', '--snapshot-save=on', '--snapshot-exec=on']),
70+
Options('unittests-debug', ['--unittests', '--debug', '--error-messages=on', '--snapshot-save=on', '--snapshot-exec=on']),
6871
]
6972

7073
# Test options for jerry-tests
7174
jerry_tests_options = [
7275
Options('jerry_tests'),
73-
Options('jerry_tests-snapshot', ['--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']),
7476
Options('jerry_tests-debug', ['--debug']),
77+
Options('jerry_tests-snapshot', ['--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']),
7578
Options('jerry_tests-debug-snapshot', ['--debug', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']),
7679
]
7780

@@ -82,6 +85,11 @@ def __init__(self, name = '', build_args = [], test_args = []):
8285
jerry_test_suite_options.append(Options('jerry_test_suite-minimal-debug', ['--debug', '--profile=minimal']))
8386
jerry_test_suite_options.append(Options('jerry_test_suite-minimal-debug-snapshot', ['--debug', '--profile=minimal', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']))
8487

88+
# Test options for test262
89+
test262_test_suite_options = [
90+
Options('test262_tests'),
91+
]
92+
8593
# Test options for buildoption-test
8694
jerry_buildoptions = [
8795
Options('buildoption_test-lto', ['--lto=on']),
@@ -163,6 +171,22 @@ def run_jerry_test_suite():
163171

164172
return ret_build | ret_test
165173

174+
def run_test262_test_suite():
175+
ret_build = ret_test = 0
176+
for job in test262_test_suite_options:
177+
ret_build = create_binary(job.build_args)
178+
if ret_build:
179+
break
180+
181+
test_cmd = [TEST262_RUNNER_SCRIPT, get_binary_path(job.out_dir), TEST262_TEST_SUITE_DIR]
182+
183+
if job.test_args:
184+
test_cmd.extend(job.test_args)
185+
186+
ret_test |= run_check(test_cmd)
187+
188+
return ret_build | ret_test
189+
166190
def run_unittests():
167191
ret_build = ret_test = 0
168192
for job in jerry_unittests_options:
@@ -209,6 +233,9 @@ def main():
209233
if not ret and (script_args.all or script_args.jerry_test_suite):
210234
ret = run_jerry_test_suite()
211235

236+
if not ret and (script_args.all or script_args.test262):
237+
ret = run_test262_test_suite()
238+
212239
if not ret and (script_args.all or script_args.unittests):
213240
ret = run_unittests()
214241

tools/runners/run-test-suite-test262.sh

Lines changed: 29 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616

1717
ENGINE="$1"
1818
PATH_TO_TEST262="$2"
19-
REPORT_PREFIX="report"
20-
RUN_PIDS=""
21-
RESULT_OK=1
22-
TIMEOUT="5s"
19+
OUTPUT_DIR=`dirname $ENGINE`
20+
REPORT_PATH="${OUTPUT_DIR}/test262.report"
21+
TIMEOUT="90s"
2322

2423
if [ $# -lt 2 ]
2524
then
@@ -28,91 +27,44 @@ then
2827
echo "Usage:"
2928
echo " 1st parameter: JavaScript engine to be tested."
3029
echo " 2nd parameter: path to the directory with official test262 testsuite."
31-
echo " 3rd parameter: (optional) call this script with the '--sub-chapters' flag to print the detailed report."
3230
echo ""
3331
echo "Example:"
34-
echo " ./run-test-suite-test262.sh <engine> <test262_dir> --sub-chapters"
32+
echo " ./run-test-suite-test262.sh <engine> <test262_dir>"
3533
exit 1
3634
fi
3735

38-
39-
rm "${REPORT_PREFIX}".* &> /dev/null
40-
41-
declare -a CHAPTER07_TO_TEST=("7.1" "7.2" "7.3" "7.4" "7.5" "7.6" "7.6.1" "7.7" \
42-
"7.8" "7.8.1" "7.8.2" "7.8.3" "7.8.4" "7.8.5" "7.9" "7.9.2")
43-
declare -a CHAPTER08_TO_TEST=("8.1" "8.2" "8.3" "8.4" "8.5" "8.6" "8.6.1" "8.6.2" "8.7" "8.7.1" "8.7.2" "8.8" "8.12" \
44-
"8.12.1" "8.12.3" "8.12.4" "8.12.5" "8.12.6" "8.12.7" "8.12.8" "8.12.9")
45-
declare -a CHAPTER09_TO_TEST=("9.1" "9.2" "9.3" "9.3.1" "9.4" "9.5" "9.6" "9.7" "9.8" "9.8.1" "9.9")
46-
declare -a CHAPTER10_TO_TEST=("10.1" "10.1.1" "10.2" "10.2.1" "10.2.2" "10.2.3" "10.3" "10.3.1" "10.4" "10.4.1" \
47-
"10.4.2" "10.4.3" "10.5" "10.6")
48-
declare -a CHAPTER11_TO_TEST=("11.1" "11.1.1" "11.1.2" "11.1.3" "11.1.4" "11.1.5" "11.1.6" "11.2" "11.2.1" "11.2.2" \
49-
"11.2.3" "11.2.4" "11.3" "11.3.1" "11.3.2" "11.4" "11.4.1" "11.4.2" "11.4.3" \
50-
"11.4.4" "11.4.5" "11.4.6" "11.4.7" "11.4.8" "11.4.9" "11.5" "11.5.1" "11.5.2" "11.5.3" \
51-
"11.6" "11.6.1" "11.6.2" "11.7" "11.7.1" "11.7.2" "11.7.3" "11.8" "11.8.1" "11.8.2" \
52-
"11.8.3" "11.8.4" "11.8.6" "11.8.7" "11.9" "11.9.1" "11.9.2" "11.9.4" "11.9.5" "11.10" \
53-
"11.11" "11.12" "11.13" "11.13.1" "11.13.2" "11.14")
54-
declare -a CHAPTER12_TO_TEST=("12.1" "12.2" "12.2.1" "12.3" "12.4" "12.5" "12.6" "12.6.1" "12.6.2" "12.6.3" "12.6.4" \
55-
"12.7" "12.8" "12.9" "12.10" "12.10.1" "12.11" "12.12" "12.13" "12.14" "12.14.1")
56-
declare -a CHAPTER13_TO_TEST=("13.1" "13.2" "13.2.1" "13.2.2" "13.2.3")
57-
declare -a CHAPTER14_TO_TEST=("14.1")
58-
declare -a CHAPTER14_TO_TEST=("12.6.4")
59-
declare -a CHAPTER15_TO_TEST=("15.1" "15.1.1" "15.1.2" "15.1.3" "15.1.4" "15.1.5" "15.2" "15.2.1" "15.2.2" "15.2.3" \
60-
"15.2.4" "15.2.5" "15.3" "15.3.1" "15.3.2" "15.3.3" "15.3.4" "15.3.5" "15.4" "15.4.1" \
61-
"15.4.2" "15.4.3" "15.4.4" "15.4.5" "15.5" "15.5.1" "15.5.2" "15.5.3" "15.5.4" "15.5.5" \
62-
"15.6" "15.6.1" "15.6.2" "15.6.3" "15.6.4" "15.6.5" "15.7" "15.7.1" "15.7.2" "15.7.3" \
63-
"15.7.4" "15.7.5" "15.8" "15.8.1" "15.8.2" "15.9" "15.9.1" "15.9.2" "15.9.3" "15.9.4" \
64-
"15.9.5" "15.9.6" "15.10" "15.10.1" "15.10.2" "15.10.3" "15.10.4" "15.10.5" "15.10.6" \
65-
"15.10.7" "15.11" "15.11.1" "15.11.2" "15.11.3" "15.11.4" "15.11.5" "15.11.6" "15.11.7" \
66-
"15.12" "15.12.1" "15.12.2" "15.12.3")
67-
declare -a FULL_CHAPTERS_TO_TEST=("ch06" "ch07" "ch08" "ch09" "ch10" "ch11" "ch12" "ch13" "ch14" "ch15")
68-
declare -a SUB_CHAPTERS_TO_TEST=("${CHAPTER07_TO_TEST[@]}" "${CHAPTER08_TO_TEST[@]}" "${CHAPTER09_TO_TEST[@]}" \
69-
"${CHAPTER10_TO_TEST[@]}" "${CHAPTER11_TO_TEST[@]}" "${CHAPTER12_TO_TEST[@]}" \
70-
"${CHAPTER13_TO_TEST[@]}" "${CHAPTER14_TO_TEST[@]}" "${CHAPTER15_TO_TEST[@]}")
71-
72-
declare -a CHAPTERS_TO_TEST=("${FULL_CHAPTERS_TO_TEST[@]}")
73-
74-
if [[ $* == *--sub-chapters* ]]
36+
if [ ! -d "${PATH_TO_TEST262}/.git" ]
7537
then
76-
declare -a CHAPTERS_TO_TEST=("${SUB_CHAPTERS_TO_TEST[@]}")
38+
git clone https://github.com/tc39/test262.git -b es5-tests "${PATH_TO_TEST262}"
7739
fi
7840

79-
function run_test262 () {
80-
ARG_ENGINE="$1"
81-
ARG_TEST262_PATH="$2"
82-
ARG_CHAPTER="$3"
83-
84-
"${ARG_TEST262_PATH}"/tools/packaging/test262.py --command "timeout ${TIMEOUT} ${ARG_ENGINE}" \
85-
--tests="${ARG_TEST262_PATH}" --full-summary "${ARG_CHAPTER}" \
86-
> "${REPORT_PREFIX}"."${ARG_CHAPTER}"
87-
}
41+
rm -rf "${PATH_TO_TEST262}/test/suite/bestPractice"
42+
rm -rf "${PATH_TO_TEST262}/test/suite/intl402"
8843

89-
function show_report_results () {
90-
ARG_CHAPTER="$1"
44+
echo "Starting test262 testing for ${ENGINE}. Running test262 may take a several minutes."
9145

92-
echo ""
93-
echo "Chapter ${ARG_CHAPTER}:"
94-
grep -A3 "=== Summary ===" "${REPORT_PREFIX}"."${ARG_CHAPTER}"
95-
echo "==============="
96-
}
46+
"${PATH_TO_TEST262}"/tools/packaging/test262.py --command "timeout ${TIMEOUT} ${ENGINE}" \
47+
--tests="${PATH_TO_TEST262}" --summary \
48+
&> "${REPORT_PATH}"
9749

98-
echo "Starting test262 testing for ${ENGINE}."
50+
grep -A3 "=== Summary ===" "${REPORT_PATH}"
9951

100-
for TEST_NAME in "${CHAPTERS_TO_TEST[@]}"
101-
do
102-
run_test262 "${ENGINE}" "${PATH_TO_TEST262}" "$TEST_NAME" &
103-
RUN_PIDS="$RUN_PIDS $!";
104-
done
52+
FAILURES=`sed -n '/Failed tests/,/^$/p' "${REPORT_PATH}"`
10553

106-
for RUN_PIDS in $RUN_PIDS
107-
do
108-
wait "$RUN_PIDS" || RESULT_OK=0
109-
done;
110-
#[ $RESULT_OK -eq 1 ] || exit 1
54+
EXIT_CODE=0
55+
if [ -n "$FAILURES" ]
56+
then
57+
echo -e "\n$FAILURES\n"
58+
echo "$0: see ${REPORT_PATH} for details about failures"
59+
EXIT_CODE=1
60+
fi
11161

112-
echo "Testing is completed."
62+
FAILURES=`sed -n '/Expected to fail but passed/,/^$/p' "${REPORT_PATH}"`
63+
if [ -n "$FAILURES" ]
64+
then
65+
echo -e "\n$FAILURES\n"
66+
echo "$0: see ${REPORT_PATH} for details about failures"
67+
EXIT_CODE=1
68+
fi
11369

114-
for TEST_NAME in "${CHAPTERS_TO_TEST[@]}"
115-
do
116-
echo "$TEST_NAME"
117-
show_report_results "$TEST_NAME"
118-
done
70+
exit $EXIT_CODE

tools/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
JERRY_TESTS_DIR = path.join(PROJECT_DIR, 'tests/jerry')
2323
JERRY_TEST_SUITE_DIR = path.join(PROJECT_DIR, 'tests/jerry-test-suite')
2424
JERRY_TEST_SUITE_MINIMAL_LIST = path.join(PROJECT_DIR, 'tests/jerry-test-suite/minimal-profile-list')
25+
TEST262_TEST_SUITE_DIR = path.join(PROJECT_DIR, 'tests/test262')
2526

2627
BUILD_SCRIPT = path.join(TOOLS_DIR, 'build.py')
2728
CPPCHECK_SCRIPT = path.join(TOOLS_DIR, 'check-cppcheck.sh')
2829
SIGNED_OFF_SCRIPT = path.join(TOOLS_DIR, 'check-signed-off.sh')
2930
VERA_SCRIPT = path.join(TOOLS_DIR, 'check-vera.sh')
3031
LICENSE_SCRIPT = path.join(TOOLS_DIR, 'check-license.py')
3132
TEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-test-suite.sh')
33+
TEST262_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-test-suite-test262.sh')
3234
UNITTEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-unittests.sh')

0 commit comments

Comments
 (0)