test/CMakeLists.txt

Tue, 28 Dec 2021 18:05:14 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 28 Dec 2021 18:05:14 +0100
changeset 492
188942a7308b
parent 427
ec92b4ed23aa
child 510
133ac0f8f3fc
permissions
-rw-r--r--

simplifies some linked list tests

391
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
1 message(CHECK_START "Searching for CUnit test framework")
390
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents: 375
diff changeset
2
391
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
3 find_path(CUNIT_INCLUDE_DIR NAMES CUnit/CUnit.h)
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
4 find_library(CUNIT_LIBRARY NAMES cunit libcunit cunitlib)
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
5 include(FindPackageHandleStandardArgs)
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
6 find_package_handle_standard_args(CUnit DEFAULT_MSG CUNIT_LIBRARY CUNIT_INCLUDE_DIR)
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
7
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
8 if(CUNIT_FOUND)
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
9 message(CHECK_PASS "found: compiling tests.")
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
10 set(TESTS
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
11 test_allocator
413
0f4aa9fc75d9 perform array and list tests in the same test binary (use the same assertions, later)
Mike Becker <universe@uap-core.de>
parents: 398
diff changeset
12 test_list
425
a75b808d653b add cx_tree_add_node test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 413
diff changeset
13 test_tree
391
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
14 )
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
15
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
16 foreach(test ${TESTS})
422
afd87df80b13 add utility to verify allocations
Mike Becker <universe@uap-core.de>
parents: 413
diff changeset
17 add_executable(${test} util_allocator.c ${test}.c)
391
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
18 target_link_libraries(${test} PRIVATE ucx_static ${CUNIT_LIBRARY})
395
dc1bfe5ffd38 fixes missing CUnit include dir
Mike Becker <universe@uap-core.de>
parents: 391
diff changeset
19 target_include_directories(${test} PRIVATE ${CUNIT_INCLUDE_DIR})
391
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
20 add_test(NAME ${test} COMMAND ${test} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
21 endforeach()
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
22 else()
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
23 message(CHECK_FAIL "not found: unit tests will not be available.")
f094a53c1178 adds allocator interface and default implementation
Mike Becker <universe@uap-core.de>
parents: 390
diff changeset
24 endif()

mercurial