@@ -1187,16 +1187,24 @@ function trigger()
11871187 done
11881188}
11891189
1190- # if collect code coverage, ignore -s, test all test cases.
1191- if [[ $TEST_CASE_ARR == " unit" ]]; then
1192- # unit test cases are designed with specific compilation flags
1193- # and run under specific modes.
1194- # There is no need to loop through all running modes in this script.
1195- unit_test || (echo " TEST FAILED" ; exit 1)
1196- collect_coverage unit
1197- echo " JUST SKIP UNIT TEST NOW"
1198- elif [[ $TEST_CASE_ARR == " spec" ]]; then
1199- # loop through all running modes
1190+ if [[ $TEST_CASE_ARR ]]; then
1191+ # Check if 'unit' is in TEST_CASE_ARR
1192+ if [[ " ${TEST_CASE_ARR[@]} " =~ " unit " ]]; then
1193+ # unit test cases are designed with specific compilation flags
1194+ # and run under specific modes.
1195+ # There is no need to loop through all running modes in this script.
1196+ unit_test || (echo " TEST FAILED" ; exit 1)
1197+ if [[ ${COLLECT_CODE_COVERAGE} == 1 ]]; then
1198+ collect_coverage unit
1199+ fi
1200+
1201+ # remove 'unit' from TEST_CASE_ARR
1202+ TEST_CASE_ARR=(" ${TEST_CASE_ARR[@]/ unit} " )
1203+ # remove empty elements from TEST_CASE_ARR
1204+ TEST_CASE_ARR=(" ${TEST_CASE_ARR[@]:- } " )
1205+ fi
1206+
1207+ # loop others through all running modes
12001208 trigger || (echo " TEST FAILED" ; exit 1)
12011209else
12021210 # test all suite, ignore polybench and libsodium because of long time cost
0 commit comments