From 77de03c43977fa782929096d37d8780ddf6dda2e Mon Sep 17 00:00:00 2001 From: eloparco Date: Tue, 21 Feb 2023 00:17:07 +0000 Subject: [PATCH 1/7] feat(wasi-threads): update wasi thread tests in ci --- tests/wamr-test-suites/test_wamr.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/wamr-test-suites/test_wamr.sh b/tests/wamr-test-suites/test_wamr.sh index 342b3b9391..b9f365b274 100755 --- a/tests/wamr-test-suites/test_wamr.sh +++ b/tests/wamr-test-suites/test_wamr.sh @@ -46,7 +46,7 @@ PLATFORM=$(uname -s | tr A-Z a-z) PARALLELISM=0 ENABLE_QEMU=0 QEMU_FIRMWARE="" -WASI_TESTSUITE_COMMIT="1d913f28b3f0d92086d6f50405cf85768e648b54" +WASI_TESTSUITE_COMMIT="b18247e2161bea263fe924b8189c67b1d2d10a10" while getopts ":s:cabt:m:MCpSXxPQF:" opt do @@ -176,6 +176,7 @@ readonly CLASSIC_INTERP_COMPILE_FLAGS="\ -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0 \ -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 \ -DWAMR_BUILD_SPEC_TEST=1 \ + -DWAMR_BUILD_LIB_WASI_THREADS=1 \ -DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE}" readonly FAST_INTERP_COMPILE_FLAGS="\ @@ -183,6 +184,7 @@ readonly FAST_INTERP_COMPILE_FLAGS="\ -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1 \ -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 \ -DWAMR_BUILD_SPEC_TEST=1 \ + -DWAMR_BUILD_LIB_WASI_THREADS=1 \ -DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE}" # jit: report linking error if set COLLECT_CODE_COVERAGE, @@ -192,20 +194,23 @@ readonly ORC_EAGER_JIT_COMPILE_FLAGS="\ -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_INTERP=0 \ -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1 \ -DWAMR_BUILD_LAZY_JIT=0 \ - -DWAMR_BUILD_SPEC_TEST=1" + -DWAMR_BUILD_SPEC_TEST=1 \ + -DWAMR_BUILD_LIB_WASI_THREADS=1" readonly ORC_LAZY_JIT_COMPILE_FLAGS="\ -DWAMR_BUILD_TARGET=${TARGET} \ -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_INTERP=0 \ -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1 \ -DWAMR_BUILD_LAZY_JIT=1 \ - -DWAMR_BUILD_SPEC_TEST=1" + -DWAMR_BUILD_SPEC_TEST=1 \ + -DWAMR_BUILD_LIB_WASI_THREADS=1" readonly AOT_COMPILE_FLAGS="\ -DWAMR_BUILD_TARGET=${TARGET} \ -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_INTERP=0 \ -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=1 \ -DWAMR_BUILD_SPEC_TEST=1 \ + -DWAMR_BUILD_LIB_WASI_THREADS=1 \ -DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE}" readonly FAST_JIT_COMPILE_FLAGS="\ @@ -483,7 +488,7 @@ function wasi_certification_test() cd ${WORK_DIR} if [ ! -d "wasi-testsuite" ]; then echo "wasi not exist, clone it from github" - git clone -b prod/testsuite-base \ + git clone -b prod/testsuite-all \ --single-branch https://github.com/WebAssembly/wasi-testsuite.git fi cd wasi-testsuite @@ -491,12 +496,12 @@ function wasi_certification_test() python3 -m venv wasi-env && source wasi-env/bin/activate python3 -m pip install -r test-runner/requirements.txt - IWASM_PATH=$(dirname ${IWASM_CMD}) - PATH=${PATH}:${IWASM_PATH} python3 test-runner/wasi_test_runner.py \ - -r adapters/wasm-micro-runtime.sh \ + TEST_RUNTIME_EXE="${IWASM_CMD} -v=5" python3 test-runner/wasi_test_runner.py \ + -r adapters/wasm-micro-runtime.py \ -t \ tests/c/testsuite/ \ tests/assemblyscript/testsuite/ \ + tests/proposals/wasi-threads/ \ | tee -a ${REPORT_DIR}/wasi_test_report.txt exit_code=${PIPESTATUS[0]} deactivate From 8ec2eb084ba62df25757a2deb4e33316ad6d0c6f Mon Sep 17 00:00:00 2001 From: eloparco Date: Fri, 24 Feb 2023 10:30:06 +0000 Subject: [PATCH 2/7] feat: add option to use WASI threads in test runner --- .../compilation_on_android_ubuntu.yml | 2 +- tests/wamr-test-suites/test_wamr.sh | 23 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/compilation_on_android_ubuntu.yml b/.github/workflows/compilation_on_android_ubuntu.yml index 42871585d1..b3e7b65421 100644 --- a/.github/workflows/compilation_on_android_ubuntu.yml +++ b/.github/workflows/compilation_on_android_ubuntu.yml @@ -60,7 +60,7 @@ env: SIMD_TEST_OPTIONS: "-s spec -b -S -P" THREADS_TEST_OPTIONS: "-s spec -b -p -P" X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P" - WASI_TEST_OPTIONS: "-s wasi_certification" + WASI_TEST_OPTIONS: "-s wasi_certification -w" jobs: build_llvm_libraries_on_ubuntu_2004: diff --git a/tests/wamr-test-suites/test_wamr.sh b/tests/wamr-test-suites/test_wamr.sh index b9f365b274..c00fd6a986 100755 --- a/tests/wamr-test-suites/test_wamr.sh +++ b/tests/wamr-test-suites/test_wamr.sh @@ -26,6 +26,7 @@ function help() echo "-P run the spec test parallelly" echo "-Q enable qemu" echo "-F set the firmware path used by qemu" + echo "-w enable WASI threads" } OPT_PARSED="" @@ -34,6 +35,7 @@ WABT_BINARY_RELEASE="NO" TYPE=("classic-interp" "fast-interp" "jit" "aot" "fast-jit" "multi-tier-jit") #default target TARGET="X86_64" +ENABLE_WASI_THREADS=0 ENABLE_MULTI_MODULE=0 ENABLE_MULTI_THREAD=0 COLLECT_CODE_COVERAGE=0 @@ -48,7 +50,7 @@ ENABLE_QEMU=0 QEMU_FIRMWARE="" WASI_TESTSUITE_COMMIT="b18247e2161bea263fe924b8189c67b1d2d10a10" -while getopts ":s:cabt:m:MCpSXxPQF:" opt +while getopts ":s:cabt:m:wMCpSXxPQF:" opt do OPT_PARSED="TRUE" case $opt in @@ -98,6 +100,10 @@ do echo "set compile target of wamr" ${OPTARG} TARGET=${OPTARG^^} # set target to uppercase if input x86_32 or x86_64 --> X86_32 and X86_64 ;; + w) + echo "enable WASI threads" + ENABLE_WASI_THREADS=1 + ;; M) echo "enable multi module feature" ENABLE_MULTI_MODULE=1 @@ -176,7 +182,6 @@ readonly CLASSIC_INTERP_COMPILE_FLAGS="\ -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0 \ -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 \ -DWAMR_BUILD_SPEC_TEST=1 \ - -DWAMR_BUILD_LIB_WASI_THREADS=1 \ -DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE}" readonly FAST_INTERP_COMPILE_FLAGS="\ @@ -184,7 +189,6 @@ readonly FAST_INTERP_COMPILE_FLAGS="\ -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1 \ -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 \ -DWAMR_BUILD_SPEC_TEST=1 \ - -DWAMR_BUILD_LIB_WASI_THREADS=1 \ -DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE}" # jit: report linking error if set COLLECT_CODE_COVERAGE, @@ -194,23 +198,20 @@ readonly ORC_EAGER_JIT_COMPILE_FLAGS="\ -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_INTERP=0 \ -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1 \ -DWAMR_BUILD_LAZY_JIT=0 \ - -DWAMR_BUILD_SPEC_TEST=1 \ - -DWAMR_BUILD_LIB_WASI_THREADS=1" + -DWAMR_BUILD_SPEC_TEST=1" readonly ORC_LAZY_JIT_COMPILE_FLAGS="\ -DWAMR_BUILD_TARGET=${TARGET} \ -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_INTERP=0 \ -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1 \ -DWAMR_BUILD_LAZY_JIT=1 \ - -DWAMR_BUILD_SPEC_TEST=1 \ - -DWAMR_BUILD_LIB_WASI_THREADS=1" + -DWAMR_BUILD_SPEC_TEST=1" readonly AOT_COMPILE_FLAGS="\ -DWAMR_BUILD_TARGET=${TARGET} \ -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_INTERP=0 \ -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=1 \ -DWAMR_BUILD_SPEC_TEST=1 \ - -DWAMR_BUILD_LIB_WASI_THREADS=1 \ -DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE}" readonly FAST_JIT_COMPILE_FLAGS="\ @@ -646,6 +647,12 @@ function trigger() EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SIMD=0" fi + if [[ ${ENABLE_WASI_THREADS} == 1 ]]; then + EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_LIB_WASI_THREADS=1" + else + EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_LIB_WASI_THREADS=0" + fi + for t in "${TYPE[@]}"; do case $t in "classic-interp") From 8f1d09b5b450e35c306c36fe6df6526fc39c95c7 Mon Sep 17 00:00:00 2001 From: Marcin Kolny Date: Fri, 24 Feb 2023 14:47:14 +0000 Subject: [PATCH 3/7] Disable verbose output for wasi tests Some of the wasi tests validate the standard output from the runtime; enabling verbose output pollutes stdout therefore assertions will fail. --- tests/wamr-test-suites/test_wamr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wamr-test-suites/test_wamr.sh b/tests/wamr-test-suites/test_wamr.sh index c00fd6a986..0140cb3b1f 100755 --- a/tests/wamr-test-suites/test_wamr.sh +++ b/tests/wamr-test-suites/test_wamr.sh @@ -497,7 +497,7 @@ function wasi_certification_test() python3 -m venv wasi-env && source wasi-env/bin/activate python3 -m pip install -r test-runner/requirements.txt - TEST_RUNTIME_EXE="${IWASM_CMD} -v=5" python3 test-runner/wasi_test_runner.py \ + TEST_RUNTIME_EXE=${IWASM_CMD} python3 test-runner/wasi_test_runner.py \ -r adapters/wasm-micro-runtime.py \ -t \ tests/c/testsuite/ \ From fb8c4e51ab7238b78f48edbcdb8ff883f8aa7151 Mon Sep 17 00:00:00 2001 From: eloparco Date: Fri, 24 Feb 2023 16:20:36 +0000 Subject: [PATCH 4/7] feat(wasi-threads): execute WASI proposal tests in AOT mode --- .../compilation_on_android_ubuntu.yml | 7 +-- tests/wamr-test-suites/test_wamr.sh | 45 ++++++++++++++----- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/.github/workflows/compilation_on_android_ubuntu.yml b/.github/workflows/compilation_on_android_ubuntu.yml index b3e7b65421..a6db692dfd 100644 --- a/.github/workflows/compilation_on_android_ubuntu.yml +++ b/.github/workflows/compilation_on_android_ubuntu.yml @@ -469,9 +469,6 @@ jobs: # aot and jit don't support multi module - running_mode: "aot" test_option: $MULTI_MODULES_TEST_OPTIONS - # aot is WAMR-specific while wasi-testsuite is generic - - running_mode: "aot" - test_option: $WASI_TEST_OPTIONS - running_mode: "jit" test_option: $MULTI_MODULES_TEST_OPTIONS # fast-jit doesn't support multi module, simd, and threads @@ -521,6 +518,10 @@ jobs: if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true' run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + - name: install jq JSON processor + if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS' + run: sudo apt-get update && sudo apt install -y jq + - name: run tests run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} working-directory: ./tests/wamr-test-suites diff --git a/tests/wamr-test-suites/test_wamr.sh b/tests/wamr-test-suites/test_wamr.sh index 0140cb3b1f..9097a86244 100755 --- a/tests/wamr-test-suites/test_wamr.sh +++ b/tests/wamr-test-suites/test_wamr.sh @@ -495,17 +495,42 @@ function wasi_certification_test() cd wasi-testsuite git reset --hard ${WASI_TESTSUITE_COMMIT} - python3 -m venv wasi-env && source wasi-env/bin/activate - python3 -m pip install -r test-runner/requirements.txt - TEST_RUNTIME_EXE=${IWASM_CMD} python3 test-runner/wasi_test_runner.py \ - -r adapters/wasm-micro-runtime.py \ - -t \ - tests/c/testsuite/ \ - tests/assemblyscript/testsuite/ \ - tests/proposals/wasi-threads/ \ + if [[ $1 != "aot" ]];then + python3 -m venv wasi-env && source wasi-env/bin/activate + python3 -m pip install -r test-runner/requirements.txt + TEST_RUNTIME_EXE="${IWASM_CMD}" python3 test-runner/wasi_test_runner.py \ + -r adapters/wasm-micro-runtime.py \ + -t \ + tests/c/testsuite/ \ + tests/assemblyscript/testsuite/ \ + tests/proposals/wasi-threads/ \ + | tee -a ${REPORT_DIR}/wasi_test_report.txt + exit_code=${PIPESTATUS[0]} + deactivate + else + # Run WASI thread proposal tests + exit_code=0 + wasm_tests=$(ls tests/proposals/wasi-threads/*.wasm) + for test_wasm in ${wasm_tests}; do + test_aot="${test_wasm%.wasm}.aot" + test_json="${test_wasm%.wasm}.json" + + echo "Compiling $test_wasm to $test_aot" + ${WAMRC_CMD} --enable-multi-thread -o $test_aot $test_wasm \ + | tee -a ${REPORT_DIR}/wasi_test_report.txt + + echo "Running $test_aot" + expected=$(jq .exit_code ${test_json}) + ${IWASM_CMD} -v=5 $test_aot \ | tee -a ${REPORT_DIR}/wasi_test_report.txt - exit_code=${PIPESTATUS[0]} - deactivate + ret=${PIPESTATUS[0]} + + echo "expected=$expected, actual=$ret" + if [[ $expected != "" ]] && [[ $expected != $ret ]];then + exit_code=1 + fi + done + fi if [[ ${exit_code} -ne 0 ]];then echo -e "\nwasi tests FAILED" | tee -a ${REPORT_DIR}/wasi_test_report.txt From 89350b510240f4cbd01769b75f699f4bb7b2d30d Mon Sep 17 00:00:00 2001 From: eloparco Date: Sun, 26 Feb 2023 02:11:10 +0000 Subject: [PATCH 5/7] fix(aot): specify compiler target in WASI AOT tests --- tests/wamr-test-suites/test_wamr.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/wamr-test-suites/test_wamr.sh b/tests/wamr-test-suites/test_wamr.sh index 9097a86244..fcd76fc309 100755 --- a/tests/wamr-test-suites/test_wamr.sh +++ b/tests/wamr-test-suites/test_wamr.sh @@ -508,6 +508,11 @@ function wasi_certification_test() exit_code=${PIPESTATUS[0]} deactivate else + target_option="" + if [[ $TARGET == "X86_32" ]];then + target_option="--target=i386" + fi + # Run WASI thread proposal tests exit_code=0 wasm_tests=$(ls tests/proposals/wasi-threads/*.wasm) @@ -516,12 +521,13 @@ function wasi_certification_test() test_json="${test_wasm%.wasm}.json" echo "Compiling $test_wasm to $test_aot" - ${WAMRC_CMD} --enable-multi-thread -o $test_aot $test_wasm \ + ${WAMRC_CMD} --enable-multi-thread ${target_option} \ + -o $test_aot $test_wasm \ | tee -a ${REPORT_DIR}/wasi_test_report.txt echo "Running $test_aot" expected=$(jq .exit_code ${test_json}) - ${IWASM_CMD} -v=5 $test_aot \ + ${IWASM_CMD} $test_aot \ | tee -a ${REPORT_DIR}/wasi_test_report.txt ret=${PIPESTATUS[0]} From 32b5d1b83192e18f6c805377ab1edbd1e001f6bf Mon Sep 17 00:00:00 2001 From: eloparco Date: Sun, 26 Feb 2023 03:13:14 +0000 Subject: [PATCH 6/7] fix: do not run wasi tests in fast-jit and multi-tier mode --- .github/workflows/compilation_on_android_ubuntu.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/compilation_on_android_ubuntu.yml b/.github/workflows/compilation_on_android_ubuntu.yml index a6db692dfd..6715706aa3 100644 --- a/.github/workflows/compilation_on_android_ubuntu.yml +++ b/.github/workflows/compilation_on_android_ubuntu.yml @@ -478,6 +478,8 @@ jobs: test_option: $SIMD_TEST_OPTIONS - running_mode: "fast-jit" test_option: $THREADS_TEST_OPTIONS + - running_mode: "fast-jit" + test_option: $WASI_TEST_OPTIONS # multi-tier-jit doesn't support multi module, simd, and threads - running_mode: "multi-tier-jit" test_option: $MULTI_MODULES_TEST_OPTIONS @@ -485,6 +487,8 @@ jobs: test_option: $SIMD_TEST_OPTIONS - running_mode: "multi-tier-jit" test_option: $THREADS_TEST_OPTIONS + - running_mode: "multi-tier-jit" + test_option: $WASI_TEST_OPTIONS steps: - name: checkout uses: actions/checkout@v3 From b7d30aa3840175397785f7c8cfc814b5ab3ba1e7 Mon Sep 17 00:00:00 2001 From: eloparco Date: Sun, 26 Feb 2023 03:14:38 +0000 Subject: [PATCH 7/7] refactor: move wasi test logic to separate script --- tests/wamr-test-suites/test_wamr.sh | 47 ++-------------- .../wasi-test-script/run_wasi_tests.sh | 56 +++++++++++++++++++ 2 files changed, 60 insertions(+), 43 deletions(-) create mode 100755 tests/wamr-test-suites/wasi-test-script/run_wasi_tests.sh diff --git a/tests/wamr-test-suites/test_wamr.sh b/tests/wamr-test-suites/test_wamr.sh index fcd76fc309..c220e6b39f 100755 --- a/tests/wamr-test-suites/test_wamr.sh +++ b/tests/wamr-test-suites/test_wamr.sh @@ -495,50 +495,11 @@ function wasi_certification_test() cd wasi-testsuite git reset --hard ${WASI_TESTSUITE_COMMIT} - if [[ $1 != "aot" ]];then - python3 -m venv wasi-env && source wasi-env/bin/activate - python3 -m pip install -r test-runner/requirements.txt - TEST_RUNTIME_EXE="${IWASM_CMD}" python3 test-runner/wasi_test_runner.py \ - -r adapters/wasm-micro-runtime.py \ - -t \ - tests/c/testsuite/ \ - tests/assemblyscript/testsuite/ \ - tests/proposals/wasi-threads/ \ - | tee -a ${REPORT_DIR}/wasi_test_report.txt - exit_code=${PIPESTATUS[0]} - deactivate - else - target_option="" - if [[ $TARGET == "X86_32" ]];then - target_option="--target=i386" - fi - - # Run WASI thread proposal tests - exit_code=0 - wasm_tests=$(ls tests/proposals/wasi-threads/*.wasm) - for test_wasm in ${wasm_tests}; do - test_aot="${test_wasm%.wasm}.aot" - test_json="${test_wasm%.wasm}.json" - - echo "Compiling $test_wasm to $test_aot" - ${WAMRC_CMD} --enable-multi-thread ${target_option} \ - -o $test_aot $test_wasm \ - | tee -a ${REPORT_DIR}/wasi_test_report.txt - - echo "Running $test_aot" - expected=$(jq .exit_code ${test_json}) - ${IWASM_CMD} $test_aot \ - | tee -a ${REPORT_DIR}/wasi_test_report.txt - ret=${PIPESTATUS[0]} - - echo "expected=$expected, actual=$ret" - if [[ $expected != "" ]] && [[ $expected != $ret ]];then - exit_code=1 - fi - done - fi + bash ../../wasi-test-script/run_wasi_tests.sh $1 $TARGET \ + | tee -a ${REPORT_DIR}/wasi_test_report.txt + ret=${PIPESTATUS[0]} - if [[ ${exit_code} -ne 0 ]];then + if [[ ${ret} -ne 0 ]];then echo -e "\nwasi tests FAILED" | tee -a ${REPORT_DIR}/wasi_test_report.txt exit 1 fi diff --git a/tests/wamr-test-suites/wasi-test-script/run_wasi_tests.sh b/tests/wamr-test-suites/wasi-test-script/run_wasi_tests.sh new file mode 100755 index 0000000000..cd3fe18752 --- /dev/null +++ b/tests/wamr-test-suites/wasi-test-script/run_wasi_tests.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# +# Copyright (C) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# + +readonly MODE=$1 +readonly TARGET=$2 + +readonly WORK_DIR=$PWD +readonly PLATFORM=$(uname -s | tr A-Z a-z) +readonly IWASM_CMD="${WORK_DIR}/../../../../product-mini/platforms/${PLATFORM}/build/iwasm" +readonly WAMRC_CMD="${WORK_DIR}/../../../../wamr-compiler/build/wamrc" + +if [[ $MODE != "aot" ]];then + python3 -m venv wasi-env && source wasi-env/bin/activate + python3 -m pip install -r test-runner/requirements.txt + TEST_RUNTIME_EXE="${IWASM_CMD}" python3 test-runner/wasi_test_runner.py \ + -r adapters/wasm-micro-runtime.py \ + -t \ + tests/c/testsuite/ \ + tests/assemblyscript/testsuite/ \ + tests/proposals/wasi-threads/ + exit_code=${PIPESTATUS[0]} + deactivate +else + target_option="" + if [[ $TARGET == "X86_32" ]];then + target_option="--target=i386" + fi + + # Run WASI thread proposal tests + exit_code=0 + wasm_tests=$(ls tests/proposals/wasi-threads/*.wasm) + for test_wasm in ${wasm_tests}; do + test_aot="${test_wasm%.wasm}.aot" + test_json="${test_wasm%.wasm}.json" + + echo "Compiling $test_wasm to $test_aot" + ${WAMRC_CMD} --enable-multi-thread ${target_option} \ + -o $test_aot $test_wasm + + echo "Running $test_aot" + expected=$(jq .exit_code ${test_json}) + ${IWASM_CMD} $test_aot + ret=${PIPESTATUS[0]} + + echo "expected=$expected, actual=$ret" + if [[ $expected != "" ]] && [[ $expected != $ret ]];then + exit_code=1 + fi + done +fi + +exit ${exit_code} \ No newline at end of file