File tree 2 files changed +57
-0
lines changed
2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -166,3 +166,9 @@ IF ( DOXYGEN_EXECUTABLE )
166
166
CONFIGURE_FILE (doc /Doxyfile.in Doxyfile @ONLY)
167
167
ADD_CUSTOM_TARGET (docs ${DOXYGEN_EXECUTABLE} "Doxyfile" )
168
168
ENDIF ( DOXYGEN_EXECUTABLE )
169
+
170
+ ###########################################################
171
+ # TESTS
172
+ ###########################################################
173
+
174
+ add_subdirectory (tests)
Original file line number Diff line number Diff line change
1
+ include (CTest)
2
+
3
+ # catkin compatibility
4
+ if (NOT TARGET run_tests)
5
+ add_custom_target (run_tests)
6
+ endif ()
7
+
8
+ if (BUILD_TESTING)
9
+ set (TESTS
10
+ testCategory testFixedContextCategory testNDC testPattern
11
+ testErrorCollision testPriority testFilter testProperties
12
+ testConfig testPropertyConfig testRollingFileAppender testDailyRollingFileAppender
13
+ )
14
+
15
+ set (DATA log4cpp.init log4cpp.properties testProperties.properties
16
+ testConfig.log4cpp.properties testConfig.log4cpp.dailyroll.properties
17
+ )
18
+
19
+ # copy test data
20
+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
21
+ foreach (file ${DATA} )
22
+ configure_file (${file} ${CMAKE_CURRENT_BINARY_DIR} /${file} COPYONLY )
23
+ endforeach ()
24
+
25
+ include_directories (
26
+ ${PROJECT_SOURCE_DIR} /include
27
+ ${PROJECT_SOURCE_DIR} /src
28
+ )
29
+
30
+ add_executable (testmain EXCLUDE_FROM_ALL testmain.cpp)
31
+ target_link_libraries (testmain ${LOG4CPP_LIBRARY_NAME} -pthread)
32
+ #add_test(NAME testmain COMMAND testmain)
33
+
34
+ add_executable (testbench EXCLUDE_FROM_ALL Clock.cpp Clock.hh testbench.cpp)
35
+ target_link_libraries (testbench ${LOG4CPP_LIBRARY_NAME} -pthread)
36
+ #add_test(NAME testbench COMMAND testbench)
37
+
38
+ foreach (test ${TESTS} )
39
+ add_executable (${test} EXCLUDE_FROM_ALL ${test} .cpp)
40
+ target_link_libraries (${test} ${LOG4CPP_LIBRARY_NAME} -pthread)
41
+ add_test (NAME ${test} COMMAND ${test} )
42
+ endforeach ()
43
+
44
+ add_custom_target (check
45
+ COMMAND ctest -V
46
+ DEPENDS ${TESTS}
47
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
48
+ )
49
+
50
+ add_dependencies (run_tests check)
51
+ endif ()
You can’t perform that action at this time.
0 commit comments