Skip to content

Commit ae2fd07

Browse files
authored
add more unit test cases for interpreter (#4716)
Co-authored-by: ai-assistant
1 parent 40a1a29 commit ae2fd07

File tree

6 files changed

+660
-0
lines changed

6 files changed

+660
-0
lines changed

tests/unit/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ add_subdirectory(linux-perf)
6464
add_subdirectory(gc)
6565
add_subdirectory(tid-allocator)
6666
add_subdirectory(unsupported-features)
67+
add_subdirectory(smart-tests)
6768

6869
if (NOT WAMR_BUILD_TARGET STREQUAL "X86_32")
6970
add_subdirectory(aot-stack-frame)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Enhanced Unit Test CMakeLists.txt
2+
cmake_minimum_required(VERSION 3.12)
3+
4+
add_subdirectory(interpreter)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright (C) 2019 Intel Corporation. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
4+
cmake_minimum_required(VERSION 3.14)
5+
6+
project (smart-test-interpreter)
7+
8+
add_definitions (-DRUN_ON_LINUX)
9+
10+
add_definitions (-Dattr_container_malloc=malloc)
11+
add_definitions (-Dattr_container_free=free)
12+
# add_definitions (-DWASM_ENABLE_WAMR_COMPILER=1)
13+
14+
set(WAMR_BUILD_AOT 0)
15+
set(WAMR_BUILD_INTERP 1)
16+
set(WAMR_BUILD_JIT 0)
17+
set (WAMR_BUILD_LIBC_WASI 0)
18+
set (WAMR_BUILD_APP_FRAMEWORK 1)
19+
20+
include (../../unit_common.cmake)
21+
22+
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
23+
24+
file (GLOB_RECURSE source_all ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
25+
26+
set (UNIT_SOURCE ${source_all})
27+
28+
set (unit_test_sources
29+
${UNIT_SOURCE}
30+
${WAMR_RUNTIME_LIB_SOURCE}
31+
)
32+
33+
add_executable (smart_test_classic-interpreter ${unit_test_sources})
34+
target_compile_definitions(smart_test_classic-interpreter PUBLIC -DWAMR_BUILD_FAST_INTERP=0)
35+
target_link_libraries (smart_test_classic-interpreter gtest_main)
36+
37+
add_executable (smart_test_fast-interpreter ${unit_test_sources})
38+
target_compile_definitions(smart_test_fast-interpreter PUBLIC -DWAMR_BUILD_FAST_INTERP=1)
39+
target_link_libraries (smart_test_fast-interpreter gtest_main)
40+
41+
# Copy WASM files to build directory for classic interpreter
42+
# fast interpreter uses the same WASM files
43+
add_custom_command(TARGET smart_test_classic-interpreter POST_BUILD
44+
COMMAND ${CMAKE_COMMAND} -E copy
45+
${CMAKE_CURRENT_LIST_DIR}/wasm-apps/*.wasm
46+
${CMAKE_CURRENT_BINARY_DIR}/
47+
COMMENT "Copy test wasm files to the directory of google test"
48+
)
49+
50+
gtest_discover_tests(smart_test_classic-interpreter)
51+
gtest_discover_tests(smart_test_fast-interpreter)

0 commit comments

Comments
 (0)