2017-04-27 13:46:07 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Copyright 2017 the V8 project authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
2017-12-08 14:49:40 +00:00
|
|
|
# Exit immediately if a command exits with a non-zero status.
|
2017-04-27 13:46:07 +00:00
|
|
|
set -e
|
|
|
|
|
2017-12-08 14:49:40 +00:00
|
|
|
# Treat unset variables as an error when substituting.
|
|
|
|
set -u
|
|
|
|
|
|
|
|
# return value of a pipeline is the status of the last command to exit with a
|
|
|
|
# non-zero status, or zero if no command exited with a non-zero status
|
|
|
|
set -o pipefail
|
|
|
|
|
2019-07-17 14:49:47 +00:00
|
|
|
log_and_run() {
|
|
|
|
echo ">>" $*
|
|
|
|
if ! $*; then
|
|
|
|
echo "sub-command failed: $*"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Setup directories.
|
|
|
|
###############################################################################
|
|
|
|
|
2017-04-27 13:46:07 +00:00
|
|
|
TOOLS_WASM_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
V8_DIR="${TOOLS_WASM_DIR}/../.."
|
2017-12-08 14:49:40 +00:00
|
|
|
SPEC_TEST_DIR=${V8_DIR}/test/wasm-spec-tests
|
2019-07-17 14:49:47 +00:00
|
|
|
TMP_DIR=${SPEC_TEST_DIR}/tmp
|
2017-04-27 13:46:07 +00:00
|
|
|
|
2019-08-27 14:14:34 +00:00
|
|
|
JS_API_TEST_DIR=${V8_DIR}/test/wasm-js
|
|
|
|
|
2019-07-17 14:49:47 +00:00
|
|
|
log_and_run cd ${V8_DIR}
|
2017-04-27 13:46:07 +00:00
|
|
|
|
2019-07-17 14:49:47 +00:00
|
|
|
log_and_run rm -rf ${SPEC_TEST_DIR}/tests
|
|
|
|
log_and_run mkdir ${SPEC_TEST_DIR}/tests
|
2017-12-08 14:49:40 +00:00
|
|
|
|
2019-07-17 14:49:47 +00:00
|
|
|
log_and_run mkdir ${SPEC_TEST_DIR}/tests/proposals
|
2017-04-27 13:46:07 +00:00
|
|
|
|
2019-07-17 14:49:47 +00:00
|
|
|
log_and_run rm -rf ${TMP_DIR}
|
|
|
|
log_and_run mkdir ${TMP_DIR}
|
2017-04-27 13:46:07 +00:00
|
|
|
|
2019-08-27 14:14:34 +00:00
|
|
|
log_and_run rm -rf ${JS_API_TEST_DIR}/tests
|
|
|
|
log_and_run mkdir ${JS_API_TEST_DIR}/tests
|
|
|
|
log_and_run mkdir ${JS_API_TEST_DIR}/tests/proposals
|
|
|
|
|
2019-07-17 14:49:47 +00:00
|
|
|
###############################################################################
|
|
|
|
# Generate the spec tests.
|
|
|
|
###############################################################################
|
2018-01-24 12:58:41 +00:00
|
|
|
|
2019-08-27 14:14:34 +00:00
|
|
|
echo Process spec
|
|
|
|
log_and_run cd ${TMP_DIR}
|
|
|
|
log_and_run git clone https://github.com/WebAssembly/spec
|
|
|
|
log_and_run cd spec/interpreter
|
|
|
|
|
2018-01-24 12:58:41 +00:00
|
|
|
# The next step requires that ocaml is installed. See the README.md in
|
2019-08-27 14:14:34 +00:00
|
|
|
# https://github.com/WebAssembly/spec/tree/master/interpreter/.
|
2019-07-17 14:49:47 +00:00
|
|
|
log_and_run make clean opt
|
|
|
|
|
2019-08-27 14:14:34 +00:00
|
|
|
log_and_run cd ${TMP_DIR}/spec/test/core
|
2019-07-17 14:49:47 +00:00
|
|
|
log_and_run cp *.wast ${SPEC_TEST_DIR}/tests/
|
|
|
|
|
2019-08-27 14:14:34 +00:00
|
|
|
log_and_run ./run.py --wasm ${TMP_DIR}/spec/interpreter/wasm --out ${TMP_DIR}
|
2019-07-17 14:49:47 +00:00
|
|
|
log_and_run cp ${TMP_DIR}/*.js ${SPEC_TEST_DIR}/tests/
|
2017-04-27 13:46:07 +00:00
|
|
|
|
2019-08-27 14:14:34 +00:00
|
|
|
log_and_run cp -r ${TMP_DIR}/spec/test/js-api/* ${JS_API_TEST_DIR}/tests
|
|
|
|
|
2019-07-17 14:49:47 +00:00
|
|
|
###############################################################################
|
|
|
|
# Generate the proposal tests.
|
|
|
|
###############################################################################
|
2017-04-27 13:46:07 +00:00
|
|
|
|
2021-03-12 11:59:13 +00:00
|
|
|
repos='js-types tail-call simd memory64'
|
2017-04-27 13:46:07 +00:00
|
|
|
|
2019-07-17 14:49:47 +00:00
|
|
|
for repo in ${repos}; do
|
|
|
|
echo "Process ${repo}"
|
2019-08-27 14:14:34 +00:00
|
|
|
echo ">> Process core tests"
|
2019-07-17 14:49:47 +00:00
|
|
|
log_and_run cd ${TMP_DIR}
|
|
|
|
log_and_run git clone https://github.com/WebAssembly/${repo}
|
|
|
|
# Compile the spec interpreter to generate the .js test cases later.
|
|
|
|
log_and_run cd ${repo}/interpreter
|
|
|
|
log_and_run make clean opt
|
|
|
|
log_and_run cd ../test/core
|
|
|
|
log_and_run mkdir ${SPEC_TEST_DIR}/tests/proposals/${repo}
|
|
|
|
|
|
|
|
# Iterate over all proposal tests. Those which differ from the spec tests are
|
|
|
|
# copied to the output directory and converted to .js tests.
|
Reland "[wasm-simd] Stage SIMD"
This reverts commit e8976cf93a65b97b10d0bdd41cb07577bdb6f959.
Reason for revert: Mark f32x4_cmp as fail, lowering is not fully implemented yet.
Original change's description:
> Revert "[wasm-simd] Stage SIMD"
>
> This reverts commit 1d2726dd0b4ae2d063ca01fbab71fbaeab2e02e5.
>
> Reason for revert: ODROID failure: https://ci.chromium.org/p/v8/builders/ci/V8%20Arm%20-%20debug/15814?
>
> Original change's description:
> > [wasm-simd] Stage SIMD
> >
> > SIMD has been pretty stable for a while now, we are not expecting big
> > changes (like opcode renumbers), there might be new instructions added,
> > and they will all be backwards-compatible.
> >
> > The reference interpreter in the SIMD proposal is now capable of
> > generating JS files for all test cases, so we can now run them.
> >
> > There is a bit of tweaking necessary, since SIMD tests are in
> > tests/core/simd subfolder in the spec, so we need to change the glob
> > into a find that will traverse into subdirectory.
> >
> > Bug: v8:10835
> > Change-Id: I1f7e3cf37f21b2aa2537d1e34242da2373bbf626
> > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2378587
> > Commit-Queue: Zhi An Ng <zhin@chromium.org>
> > Reviewed-by: Andreas Haas <ahaas@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#69793}
>
> TBR=bbudge@chromium.org,ahaas@chromium.org,zhin@chromium.org
>
> Change-Id: I3a90c616109ca048691d97ab45698bc15a678e18
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: v8:10835
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2402379
> Reviewed-by: Shu-yu Guo <syg@chromium.org>
> Commit-Queue: Shu-yu Guo <syg@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#69794}
TBR=bbudge@chromium.org,ahaas@chromium.org,zhin@chromium.org,syg@chromium.org
# Not skipping CQ checks because this is a reland.
Bug: v8:10835
Change-Id: I3d87dd2adba6ada2ec3ebf5e13bff378a74b03e8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2402386
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69817}
2020-09-10 00:16:53 +00:00
|
|
|
for rel_filename in $(find . -name '*.wast'); do
|
|
|
|
abs_filename=$(realpath $rel_filename)
|
2019-08-27 14:14:34 +00:00
|
|
|
spec_filename=${TMP_DIR}/spec/test/core/${rel_filename}
|
2019-07-17 14:49:47 +00:00
|
|
|
if [ ! -f "$spec_filename" ] || ! cmp -s $abs_filename $spec_filename ; then
|
|
|
|
log_and_run cp ${rel_filename} ${SPEC_TEST_DIR}/tests/proposals/${repo}/
|
|
|
|
log_and_run ./run.py --wasm ../../interpreter/wasm ${rel_filename} --out _build 2> /dev/null
|
|
|
|
fi
|
|
|
|
done
|
2020-05-25 06:06:14 +00:00
|
|
|
|
|
|
|
if ls _build/*.js > /dev/null; then
|
|
|
|
log_and_run cp _build/*.js ${SPEC_TEST_DIR}/tests/proposals/${repo}/
|
|
|
|
fi
|
2019-08-27 14:14:34 +00:00
|
|
|
|
|
|
|
echo ">> Process js-api tests"
|
|
|
|
log_and_run mkdir ${JS_API_TEST_DIR}/tests/proposals/${repo}
|
|
|
|
log_and_run cp -r ${TMP_DIR}/${repo}/test/js-api/* ${JS_API_TEST_DIR}/tests/proposals/${repo}
|
|
|
|
# Delete duplicate tests
|
|
|
|
log_and_run cd ${JS_API_TEST_DIR}/tests
|
|
|
|
for spec_test_name in $(find ./ -name '*.any.js' -not -wholename '*/proposals/*'); do
|
|
|
|
proposal_test_name="proposals/${repo}/${spec_test_name}"
|
|
|
|
if [ -f "$proposal_test_name" ] && cmp -s $spec_test_name $proposal_test_name ; then
|
|
|
|
log_and_run rm $proposal_test_name
|
|
|
|
elif [ -f "$proposal_test_name" ]; then
|
|
|
|
echo "keep" $proposal_test_name
|
|
|
|
fi
|
|
|
|
done
|
2019-07-17 14:49:47 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Report and cleanup.
|
|
|
|
###############################################################################
|
2017-04-27 13:46:07 +00:00
|
|
|
|
2017-12-08 14:49:40 +00:00
|
|
|
cd ${SPEC_TEST_DIR}
|
|
|
|
echo
|
|
|
|
echo "The following files will get uploaded:"
|
2019-07-17 14:49:47 +00:00
|
|
|
ls -R tests
|
2017-12-08 14:49:40 +00:00
|
|
|
echo
|
2018-01-24 12:58:41 +00:00
|
|
|
|
2019-08-27 14:14:34 +00:00
|
|
|
cd ${JS_API_TEST_DIR}
|
|
|
|
ls -R tests
|
|
|
|
echo
|
|
|
|
|
2019-07-17 14:49:47 +00:00
|
|
|
log_and_run rm -rf ${TMP_DIR}
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Upload all spec tests.
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
echo "****************************************************************************"
|
|
|
|
echo "* For the following command you first have to authenticate with google cloud"
|
|
|
|
echo "* storage. For that you have to execute"
|
|
|
|
echo "*"
|
|
|
|
echo "* > gsutil.py config"
|
|
|
|
echo "*"
|
|
|
|
echo "* When the script asks you for your project-id, use 0."
|
|
|
|
echo "****************************************************************************"
|
|
|
|
log_and_run cd ${SPEC_TEST_DIR}
|
|
|
|
log_and_run upload_to_google_storage.py -a -b v8-wasm-spec-tests tests
|
2019-08-27 14:14:34 +00:00
|
|
|
|
|
|
|
log_and_run cd ${JS_API_TEST_DIR}
|
|
|
|
log_and_run upload_to_google_storage.py -a -b v8-wasm-spec-tests tests
|