test/CMakeLists.txt

Sun, 14 Feb 2021 15:37:12 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 14 Feb 2021 15:37:12 +0100
changeset 413
0f4aa9fc75d9
parent 398
8d506ed6c1c0
child 422
afd87df80b13
child 425
a75b808d653b
permissions
-rw-r--r--

perform array and list tests in the same test binary (use the same assertions, later)

     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} ${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