Fixed unit tests on X86_32 (#4279)
* fix unit tests on x86_32 * enbale wasm-c-api unit test on X86_32 * enable aot-stack-frame unit test on X86_32 * add ci: unit tests on X86_32
This commit is contained in:
@ -32,6 +32,7 @@ include (FetchContent)
|
||||
FetchContent_Declare (
|
||||
googletest
|
||||
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable (googletest)
|
||||
|
||||
@ -42,19 +43,27 @@ enable_testing()
|
||||
|
||||
add_subdirectory(wasm-vm)
|
||||
add_subdirectory(interpreter)
|
||||
add_subdirectory(aot)
|
||||
add_subdirectory(wasm-c-api)
|
||||
add_subdirectory(libc-builtin)
|
||||
add_subdirectory(shared-utils)
|
||||
add_subdirectory(running-modes)
|
||||
add_subdirectory(runtime-common)
|
||||
add_subdirectory(custom-section)
|
||||
add_subdirectory(compilation)
|
||||
add_subdirectory(linear-memory-wasm)
|
||||
add_subdirectory(linear-memory-aot)
|
||||
add_subdirectory(aot-stack-frame)
|
||||
add_subdirectory(linux-perf)
|
||||
add_subdirectory(gc)
|
||||
add_subdirectory(memory64)
|
||||
add_subdirectory(tid-allocator)
|
||||
add_subdirectory(shared-heap)
|
||||
|
||||
if (NOT WAMR_BUILD_TARGET STREQUAL "X86_32")
|
||||
# should enable 32-bit llvm when X86_32
|
||||
add_subdirectory (aot)
|
||||
add_subdirectory (custom-section)
|
||||
add_subdirectory (compilation)
|
||||
|
||||
# Fast-JIT or mem64 is not supported on X86_32
|
||||
add_subdirectory (running-modes)
|
||||
add_subdirectory (memory64)
|
||||
add_subdirectory (shared-heap)
|
||||
|
||||
# HW_BOUND_CHECK is not supported on X86_32
|
||||
add_subdirectory (runtime-common)
|
||||
endif ()
|
||||
|
||||
@ -5,23 +5,37 @@ cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
project(wasm-apps-aot-stack-frame)
|
||||
|
||||
add_custom_target(aot-stack-frame-test-wasm ALL
|
||||
COMMAND cmake -B ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc
|
||||
-S ${WAMR_ROOT_DIR}/wamr-compiler
|
||||
&& cmake --build ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc
|
||||
&& /opt/wabt/bin/wat2wasm
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/test.wasm
|
||||
${CMAKE_CURRENT_LIST_DIR}/test.wast
|
||||
&& ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc/wamrc
|
||||
--enable-dump-call-stack --bounds-checks=1 --enable-gc
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/test.aot
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test.wasm
|
||||
&& cmake -B ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump
|
||||
-S ${WAMR_ROOT_DIR}/test-tools/binarydump-tool
|
||||
&& cmake --build ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump
|
||||
&& ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump/binarydump
|
||||
-o ${CMAKE_CURRENT_LIST_DIR}/test_aot.h -n test_aot
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test.aot
|
||||
set (WAMRC_OPTION --enable-dump-call-stack --bounds-checks=1 --enable-gc)
|
||||
|
||||
if (WAMR_BUILD_TARGET STREQUAL "X86_32")
|
||||
set (WAMRC_OPTION ${WAMRC_OPTION} --target=i386)
|
||||
endif ()
|
||||
|
||||
add_custom_target(
|
||||
aot-stack-frame-test-wasm ALL
|
||||
|
||||
# Step 1: Build wamrc
|
||||
COMMAND cmake -B ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc
|
||||
-S ${WAMR_ROOT_DIR}/wamr-compiler
|
||||
COMMAND cmake --build ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc
|
||||
|
||||
# Step 2: Compile .wast to .wasm
|
||||
COMMAND /opt/wabt/bin/wat2wasm
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/test.wasm ${CMAKE_CURRENT_LIST_DIR}/test.wast
|
||||
|
||||
# Step 3: Compile .wasm to .aot using wamrc
|
||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc/wamrc ${WAMRC_OPTION}
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/test.aot ${CMAKE_CURRENT_BINARY_DIR}/test.wasm
|
||||
|
||||
# Step 4: Build binarydump tool
|
||||
COMMAND cmake -B ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump
|
||||
-S ${WAMR_ROOT_DIR}/test-tools/binarydump-tool
|
||||
COMMAND cmake --build ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump
|
||||
|
||||
# Step 5: Generate .h file from .aot
|
||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump/binarydump
|
||||
-o ${CMAKE_CURRENT_LIST_DIR}/test_aot.h
|
||||
-n test_aot
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test.aot
|
||||
)
|
||||
|
||||
|
||||
@ -13,7 +13,9 @@ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
# WAMR features switch
|
||||
set(WAMR_BUILD_TARGET "X86_64")
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
set(WAMR_BUILD_TARGET "X86_64")
|
||||
endif()
|
||||
set(WAMR_BUILD_INTERP 1)
|
||||
set(WAMR_BUILD_AOT 0)
|
||||
set(WAMR_BUILD_JIT 0)
|
||||
|
||||
Reference in New Issue
Block a user