-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Unit test suites for WAMR. #3490
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
39f0713
Add Unit test suites for WAMR.
yzha107 a14c8c0
Remove test_aot.h of unit test aot-stack-frame, this file is generate…
yzha107 79ad3d3
update code style of some files.
yzha107 c93963f
update unit test suites gc & aot-stack-frame
yzha107 e8b8e6a
Update unit test 'runtime-common'
yzha107 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,52 @@ | ||
# Copyright (C) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# Copyright (C) 2019 Intel Corporation. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
cmake_minimum_required (VERSION 3.14) | ||
cmake_minimum_required(VERSION 2.9) | ||
|
||
project (wamr_unit_tests) | ||
project(unit-test) | ||
|
||
include (CTest) | ||
SET(CMAKE_BUILD_TYPE Debug) | ||
|
||
if (NOT DEFINED WAMR_BUILD_INTERP) | ||
# Enable Interpreter by default | ||
set (WAMR_BUILD_INTERP 1) | ||
endif () | ||
# add_definitions (-m32) | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") | ||
|
||
if (NOT DEFINED WAMR_BUILD_PLATFORM) | ||
string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM) | ||
endif () | ||
if(WAMR_BUILD_TARGET STREQUAL "X86_32") | ||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") | ||
endif() | ||
|
||
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) | ||
include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) | ||
add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE}) | ||
# Prevent overriding the parent project's compiler/linker | ||
# settings on Windows | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
|
||
# Fetch Google test | ||
include (FetchContent) | ||
FetchContent_Declare ( | ||
googletest | ||
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip | ||
) | ||
# For Windows: Prevent overriding the parent project's compiler/linker settings | ||
set (gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
FetchContent_MakeAvailable (googletest) | ||
|
||
include (GoogleTest) | ||
|
||
add_library (wamr_gtest_main main.cpp) | ||
target_link_libraries (wamr_gtest_main PUBLIC gtest vmlib) | ||
|
||
function (create_wamr_unit_test test_name) | ||
set (sources ${ARGN}) | ||
add_executable (${test_name} ${sources}) | ||
target_link_libraries ( | ||
${test_name} | ||
wamr_gtest_main | ||
vmlib | ||
${LLVM_AVAILABLE_LIBS} | ||
) | ||
gtest_discover_tests (${test_name}) | ||
endfunction () | ||
|
||
if (WAMR_BUILD_LIB_WASI_THREADS EQUAL 1) | ||
include (${IWASM_DIR}/libraries/lib-wasi-threads/unit-test/lib_wasi_threads_unit_tests.cmake) | ||
endif () | ||
SET(GOOGLETEST_INCLUDED 1) | ||
|
||
include(GoogleTest) | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright (C) 2019 Intel Corporation. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
cmake_minimum_required(VERSION 2.9) | ||
|
||
project (test-aot-stack-frame) | ||
|
||
add_definitions (-DRUN_ON_LINUX) | ||
|
||
set (WAMR_BUILD_AOT 1) | ||
set (WAMR_BUILD_INTERP 0) | ||
set (WAMR_BUILD_JIT 0) | ||
set (WAMR_BUILD_SIMD 1) | ||
set (WAMR_BUILD_REF_TYPES 1) | ||
set (WAMR_BUILD_LIBC_WASI 0) | ||
set (WAMR_BUILD_LIBC_BUILTIN 0) | ||
set (WAMR_BUILD_MULTI_MODULE 0) | ||
set (WAMR_DISABLE_HW_BOUND_CHECK 1) | ||
set (WAMR_DISABLE_WRITE_GS_BASE 1) | ||
|
||
include (../unit_common.cmake) | ||
|
||
include_directories (${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
add_definitions (-DWASM_ENABLE_AOT_STACK_FRAME=1) | ||
add_definitions (-DAOT_STACK_FRAME_DEBUG) | ||
#add_definitions (-DWASM_ENABLE_DUMP_CALL_STACK=1) | ||
|
||
file (GLOB_RECURSE source_all ${CMAKE_CURRENT_SOURCE_DIR}/*.cc) | ||
|
||
set (UNIT_SOURCE ${source_all}) | ||
|
||
set (unit_test_sources | ||
${UNIT_SOURCE} | ||
${PLATFORM_SHARED_SOURCE} | ||
${UTILS_SHARED_SOURCE} | ||
${MEM_ALLOC_SHARED_SOURCE} | ||
${NATIVE_INTERFACE_SOURCE} | ||
${IWASM_COMMON_SOURCE} | ||
${IWASM_INTERP_SOURCE} | ||
${IWASM_AOT_SOURCE} | ||
${WASM_APP_LIB_SOURCE_ALL} | ||
) | ||
|
||
# Automatically build wasm-apps for this test | ||
add_subdirectory(wasm-apps) | ||
|
||
# Now simply link against gtest or gtest_main as needed. Eg | ||
add_executable (aot_stack_frame_test ${unit_test_sources}) | ||
|
||
add_dependencies (aot_stack_frame_test aot-stack-frame-test-wasm) | ||
|
||
target_link_libraries (aot_stack_frame_test ${LLVM_AVAILABLE_LIBS} gtest_main ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe don't modify existing license header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a new CMakeLists.txt from our internal repo, the original CMakeLists.txt was moved to
tests/unit/tid-allocator/CMakeLists.txt
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks