Update test_wamr.sh to support full unit tests

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>
This commit is contained in:
zhenweijin 2026-04-17 13:08:15 +08:00
parent 38ff8a778d
commit ca48a0fc79

View File

@ -46,6 +46,7 @@ function help()
(e.g., ubsan, tsan, asan, posan)." (e.g., ubsan, tsan, asan, posan)."
echo "-A use the specified wamrc command instead of building it" echo "-A use the specified wamrc command instead of building it"
echo "-N enable extended const expression feature" echo "-N enable extended const expression feature"
echo "-U enable full unit test (passes FULL_TEST=ON to cmake when -s unit is used)"
echo "-r [requirement name] [N [N ...]] specify a requirement name followed by one or more" echo "-r [requirement name] [N [N ...]] specify a requirement name followed by one or more"
echo " subrequirement IDs, if no subrequirement is specificed," echo " subrequirement IDs, if no subrequirement is specificed,"
echo " it will run all subrequirements. When this optin is used," echo " it will run all subrequirements. When this optin is used,"
@ -71,6 +72,7 @@ ENABLE_XIP=0
ENABLE_EH=0 ENABLE_EH=0
ENABLE_DEBUG_VERSION=0 ENABLE_DEBUG_VERSION=0
ENABLE_GC_HEAP_VERIFY=0 ENABLE_GC_HEAP_VERIFY=0
UNIT_FULL_TEST=0
#unit test case arrary #unit test case arrary
TEST_CASE_ARR=() TEST_CASE_ARR=()
SGX_OPT="" SGX_OPT=""
@ -93,7 +95,7 @@ REQUIREMENT_NAME=""
# Initialize an empty array for subrequirement IDs # Initialize an empty array for subrequirement IDs
SUBREQUIREMENT_IDS=() SUBREQUIREMENT_IDS=()
while getopts ":s:cabgvt:m:MCpSXexwWEPGQF:j:T:r:A:N" opt while getopts ":s:cabgvt:m:MCpSXexwWEPGQF:j:T:r:A:NU" opt
do do
OPT_PARSED="TRUE" OPT_PARSED="TRUE"
case $opt in case $opt in
@ -201,6 +203,10 @@ do
echo "enable extended const expression feature" echo "enable extended const expression feature"
ENABLE_EXTENDED_CONST_EXPR=1 ENABLE_EXTENDED_CONST_EXPR=1
;; ;;
U)
echo "enable full unit test (FULL_TEST=ON)"
UNIT_FULL_TEST=1
;;
P) P)
PARALLELISM=1 PARALLELISM=1
;; ;;
@ -336,7 +342,9 @@ function unit_test()
echo "Build unit test" echo "Build unit test"
touch ${REPORT_DIR}/unit_test_report.txt touch ${REPORT_DIR}/unit_test_report.txt
cmake -S ${WORK_DIR}/../../unit -B unittest-build \ cmake -S ${WORK_DIR}/../../unit -B unittest-build \
-DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE} -DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE} \
-DFULL_TEST=${UNIT_FULL_TEST} \
-DWAMRC_COMPILER_DIR=${WAMR_DIR}/wamr-compiler/build
cmake --build unittest-build cmake --build unittest-build
ctest --test-dir unittest-build --output-on-failure | tee -a ${REPORT_DIR}/unit_test_report.txt ctest --test-dir unittest-build --output-on-failure | tee -a ${REPORT_DIR}/unit_test_report.txt