File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,6 +73,21 @@ endif()
7373set (gtest_force_shared_crt ON CACHE BOOL "" FORCE )
7474FetchContent_MakeAvailable (googletest)
7575
76+ # Fetch CMocka for C unit tests
77+ if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24" )
78+ FetchContent_Declare (
79+ cmocka
80+ URL https://git.cryptomilk.org/projects/cmocka.git/snapshot/cmocka-2.0.1.tar.gz
81+ DOWNLOAD_EXTRACT_TIMESTAMP ON
82+ )
83+ else ()
84+ FetchContent_Declare (
85+ cmocka
86+ URL https://git.cryptomilk.org/projects/cmocka.git/snapshot/cmocka-2.0.1.tar.gz
87+ )
88+ endif ()
89+ FetchContent_MakeAvailable (cmocka)
90+
7691include (GoogleTest )
7792enable_testing ()
7893
@@ -90,6 +105,7 @@ add_subdirectory(unsupported-features)
90105add_subdirectory (smart-tests )
91106add_subdirectory (exception-handling )
92107add_subdirectory (running-modes )
108+ add_subdirectory (mem-alloc )
93109
94110if (WAMR_BUILD_TARGET STREQUAL "X86_64" )
95111 add_subdirectory (aot-stack-frame )
Original file line number Diff line number Diff line change 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 (test-mem-alloc)
7+
8+ # Enable test build flag
9+ add_definitions (-DWAMR_BUILD_TEST=1 )
10+
11+ # Test-specific feature configuration
12+ set (WAMR_BUILD_AOT 0)
13+ set (WAMR_BUILD_FAST_INTERP 0)
14+ set (WAMR_BUILD_INTERP 0)
15+ set (WAMR_BUILD_JIT 0)
16+ set (WAMR_BUILD_LIBC_WASI 0)
17+ set (WAMR_BUILD_APP_FRAMEWORK 0)
18+
19+ include (../unit_common.cmake )
20+
21+ # Test source files
22+ set (TEST_SOURCES
23+ test_runner.c
24+ ${WAMR_RUNTIME_LIB_SOURCE}
25+ )
26+
27+ # Create test executable
28+ add_executable (mem-alloc-test ${TEST_SOURCES} )
29+
30+ # Link dependencies
31+ target_link_libraries (mem-alloc-test cmocka::cmocka m )
32+
33+ # Add to ctest
34+ add_test (NAME mem-alloc-test COMMAND mem-alloc-test )
35+ set_tests_properties (mem-alloc-test PROPERTIES TIMEOUT 60 )
You can’t perform that action at this time.
0 commit comments