fix: improve test case handling in test_wamr.sh (#4708)

Correct the error introduced by de4b950.
This commit is contained in:
liang.he 2025-11-17 17:53:06 +08:00 committed by GitHub
parent 951684c8dd
commit a41d343033
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1187,16 +1187,24 @@ function trigger()
done done
} }
# if collect code coverage, ignore -s, test all test cases. if [[ $TEST_CASE_ARR ]];then
if [[ $TEST_CASE_ARR == "unit" ]];then # Check if 'unit' is in TEST_CASE_ARR
# unit test cases are designed with specific compilation flags if [[ " ${TEST_CASE_ARR[@]} " =~ " unit " ]]; then
# and run under specific modes. # unit test cases are designed with specific compilation flags
# There is no need to loop through all running modes in this script. # and run under specific modes.
unit_test || (echo "TEST FAILED"; exit 1) # There is no need to loop through all running modes in this script.
collect_coverage unit unit_test || (echo "TEST FAILED"; exit 1)
echo "JUST SKIP UNIT TEST NOW" if [[ ${COLLECT_CODE_COVERAGE} == 1 ]]; then
elif [[ $TEST_CASE_ARR == "spec" ]];then collect_coverage unit
# loop through all running modes fi
# remove 'unit' from TEST_CASE_ARR
TEST_CASE_ARR=("${TEST_CASE_ARR[@]/unit}")
# remove empty elements from TEST_CASE_ARR
TEST_CASE_ARR=("${TEST_CASE_ARR[@]:-}")
fi
# loop others through all running modes
trigger || (echo "TEST FAILED"; exit 1) trigger || (echo "TEST FAILED"; exit 1)
else else
# test all suite, ignore polybench and libsodium because of long time cost # test all suite, ignore polybench and libsodium because of long time cost