mirror of
https://github.com/swaywm/sway.git
synced 2026-04-28 06:46:26 -04:00
Add memory test utilities
This commit is contained in:
parent
698ba55860
commit
e563bec64d
8 changed files with 153 additions and 10 deletions
|
|
@ -5,8 +5,6 @@ function(configure_test)
|
|||
set(oneValueArgs NAME SUBPROJECT)
|
||||
set(multiValueArgs WRAPPERS SOURCES INCLUDES LIBRARIES)
|
||||
cmake_parse_arguments(CONFIGURE_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
message("${CONFIGURE_TEST_SOURCES}")
|
||||
message("${CONFIGURE_TEST_WRAPPERS}")
|
||||
|
||||
include_directories(
|
||||
${CMOCKA_INCLUDE_DIR}
|
||||
|
|
@ -19,7 +17,12 @@ function(configure_test)
|
|||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/${CONFIGURE_TEST_SUBPROJECT}/${CONFIGURE_TEST_NAME}
|
||||
)
|
||||
|
||||
add_executable(${CONFIGURE_TEST_NAME}_test ${CONFIGURE_TEST_SOURCES})
|
||||
add_executable(${CONFIGURE_TEST_NAME}_test
|
||||
${CMAKE_SOURCE_DIR}/test/util.c
|
||||
${CONFIGURE_TEST_SOURCES}
|
||||
)
|
||||
|
||||
list(APPEND CONFIGURE_TEST_WRAPPERS "malloc" "calloc" "realloc" "free")
|
||||
|
||||
list(LENGTH CONFIGURE_TEST_WRAPPERS WRAPPED_COUNT)
|
||||
|
||||
|
|
@ -32,7 +35,6 @@ function(configure_test)
|
|||
"${WRAPPED} \
|
||||
-Wl,--wrap=${WRAPPER}"
|
||||
)
|
||||
message("${WRAPPER}, ${WRAPPED}")
|
||||
endforeach()
|
||||
|
||||
set_target_properties(${CONFIGURE_TEST_NAME}_test
|
||||
|
|
@ -42,4 +44,6 @@ function(configure_test)
|
|||
endif()
|
||||
|
||||
target_link_libraries(${CONFIGURE_TEST_NAME}_test ${CMOCKA_LIBRARIES} ${CONFIGURE_TEST_LIBRARIES})
|
||||
|
||||
set(test_targets ${test_targets} ${CONFIGURE_TEST_NAME}_test PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue