0
|
1 # Test directory
|
|
2 PROJECT("libfreediameter tests" C)
|
|
3
|
|
4 # give the possibility to configure the timeout duration for the tests
|
|
5 OPTION(TEST_TIMEOUT "Timeout for the tests, in seconds (default: 5)?")
|
|
6 IF(TEST_TIMEOUT)
|
|
7 ADD_DEFINITIONS(-DTEST_TIMEOUT=${TEST_TIMEOUT})
|
|
8 ENDIF(TEST_TIMEOUT)
|
|
9
|
|
10
|
|
11 #############################
|
|
12 # List the test cases
|
|
13 SET(TEST_LIST
|
|
14 testdict
|
|
15 testmesg
|
|
16 testmq
|
|
17 )
|
|
18
|
|
19 #############################
|
|
20 # Some parameters for the tests
|
|
21
|
|
22 # Add this flag to add some debug information in the tests themselves
|
|
23 ADD_DEFINITIONS(-DTEST_DEBUG)
|
|
24
|
|
25 INCLUDE_DIRECTORIES( ".." )
|
|
26
|
|
27 SET(TEST_COMMON_SRC "")
|
|
28
|
|
29 FOREACH( SRC_FILE ${FD_COMMON_SRC})
|
|
30 SET(TEST_COMMON_SRC ${TEST_COMMON_SRC} "../${SRC_FILE}")
|
|
31 ENDFOREACH(SRC_FILE)
|
|
32
|
|
33 # FOREACH( SRC_FILE ${FD_COMMON_GEN_SRC})
|
|
34 # SET(TEST_COMMON_SRC ${TEST_COMMON_SRC} "${CMAKE_CURRENT_BINARY_DIR}/../${SRC_FILE}")
|
|
35 # ENDFOREACH(SRC_FILE)
|
|
36
|
|
37 # Create an archive with the daemon common files
|
|
38 ADD_LIBRARY(fdcore STATIC ${TEST_COMMON_SRC})
|
|
39
|
|
40
|
|
41 #############################
|
|
42 # Compile each test
|
|
43 FOREACH( TEST ${TEST_LIST} )
|
|
44 ADD_EXECUTABLE(${TEST} ${TEST}.c tests.h)
|
|
45 TARGET_LINK_LIBRARIES(${TEST} libfreediameter fdcore ${FD_LIBS})
|
|
46 ADD_TEST(${TEST} ${EXECUTABLE_OUTPUT_PATH}/${TEST})
|
|
47 ENDFOREACH( TEST )
|