test/CMakeLists.txt

Tue, 28 Sep 2021 18:03:10 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 28 Sep 2021 18:03:10 +0200
changeset 442
310019ddfe4e
parent 427
ec92b4ed23aa
child 510
133ac0f8f3fc
permissions
-rw-r--r--

add test for cx_linked_list_add

message(CHECK_START "Searching for CUnit test framework")

find_path(CUNIT_INCLUDE_DIR NAMES CUnit/CUnit.h)
find_library(CUNIT_LIBRARY NAMES cunit libcunit cunitlib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUnit DEFAULT_MSG CUNIT_LIBRARY CUNIT_INCLUDE_DIR)

if(CUNIT_FOUND)
    message(CHECK_PASS "found: compiling tests.")
    set(TESTS
            test_allocator
            test_list
            test_tree
    )

    foreach(test ${TESTS})
        add_executable(${test} util_allocator.c ${test}.c)
        target_link_libraries(${test} PRIVATE ucx_static ${CUNIT_LIBRARY})
        target_include_directories(${test} PRIVATE ${CUNIT_INCLUDE_DIR})
        add_test(NAME ${test} COMMAND ${test} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
    endforeach()
else()
    message(CHECK_FAIL "not found: unit tests will not be available.")
endif()

mercurial