Skip to content

Commit dd66130

Browse files
committed
add more unit test cases for interpreter
Signed-off-by: zhenweijin <zhenwei.jin@intel.com> Co-authored-by: Gong, Pu <pu.gong@intel.com> Co-authored-by: ai-assistant
1 parent 081c344 commit dd66130

6 files changed

Lines changed: 656 additions & 0 deletions

File tree

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: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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_FAST_INTERP 0)
16+
set(WAMR_BUILD_INTERP 1)
17+
set(WAMR_BUILD_JIT 0)
18+
set (WAMR_BUILD_LIBC_WASI 0)
19+
set (WAMR_BUILD_APP_FRAMEWORK 1)
20+
21+
include (../../unit_common.cmake)
22+
23+
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
24+
25+
file (GLOB_RECURSE source_all ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
26+
27+
set (UNIT_SOURCE ${source_all})
28+
29+
set (unit_test_sources
30+
${UNIT_SOURCE}
31+
${WAMR_RUNTIME_LIB_SOURCE}
32+
)
33+
34+
# Now simply link against gtest or gtest_main as needed. Eg
35+
add_executable (smart_test_interpreter ${unit_test_sources})
36+
37+
target_link_libraries (smart_test_interpreter gtest_main )
38+
39+
# Copy WASM files to build directory
40+
add_custom_command(TARGET smart_test_interpreter POST_BUILD
41+
COMMAND ${CMAKE_COMMAND} -E copy
42+
${CMAKE_CURRENT_LIST_DIR}/wasm-apps/*.wasm
43+
${CMAKE_CURRENT_BINARY_DIR}/
44+
COMMENT "Copy test wasm files to the directory of google test"
45+
)
46+
47+
gtest_discover_tests(smart_test_interpreter)

0 commit comments

Comments
 (0)