@@ -14,7 +14,7 @@ function help()
1414{
1515 echo " test_wamr.sh [options]"
1616 echo " -c clean previous test results, not start test"
17- echo " -s {suite_name} test only one suite (spec|wasi_certification)"
17+ echo " -s {suite_name} test only one suite (spec|wasi_certification|wamr_compiler )"
1818 echo " -m set compile target of iwasm(x86_64|x86_32|armv7_vfp|thumbv7_vfp|riscv64_lp64d|riscv64_lp64|aarch64)"
1919 echo " -t set compile type of iwasm(classic-interp|fast-interp|jit|aot|fast-jit|multi-tier-jit)"
2020 echo " -M enable multi module feature"
@@ -309,6 +309,53 @@ function sightglass_test()
309309 echo " Finish sightglass benchmark tests"
310310}
311311
312+ function setup_wabt()
313+ {
314+ if [ ${WABT_BINARY_RELEASE} == " YES" ]; then
315+ echo " download a binary release and install"
316+ local WAT2WASM=${WORK_DIR} /wabt/out/gcc/Release/wat2wasm
317+ if [ ! -f ${WAT2WASM} ]; then
318+ case ${PLATFORM} in
319+ cosmopolitan)
320+ ;&
321+ linux)
322+ WABT_PLATFORM=ubuntu
323+ ;;
324+ darwin)
325+ WABT_PLATFORM=macos
326+ ;;
327+ * )
328+ echo " wabt platform for ${PLATFORM} in unknown"
329+ exit 1
330+ ;;
331+ esac
332+ if [ ! -f /tmp/wabt-1.0.31-${WABT_PLATFORM} .tar.gz ]; then
333+ wget \
334+ https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-${WABT_PLATFORM} .tar.gz \
335+ -P /tmp
336+ fi
337+
338+ cd /tmp \
339+ && tar zxf wabt-1.0.31-${WABT_PLATFORM} .tar.gz \
340+ && mkdir -p ${WORK_DIR} /wabt/out/gcc/Release/ \
341+ && install wabt-1.0.31/bin/wa* ${WORK_DIR} /wabt/out/gcc/Release/ \
342+ && cd -
343+ fi
344+ else
345+ echo " download source code and compile and install"
346+ if [ ! -d " wabt" ]; then
347+ echo " wabt not exist, clone it from github"
348+ git clone --recursive https://github.com/WebAssembly/wabt
349+ fi
350+ echo " upate wabt"
351+ cd wabt
352+ git pull
353+ git reset --hard origin/main
354+ cd ..
355+ make -C wabt gcc-release -j 4
356+ fi
357+ }
358+
312359# TODO: with iwasm only
313360function spec_test()
314361{
@@ -383,49 +430,7 @@ function spec_test()
383430 popd
384431 echo $( pwd)
385432
386- if [ ${WABT_BINARY_RELEASE} == " YES" ]; then
387- echo " download a binary release and install"
388- local WAT2WASM=${WORK_DIR} /wabt/out/gcc/Release/wat2wasm
389- if [ ! -f ${WAT2WASM} ]; then
390- case ${PLATFORM} in
391- cosmopolitan)
392- ;&
393- linux)
394- WABT_PLATFORM=ubuntu
395- ;;
396- darwin)
397- WABT_PLATFORM=macos
398- ;;
399- * )
400- echo " wabt platform for ${PLATFORM} in unknown"
401- exit 1
402- ;;
403- esac
404- if [ ! -f /tmp/wabt-1.0.31-${WABT_PLATFORM} .tar.gz ]; then
405- wget \
406- https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-${WABT_PLATFORM} .tar.gz \
407- -P /tmp
408- fi
409-
410- cd /tmp \
411- && tar zxf wabt-1.0.31-${WABT_PLATFORM} .tar.gz \
412- && mkdir -p ${WORK_DIR} /wabt/out/gcc/Release/ \
413- && install wabt-1.0.31/bin/wa* ${WORK_DIR} /wabt/out/gcc/Release/ \
414- && cd -
415- fi
416- else
417- echo " download source code and compile and install"
418- if [ ! -d " wabt" ]; then
419- echo " wabt not exist, clone it from github"
420- git clone --recursive https://github.com/WebAssembly/wabt
421- fi
422- echo " upate wabt"
423- cd wabt
424- git pull
425- git reset --hard origin/main
426- cd ..
427- make -C wabt gcc-release -j 4
428- fi
433+ setup_wabt
429434
430435 ln -sf ${WORK_DIR} /../spec-test-script/all.py .
431436 ln -sf ${WORK_DIR} /../spec-test-script/runtest.py .
@@ -513,6 +518,28 @@ function wasi_test()
513518 echo " Finish wasi tests"
514519}
515520
521+ function wamr_compiler_test()
522+ {
523+ if [[ $1 != " aot" ]]; then
524+ echo " WAMR compiler tests only support AOT mode"
525+ exit 1
526+ fi
527+
528+ echo " Now start WAMR compiler tests"
529+ setup_wabt
530+ cd ${WORK_DIR} /../wamr-compiler-test-script
531+ ./run_wamr_compiler_tests.sh ${WORK_DIR} /wabt/out/gcc/Release/wat2wasm $WAMRC_CMD $IWASM_CMD \
532+ | tee -a ${REPORT_DIR} /wamr_compiler_test_report.txt
533+
534+ ret=${PIPESTATUS[0]}
535+
536+ if [[ ${ret} -ne 0 ]]; then
537+ echo -e " \nWAMR compiler tests FAILED" | tee -a ${REPORT_DIR} /wamr_compiler_test_report.txt
538+ exit 1
539+ fi
540+ echo -e " \nFinish WAMR compiler tests" | tee -a ${REPORT_DIR} /wamr_compiler_test_report.txt
541+ }
542+
516543function wasi_certification_test()
517544{
518545 echo " Now start wasi certification tests"
0 commit comments