1 include_directories(${CMAKE_SOURCE_DIR}/../test)
3 add_definitions(${DBUS_INTERNAL_CLIENT_DEFINITIONS})
5 include_directories(${CMAKE_SOURCE_DIR}/../test)
7 set(DBUS_SESSION_BUS_LISTEN_ADDRESS ${TEST_LISTEN})
9 add_library(dbus-testutils STATIC
10 ${CMAKE_SOURCE_DIR}/../test/test-utils.h
11 ${CMAKE_SOURCE_DIR}/../test/test-utils.c
13 target_link_libraries(dbus-testutils ${DBUS_INTERNAL_LIBRARIES})
15 add_subdirectory( name-test )
17 set (manual-dir-iter_SOURCES
18 ${CMAKE_SOURCE_DIR}/../test/manual-dir-iter.c
21 set (test-service_SOURCES
22 ${CMAKE_SOURCE_DIR}/../test/test-service.c
25 set (test-names_SOURCES
26 ${CMAKE_SOURCE_DIR}/../test/test-names.c
29 set (break_loader_SOURCES
30 ${CMAKE_SOURCE_DIR}/../test/break-loader.c
33 set (test-shell-service_SOURCES
34 ${CMAKE_SOURCE_DIR}/../test/test-shell-service.c
37 set (test-shell_SOURCES
38 ${CMAKE_SOURCE_DIR}/../test/shell-test.c
41 set (test-spawn_SOURCES
42 ${CMAKE_SOURCE_DIR}/../test/spawn-test.c
45 set (test-exit_SOURCES
46 ${CMAKE_SOURCE_DIR}/../test/test-exit.c
49 set (test-segfault_SOURCES
50 ${CMAKE_SOURCE_DIR}/../test/test-segfault.c
53 set (test-sleep-forever_SOURCES
54 ${CMAKE_SOURCE_DIR}/../test/test-sleep-forever.c
57 set (manual-tcp_SOURCES
58 ${CMAKE_SOURCE_DIR}/../test/manual-tcp.c
61 set (manual-paths_SOURCES
62 ${CMAKE_SOURCE_DIR}/../test/manual-paths.c
65 add_helper_executable(manual-dir-iter ${manual-dir-iter_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
66 add_helper_executable(test-service ${test-service_SOURCES} dbus-testutils)
67 add_helper_executable(test-names ${test-names_SOURCES} dbus-testutils)
68 add_test_executable(test-shell ${test-shell_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
69 add_test_executable(test-printf ${CMAKE_SOURCE_DIR}/../test/internals/printf.c dbus-testutils)
70 add_helper_executable(test-shell-service ${test-shell-service_SOURCES} dbus-testutils)
71 add_helper_executable(test-spawn ${test-spawn_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
72 add_helper_executable(test-exit ${test-exit_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
73 add_helper_executable(test-segfault ${test-segfault_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
74 add_helper_executable(test-sleep-forever ${test-sleep-forever_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
75 add_helper_executable(manual-tcp ${manual-tcp_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
76 add_helper_executable(manual-backtrace ${CMAKE_SOURCE_DIR}/../test/manual-backtrace.c dbus-1)
78 add_helper_executable(manual-paths ${manual-paths_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
82 message(STATUS "with glib test apps")
84 add_library(dbus-testutils-glib STATIC
85 ${CMAKE_SOURCE_DIR}/../test/test-utils-glib.h
86 ${CMAKE_SOURCE_DIR}/../test/test-utils-glib.c
88 target_link_libraries(dbus-testutils-glib dbus-testutils ${DBUS_INTERNAL_LIBRARIES})
92 ${GOBJECT_DEFINITIONS}
96 ${GOBJECT_INCLUDE_DIR}
99 set(TEST_LIBRARIES ${DBUS_INTERNAL_LIBRARIES} dbus-testutils dbus-testutils-glib ${GLIB2_LIBRARIES} ${GOBJECT_LIBRARIES})
101 add_test_executable(test-corrupt ${CMAKE_SOURCE_DIR}/../test/corrupt.c ${TEST_LIBRARIES})
102 add_test_executable(test-dbus-daemon ${CMAKE_SOURCE_DIR}/../test/dbus-daemon.c ${TEST_LIBRARIES})
103 add_test_executable(test-dbus-daemon-eavesdrop ${CMAKE_SOURCE_DIR}/../test/dbus-daemon-eavesdrop.c ${TEST_LIBRARIES})
104 add_test_executable(test-fdpass ${CMAKE_SOURCE_DIR}/../test/fdpass.c ${TEST_LIBRARIES})
105 add_test_executable(test-loopback ${CMAKE_SOURCE_DIR}/../test/loopback.c ${TEST_LIBRARIES})
106 add_test_executable(test-marshal ${CMAKE_SOURCE_DIR}/../test/marshal.c ${TEST_LIBRARIES})
107 add_test_executable(test-monitor ${CMAKE_SOURCE_DIR}/../test/monitor.c ${TEST_LIBRARIES})
108 add_test_executable(test-refs ${CMAKE_SOURCE_DIR}/../test/internals/refs.c ${TEST_LIBRARIES})
109 add_test_executable(test-relay ${CMAKE_SOURCE_DIR}/../test/relay.c ${TEST_LIBRARIES})
110 add_test_executable(test-server-oom ${CMAKE_SOURCE_DIR}/../test/internals/server-oom.c ${TEST_LIBRARIES})
111 add_test_executable(test-syntax ${CMAKE_SOURCE_DIR}/../test/syntax.c ${TEST_LIBRARIES})
112 add_test_executable(test-syslog ${CMAKE_SOURCE_DIR}/../test/internals/syslog.c ${TEST_LIBRARIES})
113 add_test_executable(test-uid-permissions ${CMAKE_SOURCE_DIR}/../test/uid-permissions.c ${TEST_LIBRARIES})
114 add_helper_executable(manual-authz ${CMAKE_SOURCE_DIR}/../test/manual-authz.c ${TEST_LIBRARIES})
117 ### keep these in creation order, i.e. uppermost dirs first
120 test/data/valid-messages
121 test/data/invalid-messages
122 test/data/incomplete-messages
125 test/data/systemd-activation
126 test/data/valid-config-files
127 test/data/valid-config-files/basic.d
128 test/data/valid-config-files/session.d
129 test/data/valid-config-files-system
130 test/data/valid-config-files-system/system.d
131 test/data/valid-messages
132 test/data/valid-service-files
133 test/data/valid-service-files-system
134 test/data/invalid-config-files
135 test/data/invalid-config-files-system
136 test/data/invalid-messages
137 test/data/invalid-service-files-system
138 test/data/equiv-config-files
139 test/data/equiv-config-files/basic
140 test/data/equiv-config-files/basic/basic.d
141 test/data/equiv-config-files/entities
142 test/data/equiv-config-files/entities/basic.d
144 set (CONFIG_VERBOSE 0)
146 FOREACH(DIR ${TESTDIRS})
147 FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
150 ### copy tests to builddir so that generated tests and static tests
151 ### are all in one place.
152 MESSAGE(STATUS "Copying test files to test directory")
153 FOREACH(FILE_TYPE *.message *.message-raw *.auth-script *.sha1 *.txt *.conf *.service)
154 FOREACH(DIR ${TESTDIRS})
155 FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" )
156 FOREACH(FILE ${FILES})
157 GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
158 SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
159 configure_file(${FILE} ${TARGET} COPYONLY)
162 ENDIF (CONFIG_VERBOSE)
165 ENDFOREACH(FILE_TYPE)
167 ### generate test files
168 MESSAGE(STATUS "Generating test files from templates into test directory")
170 FOREACH(FILE_TYPE *.conf.in *.service.in)
171 FOREACH(DIR ${TESTDIRS})
172 FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" )
173 FOREACH(FILE ${FILES})
174 GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
175 STRING(REGEX REPLACE "\\.in$" "" FILENAME ${FILENAME})
176 SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
177 configure_file(${FILE} ${TARGET} @ONLY IMMEDIATE)
180 ENDIF (CONFIG_VERBOSE)
183 ENDFOREACH(FILE_TYPE)
185 MESSAGE(STATUS "Copying generated bus config files to test directory")
186 configure_file("${CMAKE_SOURCE_DIR}/../bus/session.conf.in" ${CMAKE_BINARY_DIR}/test/data/valid-config-files/session.conf @ONLY)
187 configure_file("${CMAKE_SOURCE_DIR}/../bus/system.conf.in" ${CMAKE_BINARY_DIR}/test/data/valid-config-files-system/system.conf @ONLY)