test/CMakeLists.txt

Sun, 26 Sep 2021 14:41:16 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 26 Sep 2021 14:41:16 +0200
changeset 422
afd87df80b13
parent 413
0f4aa9fc75d9
child 427
ec92b4ed23aa
permissions
-rw-r--r--

add utility to verify allocations

     1 message(CHECK_START "Searching for CUnit test framework")
     3 find_path(CUNIT_INCLUDE_DIR NAMES CUnit/CUnit.h)
     4 find_library(CUNIT_LIBRARY NAMES cunit libcunit cunitlib)
     5 include(FindPackageHandleStandardArgs)
     6 find_package_handle_standard_args(CUnit DEFAULT_MSG CUNIT_LIBRARY CUNIT_INCLUDE_DIR)
     8 if(CUNIT_FOUND)
     9     message(CHECK_PASS "found: compiling tests.")
    10     set(TESTS
    11             test_allocator
    12             test_list
    13     )
    15     foreach(test ${TESTS})
    16         add_executable(${test} util_allocator.c ${test}.c)
    17         target_link_libraries(${test} PRIVATE ucx_static ${CUNIT_LIBRARY})
    18         target_include_directories(${test} PRIVATE ${CUNIT_INCLUDE_DIR})
    19         add_test(NAME ${test} COMMAND ${test} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
    20     endforeach()
    21 else()
    22     message(CHECK_FAIL "not found: unit tests will not be available.")
    23 endif()

mercurial