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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 136 additions and 69 deletions

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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 \
@ -63,8 +61,7 @@ function run_case_w_aot()
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 \
@ -107,8 +104,7 @@ while getopts ":Mm:txSr" opt; do
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" ;;
@ -117,8 +113,7 @@ while getopts ":Mm:txSr" opt; do
esac esac
done done
function contain() function contain() {
{
# [$1, $-1) # [$1, $-1)
local list=${@:0:${#}} local list=${@:0:${#}}
# [$-1] # [$-1]
@ -134,6 +129,10 @@ if [[ ${SGX_OPT} ]];then
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,8 +142,8 @@ 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

View File

@ -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"