mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-03-11 00:15:29 +00:00
Enable wamr-test-suites on MacOS (#740)
This commit is contained in:
parent
88192ab13b
commit
ea835db54c
|
@ -18,7 +18,8 @@ DEBUG set -xevu
|
||||||
readonly SPEC_TEST_DIR="spec/test/core"
|
readonly SPEC_TEST_DIR="spec/test/core"
|
||||||
readonly WAST2WASM_CMD="./wabt/out/gcc/Release/wat2wasm"
|
readonly WAST2WASM_CMD="./wabt/out/gcc/Release/wat2wasm"
|
||||||
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
|
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
|
||||||
IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
|
PLATFORM=$(uname -s | tr A-Z a-z)
|
||||||
|
IWASM_CMD="../../../product-mini/platforms/${PLATFORM}/build/iwasm"
|
||||||
|
|
||||||
# "imports" and "linking" are only avilable when enabling multi modules
|
# "imports" and "linking" are only avilable when enabling multi modules
|
||||||
# "comments" is for runtest.py
|
# "comments" is for runtest.py
|
||||||
|
|
|
@ -105,6 +105,9 @@ class Runner():
|
||||||
[outs,_,_] = select([self.stdout], [], [], 1)
|
[outs,_,_] = select([self.stdout], [], [], 1)
|
||||||
if self.stdout in outs:
|
if self.stdout in outs:
|
||||||
new_data = self.stdout.read(1)
|
new_data = self.stdout.read(1)
|
||||||
|
if not new_data:
|
||||||
|
# EOF on macOS ends up here.
|
||||||
|
break
|
||||||
new_data = new_data.decode("utf-8") if IS_PY_3 else new_data
|
new_data = new_data.decode("utf-8") if IS_PY_3 else new_data
|
||||||
#print("new_data: '%s'" % new_data)
|
#print("new_data: '%s'" % new_data)
|
||||||
debug(new_data)
|
debug(new_data)
|
||||||
|
@ -139,6 +142,11 @@ class Runner():
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
self.p = None
|
self.p = None
|
||||||
|
self.stdin.close()
|
||||||
|
if self.stdin != self.stdout:
|
||||||
|
self.stdout.close()
|
||||||
|
self.stdin = None
|
||||||
|
self.stdout = None
|
||||||
sys.exc_clear()
|
sys.exc_clear()
|
||||||
|
|
||||||
def assert_prompt(runner, prompts, timeout, is_need_execute_result):
|
def assert_prompt(runner, prompts, timeout, is_need_execute_result):
|
||||||
|
@ -979,24 +987,27 @@ def create_tmpfiles(wast_name):
|
||||||
if not os.path.exists(temp_file_directory):
|
if not os.path.exists(temp_file_directory):
|
||||||
os.mkdir(temp_file_directory)
|
os.mkdir(temp_file_directory)
|
||||||
|
|
||||||
|
def makefile(name):
|
||||||
|
open(name, "w").close()
|
||||||
|
|
||||||
# create temporal file with particular name
|
# create temporal file with particular name
|
||||||
temp_wast_file = os.path.join(temp_file_directory, ""+ wast_name + ".wast")
|
temp_wast_file = os.path.join(temp_file_directory, ""+ wast_name + ".wast")
|
||||||
if not os.path.exists(temp_wast_file):
|
if not os.path.exists(temp_wast_file):
|
||||||
os.mknod(temp_wast_file)
|
makefile(temp_wast_file)
|
||||||
tempfiles.append(temp_wast_file)
|
tempfiles.append(temp_wast_file)
|
||||||
|
|
||||||
# now we define the same file name as wast for wasm & aot
|
# now we define the same file name as wast for wasm & aot
|
||||||
wasm_file = wast_name +".wasm"
|
wasm_file = wast_name +".wasm"
|
||||||
temp_wasm_file = os.path.join(temp_file_directory, wasm_file)
|
temp_wasm_file = os.path.join(temp_file_directory, wasm_file)
|
||||||
if not os.path.exists(temp_wasm_file):
|
if not os.path.exists(temp_wasm_file):
|
||||||
os.mknod(temp_wasm_file)
|
makefile(temp_wasm_file)
|
||||||
tempfiles.append(temp_wasm_file)
|
tempfiles.append(temp_wasm_file)
|
||||||
|
|
||||||
if test_aot:
|
if test_aot:
|
||||||
aot_file = wast_name +".aot"
|
aot_file = wast_name +".aot"
|
||||||
temp_aot_file =os.path.join(temp_file_directory, aot_file)
|
temp_aot_file =os.path.join(temp_file_directory, aot_file)
|
||||||
if not os.path.exists(temp_aot_file):
|
if not os.path.exists(temp_aot_file):
|
||||||
os.mknod(temp_aot_file)
|
makefile(temp_aot_file)
|
||||||
tempfiles.append(temp_aot_file)
|
tempfiles.append(temp_aot_file)
|
||||||
|
|
||||||
# add these temp file to temporal repo, will be deleted when finishing the test
|
# add these temp file to temporal repo, will be deleted when finishing the test
|
||||||
|
|
|
@ -40,6 +40,7 @@ SGX_OPT=""
|
||||||
# enable reference-types and bulk-memory by default
|
# enable reference-types and bulk-memory by default
|
||||||
# as they are finished and merged into spec
|
# as they are finished and merged into spec
|
||||||
ENABLE_REF_TYPES=1
|
ENABLE_REF_TYPES=1
|
||||||
|
PLATFORM=$(uname -s | tr A-Z a-z)
|
||||||
|
|
||||||
while getopts ":s:cabt:m:MCpSxr" opt
|
while getopts ":s:cabt:m:MCpSxr" opt
|
||||||
do
|
do
|
||||||
|
@ -145,8 +146,8 @@ if [[ ${SGX_OPT} == "--sgx" ]];then
|
||||||
readonly IWASM_LINUX_ROOT_DIR="${WAMR_DIR}/product-mini/platforms/linux-sgx"
|
readonly IWASM_LINUX_ROOT_DIR="${WAMR_DIR}/product-mini/platforms/linux-sgx"
|
||||||
readonly IWASM_CMD="${WAMR_DIR}/product-mini/platforms/linux-sgx/enclave-sample/iwasm"
|
readonly IWASM_CMD="${WAMR_DIR}/product-mini/platforms/linux-sgx/enclave-sample/iwasm"
|
||||||
else
|
else
|
||||||
readonly IWASM_LINUX_ROOT_DIR="${WAMR_DIR}/product-mini/platforms/linux"
|
readonly IWASM_LINUX_ROOT_DIR="${WAMR_DIR}/product-mini/platforms/${PLATFORM}"
|
||||||
readonly IWASM_CMD="${WAMR_DIR}/product-mini/platforms/linux/build/iwasm"
|
readonly IWASM_CMD="${WAMR_DIR}/product-mini/platforms/${PLATFORM}/build/iwasm"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readonly WAMRC_CMD="${WAMR_DIR}/wamr-compiler/build/wamrc"
|
readonly WAMRC_CMD="${WAMR_DIR}/wamr-compiler/build/wamrc"
|
||||||
|
@ -322,14 +323,26 @@ function spec_test()
|
||||||
echo "download a binary release and install"
|
echo "download a binary release and install"
|
||||||
local WAT2WASM=${WORK_DIR}/wabt/out/gcc/Release/wat2wasm
|
local WAT2WASM=${WORK_DIR}/wabt/out/gcc/Release/wat2wasm
|
||||||
if [ ! -f ${WAT2WASM} ]; then
|
if [ ! -f ${WAT2WASM} ]; then
|
||||||
if [ ! -f /tmp/wabt-1.0.23-linux.tar.gz ]; then
|
case ${PLATFORM} in
|
||||||
|
linux)
|
||||||
|
WABT_PLATFORM=ubuntu
|
||||||
|
;;
|
||||||
|
darwin)
|
||||||
|
WABT_PLATFORM=macos
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "wabt platform for ${PLATFORM} in unknown"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ ! -f /tmp/wabt-1.0.23-${WABT_PLATFORM}.tar.gz ]; then
|
||||||
wget \
|
wget \
|
||||||
https://github.com/WebAssembly/wabt/releases/download/1.0.23/wabt-1.0.23-ubuntu.tar.gz \
|
https://github.com/WebAssembly/wabt/releases/download/1.0.23/wabt-1.0.23-${WABT_PLATFORM}.tar.gz \
|
||||||
-P /tmp
|
-P /tmp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd /tmp \
|
cd /tmp \
|
||||||
&& tar zxf wabt-1.0.23-ubuntu.tar.gz \
|
&& tar zxf wabt-1.0.23-${WABT_PLATFORM}.tar.gz \
|
||||||
&& mkdir -p ${WORK_DIR}/wabt/out/gcc/Release/ \
|
&& mkdir -p ${WORK_DIR}/wabt/out/gcc/Release/ \
|
||||||
&& install wabt-1.0.23/bin/wa* ${WORK_DIR}/wabt/out/gcc/Release/ \
|
&& install wabt-1.0.23/bin/wa* ${WORK_DIR}/wabt/out/gcc/Release/ \
|
||||||
&& cd -
|
&& cd -
|
||||||
|
@ -469,7 +482,7 @@ function build_iwasm_with_cfg()
|
||||||
&& make clean \
|
&& make clean \
|
||||||
&& make SPEC_TEST=1
|
&& make SPEC_TEST=1
|
||||||
else
|
else
|
||||||
cd ${WAMR_DIR}/product-mini/platforms/linux \
|
cd ${WAMR_DIR}/product-mini/platforms/${PLATFORM} \
|
||||||
&& if [ -d build ]; then rm -rf build/*; else mkdir build; fi \
|
&& if [ -d build ]; then rm -rf build/*; else mkdir build; fi \
|
||||||
&& cd build \
|
&& cd build \
|
||||||
&& cmake $* .. \
|
&& cmake $* .. \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user