mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-29 04:57:14 +00:00
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:
parent
e48367c044
commit
14d09bfb66
|
@ -315,6 +315,10 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-22.04]
|
os: [ubuntu-22.04]
|
||||||
|
build_target: [
|
||||||
|
"X86_64",
|
||||||
|
"X86_32",
|
||||||
|
]
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
||||||
|
@ -351,10 +355,16 @@ jobs:
|
||||||
cmake --build . --config Release --parallel 4
|
cmake --build . --config Release --parallel 4
|
||||||
working-directory: wamr-compiler
|
working-directory: wamr-compiler
|
||||||
|
|
||||||
|
- name: Install dependencies for X86_32
|
||||||
|
if: matrix.build_target == 'X86_32'
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y g++-multilib
|
||||||
|
|
||||||
- name: Build and run unit tests
|
- name: Build and run unit tests
|
||||||
run: |
|
run: |
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake ..
|
cmake .. -DWAMR_BUILD_TARGET=${{ matrix.build_target }}
|
||||||
cmake --build . --config Release --parallel 4
|
cmake --build . --config Release --parallel 4
|
||||||
ctest
|
ctest
|
||||||
working-directory: tests/unit
|
working-directory: tests/unit
|
||||||
|
|
|
@ -32,6 +32,7 @@ include (FetchContent)
|
||||||
FetchContent_Declare (
|
FetchContent_Declare (
|
||||||
googletest
|
googletest
|
||||||
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
|
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
|
||||||
|
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable (googletest)
|
FetchContent_MakeAvailable (googletest)
|
||||||
|
|
||||||
|
@ -42,19 +43,27 @@ enable_testing()
|
||||||
|
|
||||||
add_subdirectory(wasm-vm)
|
add_subdirectory(wasm-vm)
|
||||||
add_subdirectory(interpreter)
|
add_subdirectory(interpreter)
|
||||||
add_subdirectory(aot)
|
|
||||||
add_subdirectory(wasm-c-api)
|
add_subdirectory(wasm-c-api)
|
||||||
add_subdirectory(libc-builtin)
|
add_subdirectory(libc-builtin)
|
||||||
add_subdirectory(shared-utils)
|
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-wasm)
|
||||||
add_subdirectory(linear-memory-aot)
|
add_subdirectory(linear-memory-aot)
|
||||||
add_subdirectory(aot-stack-frame)
|
add_subdirectory(aot-stack-frame)
|
||||||
add_subdirectory(linux-perf)
|
add_subdirectory(linux-perf)
|
||||||
add_subdirectory(gc)
|
add_subdirectory(gc)
|
||||||
add_subdirectory(memory64)
|
|
||||||
add_subdirectory(tid-allocator)
|
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)
|
project(wasm-apps-aot-stack-frame)
|
||||||
|
|
||||||
add_custom_target(aot-stack-frame-test-wasm ALL
|
set (WAMRC_OPTION --enable-dump-call-stack --bounds-checks=1 --enable-gc)
|
||||||
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
|
|
||||||
|
|
||||||
|
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 "")
|
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||||
|
|
||||||
# WAMR features switch
|
# 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_INTERP 1)
|
||||||
set(WAMR_BUILD_AOT 0)
|
set(WAMR_BUILD_AOT 0)
|
||||||
set(WAMR_BUILD_JIT 0)
|
set(WAMR_BUILD_JIT 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user