mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-12-07 23:03:41 +00:00
fix: enhance test case execution handling in test_wamr.sh (#4712)
This commit is contained in:
parent
6d6386992a
commit
ea9e11c88f
|
|
@ -5,10 +5,12 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Run script like DEBUG=1 ./test_wamr.sh ... to enable debug mode
|
||||||
function DEBUG() {
|
function DEBUG() {
|
||||||
[[ -n $(env | grep "\<DEBUG\>") ]] && $@
|
env | grep -q "\<DEBUG\>" && "$@"
|
||||||
}
|
}
|
||||||
DEBUG set -exv pipefail
|
DEBUG set -exv
|
||||||
|
DEBUG set -o pipefail
|
||||||
|
|
||||||
function help()
|
function help()
|
||||||
{
|
{
|
||||||
|
|
@ -996,6 +998,18 @@ function do_execute_in_running_mode()
|
||||||
|
|
||||||
function trigger()
|
function trigger()
|
||||||
{
|
{
|
||||||
|
# return if TEST_CASE_ARR is empty
|
||||||
|
if [[ -z "${TEST_CASE_ARR[@]}" ]]; then
|
||||||
|
echo "TEST_CASE_ARR is empty, NO test case to run"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print all the test cases to be executed
|
||||||
|
echo "Following test cases to be executed: "
|
||||||
|
for suite in "${TEST_CASE_ARR[@]}"; do
|
||||||
|
echo " - " $suite"_test"
|
||||||
|
done
|
||||||
|
|
||||||
# Check if REQUIREMENT_NAME is set, if set, only calling requirement test and early return
|
# Check if REQUIREMENT_NAME is set, if set, only calling requirement test and early return
|
||||||
if [[ -n $REQUIREMENT_NAME ]]; then
|
if [[ -n $REQUIREMENT_NAME ]]; then
|
||||||
python ${REQUIREMENT_SCRIPT_DIR}/run_requirement.py -o ${REPORT_DIR}/ -r "$REQUIREMENT_NAME" "${SUBREQUIREMENT_IDS[@]}"
|
python ${REQUIREMENT_SCRIPT_DIR}/run_requirement.py -o ${REPORT_DIR}/ -r "$REQUIREMENT_NAME" "${SUBREQUIREMENT_IDS[@]}"
|
||||||
|
|
@ -1187,6 +1201,19 @@ function trigger()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remove_empty_elements()
|
||||||
|
{
|
||||||
|
# Remove empty elements from the array
|
||||||
|
local arr=("$@")
|
||||||
|
local new_arr=()
|
||||||
|
for element in "${arr[@]}"; do
|
||||||
|
if [[ -n "$element" ]]; then
|
||||||
|
new_arr+=("$element")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "${new_arr[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $TEST_CASE_ARR ]];then
|
if [[ $TEST_CASE_ARR ]];then
|
||||||
# Check if 'unit' is in TEST_CASE_ARR
|
# Check if 'unit' is in TEST_CASE_ARR
|
||||||
if [[ " ${TEST_CASE_ARR[@]} " =~ " unit " ]]; then
|
if [[ " ${TEST_CASE_ARR[@]} " =~ " unit " ]]; then
|
||||||
|
|
@ -1194,14 +1221,12 @@ if [[ $TEST_CASE_ARR ]];then
|
||||||
# and run under specific modes.
|
# and run under specific modes.
|
||||||
# There is no need to loop through all running modes in this script.
|
# There is no need to loop through all running modes in this script.
|
||||||
unit_test || (echo "TEST FAILED"; exit 1)
|
unit_test || (echo "TEST FAILED"; exit 1)
|
||||||
if [[ ${COLLECT_CODE_COVERAGE} == 1 ]]; then
|
collect_coverage unit
|
||||||
collect_coverage unit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# remove 'unit' from TEST_CASE_ARR
|
# remove 'unit' from TEST_CASE_ARR
|
||||||
TEST_CASE_ARR=("${TEST_CASE_ARR[@]/unit}")
|
TEST_CASE_ARR=("${TEST_CASE_ARR[@]/unit}")
|
||||||
# remove empty elements from TEST_CASE_ARR
|
# remove empty elements from TEST_CASE_ARR
|
||||||
TEST_CASE_ARR=("${TEST_CASE_ARR[@]:-}")
|
TEST_CASE_ARR=($(remove_empty_elements "${TEST_CASE_ARR[@]}"))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# loop others through all running modes
|
# loop others through all running modes
|
||||||
|
|
@ -1223,6 +1248,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "Test finish. Reports are under ${REPORT_DIR}"
|
echo -e "Test finish. Reports are under ${REPORT_DIR}"
|
||||||
DEBUG set +exv pipefail
|
DEBUG set +exv
|
||||||
|
DEBUG set +o pipefail
|
||||||
echo "TEST SUCCESSFUL"
|
echo "TEST SUCCESSFUL"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user