@@ -13,18 +13,54 @@ readonly PLATFORM=$(uname -s | tr A-Z a-z)
13
13
readonly WAMR_DIR=" ${WORK_DIR} /../../../.."
14
14
readonly IWASM_CMD=" ${WORK_DIR} /../../../../product-mini/platforms/${PLATFORM} /build/iwasm"
15
15
readonly WAMRC_CMD=" ${WORK_DIR} /../../../../wamr-compiler/build/wamrc"
16
+ readonly C_TESTS=" tests/c/testsuite/"
17
+ readonly ASSEMBLYSCRIPT_TESTS=" tests/assemblyscript/testsuite/"
18
+ readonly THREAD_PROPOSAL_TESTS=" tests/proposals/wasi-threads/"
19
+ readonly THREAD_INTERNAL_TESTS=" ${WAMR_DIR} /core/iwasm/libraries/lib-wasi-threads/test/"
20
+ readonly LIB_SOCKET_TESTS=" ${WAMR_DIR} /core/iwasm/libraries/lib-socket/test/"
21
+
22
+ run_aot_tests () {
23
+ local tests=(" $@ " )
24
+ for test_wasm in ${tests[@]} ; do
25
+ test_aot=" ${test_wasm% .wasm} .aot"
26
+ test_json=" ${test_wasm% .wasm} .json"
27
+
28
+ if [ -f ${test_wasm} ]; then
29
+ expected=$( jq .exit_code ${test_json} )
30
+ fi
31
+
32
+ echo " Compiling $test_wasm to $test_aot "
33
+ ${WAMRC_CMD} --enable-multi-thread ${target_option} \
34
+ -o ${test_aot} ${test_wasm}
35
+
36
+ echo " Running $test_aot "
37
+ expected=0
38
+ if [ -f ${test_json} ]; then
39
+ expected=$( jq .exit_code ${test_json} )
40
+ fi
41
+
42
+ ${IWASM_CMD} $test_aot
43
+
44
+ ret=${PIPESTATUS[0]}
45
+
46
+ echo " expected=$expected , actual=$ret "
47
+ if [[ $expected != " " ]] && [[ $expected != $ret ]]; then
48
+ exit_code=1
49
+ fi
50
+ done
51
+ }
16
52
17
53
if [[ $MODE != " aot" ]]; then
18
54
python3 -m venv wasi-env && source wasi-env/bin/activate
19
55
python3 -m pip install -r test-runner/requirements.txt
20
56
TEST_RUNTIME_EXE=" ${IWASM_CMD} " python3 test-runner/wasi_test_runner.py \
21
57
-r adapters/wasm-micro-runtime.py \
22
58
-t \
23
- tests/c/testsuite/ \
24
- tests/assemblyscript/testsuite/ \
25
- tests/proposals/wasi-threads/ \
26
- ${WAMR_DIR} /core/iwasm/libraries/lib-wasi-threads/test/ \
27
- ${WAMR_DIR} /core/iwasm/libraries/lib-socket/test/ \
59
+ ${C_TESTS} \
60
+ ${ASSEMBLYSCRIPT_TESTS} \
61
+ ${THREAD_PROPOSAL_TESTS} \
62
+ ${THREAD_INTERNAL_TESTS} \
63
+ ${LIB_SOCKET_TESTS} \
28
64
exit_code=${PIPESTATUS[0]}
29
65
deactivate
30
66
else
33
69
target_option=" --target=i386"
34
70
fi
35
71
36
- # Run WASI thread proposal tests
37
72
exit_code=0
38
- wasm_tests=$( ls tests/proposals/wasi-threads/* .wasm)
39
- for test_wasm in ${wasm_tests} ; do
40
- test_aot=" ${test_wasm% .wasm} .aot"
41
- test_json=" ${test_wasm% .wasm} .json"
42
-
43
- echo " Compiling $test_wasm to $test_aot "
44
- ${WAMRC_CMD} --enable-multi-thread ${target_option} \
45
- -o $test_aot $test_wasm
46
-
47
- echo " Running $test_aot "
48
- expected=$( jq .exit_code ${test_json} )
49
- ${IWASM_CMD} $test_aot
50
- ret=${PIPESTATUS[0]}
51
-
52
- echo " expected=$expected , actual=$ret "
53
- if [[ $expected != " " ]] && [[ $expected != $ret ]]; then
54
- exit_code=1
55
- fi
73
+ for testsuite in ${THREAD_PROPOSAL_TESTS} ${THREAD_INTERNAL_TESTS} ; do
74
+ tests=$( ls ${testsuite} * .wasm)
75
+ tests_array=($tests )
76
+ run_aot_tests " ${tests_array[@]} "
56
77
done
57
78
fi
58
79
0 commit comments