CMakeLists.txt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. cmake_minimum_required(VERSION 3.14)
  4. project(test-mem-alloc)
  5. # Enable test build flag
  6. add_definitions(-DWAMR_BUILD_TEST=1)
  7. # Test-specific feature configuration
  8. set(WAMR_BUILD_AOT 0)
  9. set(WAMR_BUILD_FAST_INTERP 0)
  10. set(WAMR_BUILD_INTERP 1)
  11. set(WAMR_BUILD_JIT 0)
  12. set(WAMR_BUILD_LIBC_WASI 0)
  13. include(../unit_common.cmake)
  14. # Test source files
  15. set(TEST_SOURCES
  16. test_runner.c
  17. ${WAMR_RUNTIME_LIB_SOURCE}
  18. )
  19. #
  20. # Create test executable
  21. #
  22. ## Normal test executable
  23. add_executable(mem-alloc-test ${TEST_SOURCES})
  24. # Add include directories for mem-alloc internals
  25. target_include_directories(mem-alloc-test PRIVATE
  26. ${WAMR_ROOT_DIR}/core/shared/mem-alloc
  27. ${WAMR_ROOT_DIR}/core/shared/mem-alloc/ems
  28. )
  29. ## GC test executable
  30. add_executable(mem-alloc-gc-test ${TEST_SOURCES})
  31. target_include_directories(mem-alloc-gc-test PRIVATE
  32. ${WAMR_ROOT_DIR}/core/shared/mem-alloc
  33. ${WAMR_ROOT_DIR}/core/shared/mem-alloc/ems
  34. )
  35. target_compile_options(mem-alloc-gc-test PRIVATE -DWAMR_BUILD_GC=1 -DWAMR_BUILD_GC_VERIFY=1)
  36. # Link dependencies
  37. target_link_libraries(mem-alloc-test cmocka::cmocka m)
  38. target_link_libraries(mem-alloc-gc-test cmocka::cmocka m)
  39. # Add to ctest
  40. add_test(NAME mem-alloc-test COMMAND mem-alloc-test)
  41. set_tests_properties(mem-alloc-test PROPERTIES TIMEOUT 60)
  42. add_test(NAME mem-alloc-gc-test COMMAND mem-alloc-gc-test)
  43. set_tests_properties(mem-alloc-gc-test PROPERTIES TIMEOUT 60)