mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 15:32:05 +00:00
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:
parent
dd9b4e021e
commit
b46b663c16
86
.github/workflows/spec_test.yml
vendored
86
.github/workflows/spec_test.yml
vendored
|
@ -33,7 +33,12 @@ concurrency:
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
DEFAULT_TEST_OPTIONS: "-s spec"
|
||||||
LLVM_CACHE_SUFFIX: "build-llvm_libraries"
|
LLVM_CACHE_SUFFIX: "build-llvm_libraries"
|
||||||
|
MULTI_MODULES_TEST_OPTIONS: "-s spec -M"
|
||||||
|
SIMD_TEST_OPTIONS: "-s spec -S"
|
||||||
|
THREADS_TEST_OPTIONS: "-s spec -p"
|
||||||
|
X86_32_TARGET_TEST_OPTIONS: "-m x86_32"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cancel_previous:
|
cancel_previous:
|
||||||
|
@ -70,21 +75,12 @@ jobs:
|
||||||
run: mv LLVM-13.0.0-*.tar.gz LLVM-13.0.0.tar.gz
|
run: mv LLVM-13.0.0-*.tar.gz LLVM-13.0.0.tar.gz
|
||||||
working-directory: core/deps/llvm/build/
|
working-directory: core/deps/llvm/build/
|
||||||
|
|
||||||
spec_test_on_ubuntu_2004:
|
spec_test_default:
|
||||||
needs: build_llvm_libraries
|
needs: build_llvm_libraries
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
test_option: [
|
test_option: [ $DEFAULT_TEST_OPTIONS, $SIMD_TEST_OPTIONS ]
|
||||||
# DEFAULT
|
|
||||||
"-s spec",
|
|
||||||
# SIMD
|
|
||||||
"-s spec -S",
|
|
||||||
# THREAD
|
|
||||||
"-s spec -p",
|
|
||||||
# MULTI_MODULES
|
|
||||||
"-s spec -M",
|
|
||||||
]
|
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -111,3 +107,71 @@ jobs:
|
||||||
- name: run spec tests
|
- name: run spec tests
|
||||||
run: ./test_wamr.sh ${{ matrix.test_option }}
|
run: ./test_wamr.sh ${{ matrix.test_option }}
|
||||||
working-directory: ./tests/wamr-test-suites
|
working-directory: ./tests/wamr-test-suites
|
||||||
|
|
||||||
|
spec_test_extra:
|
||||||
|
needs: build_llvm_libraries
|
||||||
|
if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }}
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
test_option: [ $MULTI_MODULES_TEST_OPTIONS, $THREADS_TEST_OPTIONS ]
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Get LLVM libraries
|
||||||
|
id: cache_llvm
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ./core/deps/llvm/build/LLVM-13.0.0.tar.gz
|
||||||
|
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
|
||||||
|
restore-keys: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
|
||||||
|
|
||||||
|
- name: Quit if cache miss
|
||||||
|
if: steps.cache_llvm.outputs.cache-hit != 'true'
|
||||||
|
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||||
|
|
||||||
|
- name: Extract the LLVM package
|
||||||
|
run: tar xf LLVM-13.0.0.tar.gz --strip-components=1
|
||||||
|
working-directory: ./core/deps/llvm/build
|
||||||
|
|
||||||
|
- name: install Ninja
|
||||||
|
run: sudo apt install -y ninja-build
|
||||||
|
|
||||||
|
- name: run spec tests
|
||||||
|
run: ./test_wamr.sh ${{ matrix.test_option }}
|
||||||
|
working-directory: ./tests/wamr-test-suites
|
||||||
|
|
||||||
|
spec_test_x86_32:
|
||||||
|
if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }}
|
||||||
|
needs: build_llvm_libraries
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
test_option: [ $DEFAULT_TEST_OPTIONS, $THREADS_TEST_OPTIONS ]
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Get LLVM libraries
|
||||||
|
id: cache_llvm
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ./core/deps/llvm/build/LLVM-13.0.0.tar.gz
|
||||||
|
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
|
||||||
|
restore-keys: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
|
||||||
|
|
||||||
|
- name: Quit if cache miss
|
||||||
|
if: steps.cache_llvm.outputs.cache-hit != 'true'
|
||||||
|
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||||
|
|
||||||
|
- name: Extract the LLVM package
|
||||||
|
run: tar xf LLVM-13.0.0.tar.gz --strip-components=1
|
||||||
|
working-directory: ./core/deps/llvm/build
|
||||||
|
|
||||||
|
- name: install Ninja and x32 support libraries
|
||||||
|
run: sudo apt install -y g++-multilib libgcc-9-dev lib32gcc-9-dev ninja-build
|
||||||
|
|
||||||
|
- name: run spec tests
|
||||||
|
run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }}
|
||||||
|
working-directory: ./tests/wamr-test-suites
|
||||||
|
|
|
@ -8,9 +8,12 @@ ARG DEBIAN_FRONTEND=noninteractive
|
||||||
ENV TZ=Asian/Shanghai
|
ENV TZ=Asian/Shanghai
|
||||||
|
|
||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install -y apt-transport-https ca-certificates gnupg \
|
&& apt install -y apt-transport-https apt-utils build-essential \
|
||||||
tzdata lsb-release software-properties-common build-essential \
|
ca-certificates curl g++-multilib git gnupg \
|
||||||
apt-utils curl wget git tree unzip zip vim
|
libgcc-9-dev lib32gcc-9-dev lsb-release \
|
||||||
|
ninja-build ocaml ocamlbuild python2.7 \
|
||||||
|
software-properties-common tree tzdata \
|
||||||
|
unzip url valgrind vim wget zip
|
||||||
|
|
||||||
#
|
#
|
||||||
# CMAKE (https://apt.kitware.com/)
|
# CMAKE (https://apt.kitware.com/)
|
||||||
|
@ -33,7 +36,7 @@ RUN cd /opt/emsdk \
|
||||||
|
|
||||||
#
|
#
|
||||||
#install wabt
|
#install wabt
|
||||||
ARG WABT_VER=1.0.23
|
ARG WABT_VER=1.0.24
|
||||||
RUN wget -c https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt
|
RUN wget -c https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt
|
||||||
RUN tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
|
RUN tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
|
||||||
&& ln -fs /opt/wabt-${WABT_VER} /opt/wabt
|
&& ln -fs /opt/wabt-${WABT_VER} /opt/wabt
|
||||||
|
@ -59,16 +62,6 @@ RUN chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \
|
||||||
# set path
|
# set path
|
||||||
RUN echo "PATH=/opt/clang_llvm/bin:/opt/wasi-sdk/bin:/opt/wabt/bin:/opt/binaryen/bin:/opt/bazelisk:${PATH}" >> /root/.bashrc
|
RUN echo "PATH=/opt/clang_llvm/bin:/opt/wasi-sdk/bin:/opt/wabt/bin:/opt/binaryen/bin:/opt/bazelisk:${PATH}" >> /root/.bashrc
|
||||||
|
|
||||||
#
|
|
||||||
# install
|
|
||||||
RUN apt update \
|
|
||||||
&& apt install -y ninja-build python2.7 valgrind
|
|
||||||
|
|
||||||
#
|
|
||||||
# ocaml
|
|
||||||
RUN apt update \
|
|
||||||
&& apt install -y ocaml ocamlbuild
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# PS
|
# PS
|
||||||
RUN echo "PS1='\n[ \u@wamr-dev-docker \W ]\n$ '" >> /root/.bashrc
|
RUN echo "PS1='\n[ \u@wamr-dev-docker \W ]\n$ '" >> /root/.bashrc
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#define R_386_32 1 /* Direct 32 bit */
|
#define R_386_32 1 /* Direct 32 bit */
|
||||||
#define R_386_PC32 2 /* PC relative 32 bit */
|
#define R_386_PC32 2 /* PC relative 32 bit */
|
||||||
|
#define R_386_PLT32 4 /* 32bit address ProcedureLinkageTable */
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(_WIN32_)
|
#if !defined(_WIN32) && !defined(_WIN32_)
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
@ -119,6 +120,11 @@ apply_relocation(AOTModule *module, uint8 *target_section_addr,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Handle R_386_PLT32 like R_386_PC32 since it should be able to reach
|
||||||
|
* any 32 bit address
|
||||||
|
*/
|
||||||
|
case R_386_PLT32:
|
||||||
case R_386_PC32:
|
case R_386_PC32:
|
||||||
{
|
{
|
||||||
int32 value;
|
int32 value;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
# exit if meet an exception
|
# exit if meet an exception
|
||||||
function DEBUG() {
|
function DEBUG() {
|
||||||
[[ -n $(env | grep "\<DEBUG\>") ]] && $@
|
[[ -n $(env | grep "\<DEBUG\>") ]] && $@
|
||||||
}
|
}
|
||||||
DEBUG set -xevu
|
DEBUG set -xevu
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@ IWASM_CMD="../../../product-mini/platforms/${PLATFORM}/build/iwasm"
|
||||||
# "comments" is for runtest.py
|
# "comments" is for runtest.py
|
||||||
|
|
||||||
IGNORE_LIST=(
|
IGNORE_LIST=(
|
||||||
"comments" "inline-module" "imports" "linking" "names"
|
"comments" "inline-module" "imports" "linking" "names"
|
||||||
)
|
)
|
||||||
|
|
||||||
readonly -a MULTI_MODULE_LIST=(
|
readonly -a MULTI_MODULE_LIST=(
|
||||||
"imports" "linking"
|
"imports" "linking"
|
||||||
)
|
)
|
||||||
|
|
||||||
SGX_IGNORE_LIST=("conversions" "f32_bitwise" "f64_bitwise")
|
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
|
# these cases run failed due to native stack overflow check failed
|
||||||
SGX_AOT_IGNORE_LIST=("call_indirect" "call" "fac" "skip-stack-guard-page")
|
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]"
|
echo "Usage: all.sh [-t] [-m <x86_64|x86_32|ARMV7_VFP|THUMBV7_VFP>] [-M] [-x] [-S] [-r]"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_case_w_aot()
|
function run_case_w_aot() {
|
||||||
{
|
|
||||||
local test_case=$1
|
local test_case=$1
|
||||||
echo "============> run ${test_case} with AOT"
|
echo "============> run ${test_case} with AOT"
|
||||||
python2.7 runtest.py \
|
python2.7 runtest.py \
|
||||||
|
@ -56,26 +54,25 @@ function run_case_w_aot()
|
||||||
${SGX_OPT} \
|
${SGX_OPT} \
|
||||||
${SIMD_OPT} \
|
${SIMD_OPT} \
|
||||||
${REF_TYPES_OPT}
|
${REF_TYPES_OPT}
|
||||||
#--no_cleanup
|
#--no_cleanup
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo "============> run ${test_case} failed"
|
echo "============> run ${test_case} failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_case_wo_aot()
|
function run_case_wo_aot() {
|
||||||
{
|
|
||||||
local test_case=$1
|
local test_case=$1
|
||||||
echo "============> run ${test_case}"
|
echo "============> run ${test_case}"
|
||||||
python2.7 runtest.py \
|
python2.7 runtest.py \
|
||||||
--wast2wasm ${WAST2WASM_CMD} \
|
--wast2wasm ${WAST2WASM_CMD} \
|
||||||
--interpreter ${IWASM_CMD} \
|
--interpreter ${IWASM_CMD} \
|
||||||
${SPEC_TEST_DIR}/${test_case}\
|
${SPEC_TEST_DIR}/${test_case} \
|
||||||
--aot-compiler ${WAMRC_CMD} \
|
--aot-compiler ${WAMRC_CMD} \
|
||||||
${SGX_OPT} \
|
${SGX_OPT} \
|
||||||
${SIMD_OPT} \
|
${SIMD_OPT} \
|
||||||
${REF_TYPES_OPT}
|
${REF_TYPES_OPT}
|
||||||
#--no_cleanup
|
#--no_cleanup
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo "============> run ${test_case} failed"
|
echo "============> run ${test_case} failed"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -90,35 +87,33 @@ SIMD_OPT=""
|
||||||
REF_TYPES_OPT=""
|
REF_TYPES_OPT=""
|
||||||
while getopts ":Mm:txSr" opt; do
|
while getopts ":Mm:txSr" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
t) AOT=true ;;
|
t) AOT=true ;;
|
||||||
m)
|
m)
|
||||||
TARGET=$OPTARG
|
TARGET=$OPTARG
|
||||||
if [[ ${TARGET} == 'X86_32' ]];then
|
if [[ ${TARGET} == 'X86_32' ]]; then
|
||||||
TARGET='i386'
|
TARGET='i386'
|
||||||
elif [[ ${TARGET} == 'X86_64' ]];then
|
elif [[ ${TARGET} == 'X86_64' ]]; then
|
||||||
TARGET='x86_64'
|
TARGET='x86_64'
|
||||||
elif [[ ${TARGET} == 'ARMV7_VFP' ]];then
|
elif [[ ${TARGET} == 'ARMV7_VFP' ]]; then
|
||||||
TARGET='armv7'
|
TARGET='armv7'
|
||||||
elif [[ ${TARGET} == 'THUMBV7_VFP' ]];then
|
elif [[ ${TARGET} == 'THUMBV7_VFP' ]]; then
|
||||||
TARGET='thumbv7'
|
TARGET='thumbv7'
|
||||||
elif [[ ${TARGET} == 'RISCV64' || ${TARGET} == 'RISCV64_LP64D' ]];then
|
elif [[ ${TARGET} == 'RISCV64' || ${TARGET} == 'RISCV64_LP64D' ]]; then
|
||||||
TARGET='riscv64_lp64d'
|
TARGET='riscv64_lp64d'
|
||||||
elif [[ ${TARGET} == 'RISCV64_LP64' ]];then
|
elif [[ ${TARGET} == 'RISCV64_LP64' ]]; then
|
||||||
TARGET='riscv64_lp64'
|
TARGET='riscv64_lp64'
|
||||||
else
|
else
|
||||||
usage
|
usage
|
||||||
fi
|
fi ;;
|
||||||
;;
|
M) ENABLE_MULTI_MODULE=1 ;;
|
||||||
M) ENABLE_MULTI_MODULE=1 ;;
|
x) SGX_OPT="--sgx" ;;
|
||||||
x) SGX_OPT="--sgx" ;;
|
S) SIMD_OPT="--simd" ;;
|
||||||
S) SIMD_OPT="--simd" ;;
|
r) REF_TYPES_OPT="--ref_types" ;;
|
||||||
r) REF_TYPES_OPT="--ref_types" ;;
|
*) usage ;;
|
||||||
*) usage ;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
function contain()
|
function contain() {
|
||||||
{
|
|
||||||
# [$1, $-1)
|
# [$1, $-1)
|
||||||
local list=${@:0:${#}}
|
local list=${@:0:${#}}
|
||||||
# [$-1]
|
# [$-1]
|
||||||
|
@ -126,14 +121,18 @@ function contain()
|
||||||
[[ ${list} =~ (^| )${item}($| ) ]] && return 0 || return 1
|
[[ ${list} =~ (^| )${item}($| ) ]] && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ ${SGX_OPT} ]];then
|
if [[ ${SGX_OPT} ]]; then
|
||||||
IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
|
IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
|
||||||
IGNORE_LIST+=("${SGX_IGNORE_LIST[@]}")
|
IGNORE_LIST+=("${SGX_IGNORE_LIST[@]}")
|
||||||
if [[ "true" == ${AOT} ]];then
|
if [[ "true" == ${AOT} ]]; then
|
||||||
IGNORE_LIST+=("${SGX_AOT_IGNORE_LIST[@]}")
|
IGNORE_LIST+=("${SGX_AOT_IGNORE_LIST[@]}")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ${TARGET} == "i386" ]]; then
|
||||||
|
IGNORE_LIST+=("float_exprs")
|
||||||
|
fi
|
||||||
|
|
||||||
declare -i COUNTER=0
|
declare -i COUNTER=0
|
||||||
for wast in $(find ${SPEC_TEST_DIR} -name "*.wast" -type f | sort -n); do
|
for wast in $(find ${SPEC_TEST_DIR} -name "*.wast" -type f | sort -n); do
|
||||||
# remove a prefix spec/test/core/
|
# 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}"
|
echo "============> ignore ${wast}"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
[[ "true" == ${AOT} ]] && run_case_w_aot ${wast} \
|
[[ "true" == ${AOT} ]] && run_case_w_aot ${wast} ||
|
||||||
|| run_case_wo_aot ${wast}
|
run_case_wo_aot ${wast}
|
||||||
(( COUNTER += 1))
|
((COUNTER += 1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -154,7 +153,7 @@ if [[ "false" == ${AOT} && 1 == ${ENABLE_MULTI_MODULE} ]]; then
|
||||||
echo "============> run cases about multi module"
|
echo "============> run cases about multi module"
|
||||||
for wast in ${MULTI_MODULE_LIST[@]}; do
|
for wast in ${MULTI_MODULE_LIST[@]}; do
|
||||||
run_case_wo_aot ${wast}.wast
|
run_case_wo_aot ${wast}.wast
|
||||||
(( COUNTER += 1))
|
((COUNTER += 1))
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -584,6 +584,11 @@ function trigger()
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"jit")
|
"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"
|
echo "work in jit mode"
|
||||||
# jit
|
# jit
|
||||||
BUILD_FLAGS="$JIT_COMPILE_FLAGS $EXTRA_COMPILE_FLAGS"
|
BUILD_FLAGS="$JIT_COMPILE_FLAGS $EXTRA_COMPILE_FLAGS"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user