mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-08 20:56:13 +00:00
Enable to run wasi-thread tests with AOT (#2026)
This commit is contained in:
parent
915b4d2a89
commit
23e9a356e5
|
@ -13,6 +13,42 @@ readonly PLATFORM=$(uname -s | tr A-Z a-z)
|
||||||
readonly WAMR_DIR="${WORK_DIR}/../../../.."
|
readonly WAMR_DIR="${WORK_DIR}/../../../.."
|
||||||
readonly IWASM_CMD="${WORK_DIR}/../../../../product-mini/platforms/${PLATFORM}/build/iwasm"
|
readonly IWASM_CMD="${WORK_DIR}/../../../../product-mini/platforms/${PLATFORM}/build/iwasm"
|
||||||
readonly WAMRC_CMD="${WORK_DIR}/../../../../wamr-compiler/build/wamrc"
|
readonly WAMRC_CMD="${WORK_DIR}/../../../../wamr-compiler/build/wamrc"
|
||||||
|
readonly C_TESTS="tests/c/testsuite/"
|
||||||
|
readonly ASSEMBLYSCRIPT_TESTS="tests/assemblyscript/testsuite/"
|
||||||
|
readonly THREAD_PROPOSAL_TESTS="tests/proposals/wasi-threads/"
|
||||||
|
readonly THREAD_INTERNAL_TESTS="${WAMR_DIR}/core/iwasm/libraries/lib-wasi-threads/test/"
|
||||||
|
readonly LIB_SOCKET_TESTS="${WAMR_DIR}/core/iwasm/libraries/lib-socket/test/"
|
||||||
|
|
||||||
|
run_aot_tests () {
|
||||||
|
local tests=("$@")
|
||||||
|
for test_wasm in ${tests[@]}; do
|
||||||
|
test_aot="${test_wasm%.wasm}.aot"
|
||||||
|
test_json="${test_wasm%.wasm}.json"
|
||||||
|
|
||||||
|
if [ -f ${test_wasm} ]; then
|
||||||
|
expected=$(jq .exit_code ${test_json})
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Compiling $test_wasm to $test_aot"
|
||||||
|
${WAMRC_CMD} --enable-multi-thread ${target_option} \
|
||||||
|
-o ${test_aot} ${test_wasm}
|
||||||
|
|
||||||
|
echo "Running $test_aot"
|
||||||
|
expected=0
|
||||||
|
if [ -f ${test_json} ]; then
|
||||||
|
expected=$(jq .exit_code ${test_json})
|
||||||
|
fi
|
||||||
|
|
||||||
|
${IWASM_CMD} $test_aot
|
||||||
|
|
||||||
|
ret=${PIPESTATUS[0]}
|
||||||
|
|
||||||
|
echo "expected=$expected, actual=$ret"
|
||||||
|
if [[ $expected != "" ]] && [[ $expected != $ret ]];then
|
||||||
|
exit_code=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $MODE != "aot" ]];then
|
if [[ $MODE != "aot" ]];then
|
||||||
python3 -m venv wasi-env && source wasi-env/bin/activate
|
python3 -m venv wasi-env && source wasi-env/bin/activate
|
||||||
|
@ -20,11 +56,11 @@ if [[ $MODE != "aot" ]];then
|
||||||
TEST_RUNTIME_EXE="${IWASM_CMD}" 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 \
|
-r adapters/wasm-micro-runtime.py \
|
||||||
-t \
|
-t \
|
||||||
tests/c/testsuite/ \
|
${C_TESTS} \
|
||||||
tests/assemblyscript/testsuite/ \
|
${ASSEMBLYSCRIPT_TESTS} \
|
||||||
tests/proposals/wasi-threads/ \
|
${THREAD_PROPOSAL_TESTS} \
|
||||||
${WAMR_DIR}/core/iwasm/libraries/lib-wasi-threads/test/ \
|
${THREAD_INTERNAL_TESTS} \
|
||||||
${WAMR_DIR}/core/iwasm/libraries/lib-socket/test/ \
|
${LIB_SOCKET_TESTS} \
|
||||||
exit_code=${PIPESTATUS[0]}
|
exit_code=${PIPESTATUS[0]}
|
||||||
deactivate
|
deactivate
|
||||||
else
|
else
|
||||||
|
@ -33,26 +69,11 @@ else
|
||||||
target_option="--target=i386"
|
target_option="--target=i386"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run WASI thread proposal tests
|
|
||||||
exit_code=0
|
exit_code=0
|
||||||
wasm_tests=$(ls tests/proposals/wasi-threads/*.wasm)
|
for testsuite in ${THREAD_PROPOSAL_TESTS} ${THREAD_INTERNAL_TESTS}; do
|
||||||
for test_wasm in ${wasm_tests}; do
|
tests=$(ls ${testsuite}*.wasm)
|
||||||
test_aot="${test_wasm%.wasm}.aot"
|
tests_array=($tests)
|
||||||
test_json="${test_wasm%.wasm}.json"
|
run_aot_tests "${tests_array[@]}"
|
||||||
|
|
||||||
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
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user