Enhance spec test workflow to support x86_32 target (#787)

Enable test spec cases on x86_32 target when PR is created.
And Format shell script with [shellfmt](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format).
This commit is contained in:
liang.he
2021-10-15 17:05:07 +08:00
committed by GitHub
parent dd9b4e021e
commit b46b663c16
5 changed files with 136 additions and 69 deletions

View File

@ -7,7 +7,7 @@
# exit if meet an exception
function DEBUG() {
[[ -n $(env | grep "\<DEBUG\>") ]] && $@
[[ -n $(env | grep "\<DEBUG\>") ]] && $@
}
DEBUG set -xevu
@ -25,11 +25,11 @@ IWASM_CMD="../../../product-mini/platforms/${PLATFORM}/build/iwasm"
# "comments" is for runtest.py
IGNORE_LIST=(
"comments" "inline-module" "imports" "linking" "names"
"comments" "inline-module" "imports" "linking" "names"
)
readonly -a MULTI_MODULE_LIST=(
"imports" "linking"
"imports" "linking"
)
SGX_IGNORE_LIST=("conversions" "f32_bitwise" "f64_bitwise")
@ -37,14 +37,12 @@ SGX_IGNORE_LIST=("conversions" "f32_bitwise" "f64_bitwise")
# these cases run failed due to native stack overflow check failed
SGX_AOT_IGNORE_LIST=("call_indirect" "call" "fac" "skip-stack-guard-page")
function usage()
{
function usage() {
echo "Usage: all.sh [-t] [-m <x86_64|x86_32|ARMV7_VFP|THUMBV7_VFP>] [-M] [-x] [-S] [-r]"
exit 1
}
function run_case_w_aot()
{
function run_case_w_aot() {
local test_case=$1
echo "============> run ${test_case} with AOT"
python2.7 runtest.py \
@ -56,26 +54,25 @@ function run_case_w_aot()
${SGX_OPT} \
${SIMD_OPT} \
${REF_TYPES_OPT}
#--no_cleanup
#--no_cleanup
if [[ $? != 0 ]]; then
echo "============> run ${test_case} failed"
exit 1
fi
}
function run_case_wo_aot()
{
function run_case_wo_aot() {
local test_case=$1
echo "============> run ${test_case}"
python2.7 runtest.py \
--wast2wasm ${WAST2WASM_CMD} \
--interpreter ${IWASM_CMD} \
${SPEC_TEST_DIR}/${test_case}\
${SPEC_TEST_DIR}/${test_case} \
--aot-compiler ${WAMRC_CMD} \
${SGX_OPT} \
${SIMD_OPT} \
${REF_TYPES_OPT}
#--no_cleanup
#--no_cleanup
if [[ $? != 0 ]]; then
echo "============> run ${test_case} failed"
exit 1
@ -90,35 +87,33 @@ SIMD_OPT=""
REF_TYPES_OPT=""
while getopts ":Mm:txSr" opt; do
case $opt in
t) AOT=true ;;
m)
TARGET=$OPTARG
if [[ ${TARGET} == 'X86_32' ]];then
TARGET='i386'
elif [[ ${TARGET} == 'X86_64' ]];then
TARGET='x86_64'
elif [[ ${TARGET} == 'ARMV7_VFP' ]];then
TARGET='armv7'
elif [[ ${TARGET} == 'THUMBV7_VFP' ]];then
TARGET='thumbv7'
elif [[ ${TARGET} == 'RISCV64' || ${TARGET} == 'RISCV64_LP64D' ]];then
TARGET='riscv64_lp64d'
elif [[ ${TARGET} == 'RISCV64_LP64' ]];then
TARGET='riscv64_lp64'
else
usage
fi
;;
M) ENABLE_MULTI_MODULE=1 ;;
x) SGX_OPT="--sgx" ;;
S) SIMD_OPT="--simd" ;;
r) REF_TYPES_OPT="--ref_types" ;;
*) usage ;;
t) AOT=true ;;
m)
TARGET=$OPTARG
if [[ ${TARGET} == 'X86_32' ]]; then
TARGET='i386'
elif [[ ${TARGET} == 'X86_64' ]]; then
TARGET='x86_64'
elif [[ ${TARGET} == 'ARMV7_VFP' ]]; then
TARGET='armv7'
elif [[ ${TARGET} == 'THUMBV7_VFP' ]]; then
TARGET='thumbv7'
elif [[ ${TARGET} == 'RISCV64' || ${TARGET} == 'RISCV64_LP64D' ]]; then
TARGET='riscv64_lp64d'
elif [[ ${TARGET} == 'RISCV64_LP64' ]]; then
TARGET='riscv64_lp64'
else
usage
fi ;;
M) ENABLE_MULTI_MODULE=1 ;;
x) SGX_OPT="--sgx" ;;
S) SIMD_OPT="--simd" ;;
r) REF_TYPES_OPT="--ref_types" ;;
*) usage ;;
esac
done
function contain()
{
function contain() {
# [$1, $-1)
local list=${@:0:${#}}
# [$-1]
@ -126,14 +121,18 @@ function contain()
[[ ${list} =~ (^| )${item}($| ) ]] && return 0 || return 1
}
if [[ ${SGX_OPT} ]];then
if [[ ${SGX_OPT} ]]; then
IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
IGNORE_LIST+=("${SGX_IGNORE_LIST[@]}")
if [[ "true" == ${AOT} ]];then
if [[ "true" == ${AOT} ]]; then
IGNORE_LIST+=("${SGX_AOT_IGNORE_LIST[@]}")
fi
fi
if [[ ${TARGET} == "i386" ]]; then
IGNORE_LIST+=("float_exprs")
fi
declare -i COUNTER=0
for wast in $(find ${SPEC_TEST_DIR} -name "*.wast" -type f | sort -n); do
# remove a prefix spec/test/core/
@ -143,9 +142,9 @@ for wast in $(find ${SPEC_TEST_DIR} -name "*.wast" -type f | sort -n); do
echo "============> ignore ${wast}"
continue
else
[[ "true" == ${AOT} ]] && run_case_w_aot ${wast} \
|| run_case_wo_aot ${wast}
(( COUNTER += 1))
[[ "true" == ${AOT} ]] && run_case_w_aot ${wast} ||
run_case_wo_aot ${wast}
((COUNTER += 1))
fi
done
@ -154,7 +153,7 @@ if [[ "false" == ${AOT} && 1 == ${ENABLE_MULTI_MODULE} ]]; then
echo "============> run cases about multi module"
for wast in ${MULTI_MODULE_LIST[@]}; do
run_case_wo_aot ${wast}.wast
(( COUNTER += 1))
((COUNTER += 1))
done
fi

View File

@ -584,6 +584,11 @@ function trigger()
;;
"jit")
if [[ ${TARGET} == "X86_32" ]]; then
echo "does not support an X86_32 target in JIT mode, bypass"
continue
fi
echo "work in jit mode"
# jit
BUILD_FLAGS="$JIT_COMPILE_FLAGS $EXTRA_COMPILE_FLAGS"