summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2016-02-11 20:43:23 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2016-08-16 14:26:40 +0100
commit8415c2ab57495db60a9764d1d4a791d810fe9b59 (patch)
treefc58ea75bb7c1beb92d8bff325d40c0bf7e8d73e
parent7b66534945015a7ec645ed290d42dc5ba1c68e13 (diff)
downloaddbus-8415c2ab57495db60a9764d1d4a791d810fe9b59.tar.gz
Only compile test-bus-launch-helper, etc. if embedded tests are enabled
These source files are specific to the embedded tests and make no sense otherwise. Also remove a comment in the CMake build system about fixing the build of the activation helper on Windows: the activation helper is Unix-specific and always will be, since it relies on Unix setuid to function. Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94094
-rw-r--r--bus/test-launch-helper.c15
-rw-r--r--bus/test-main.c13
-rw-r--r--bus/test-system.c13
-rw-r--r--cmake/bus/CMakeLists.txt47
4 files changed, 34 insertions, 54 deletions
diff --git a/bus/test-launch-helper.c b/bus/test-launch-helper.c
index c58d06eb..0df6bf85 100644
--- a/bus/test-launch-helper.c
+++ b/bus/test-launch-helper.c
@@ -30,7 +30,10 @@
#include <dbus/dbus-internals.h>
#include <dbus/dbus-misc.h>
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
+#if !defined(DBUS_ENABLE_EMBEDDED_TESTS) || !defined(DBUS_UNIX)
+#error This file is only relevant for the embedded tests on Unix
+#endif
+
static void
die (const char *failure)
{
@@ -57,8 +60,6 @@ test_post_hook (const char *name)
{
check_memleaks (name);
}
-#endif /* DBUS_ENABLE_EMBEDDED_TESTS */
-
#ifdef ACTIVATION_LAUNCHER_DO_OOM
@@ -98,7 +99,6 @@ bus_activation_helper_oom_test (void *data)
int
main (int argc, char **argv)
{
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
const char *dir;
DBusString config_file;
@@ -138,11 +138,4 @@ main (int argc, char **argv)
printf ("%s: Success\n", argv[0]);
return 0;
-#else /* DBUS_ENABLE_EMBEDDED_TESTS */
-
- printf ("Not compiled with test support\n");
-
- return 0;
-#endif
}
-
diff --git a/bus/test-main.c b/bus/test-main.c
index faa63955..2f594626 100644
--- a/bus/test-main.c
+++ b/bus/test-main.c
@@ -31,11 +31,14 @@
#include <dbus/dbus-message-internal.h>
#include "selinux.h"
+#ifndef DBUS_ENABLE_EMBEDDED_TESTS
+#error This file is only relevant for the embedded tests
+#endif
+
#ifdef DBUS_UNIX
# include <dbus/dbus-sysdeps-unix.h>
#endif
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
static void
die (const char *failure)
{
@@ -56,7 +59,6 @@ check_memleaks (const char *name)
die ("memleaks");
}
}
-#endif /* DBUS_ENABLE_EMBEDDED_TESTS */
static DBusInitialFDs *initial_fds = NULL;
@@ -88,7 +90,6 @@ test_post_hook (void)
int
main (int argc, char **argv)
{
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
const char *dir;
const char *only;
DBusString test_data_dir;
@@ -190,10 +191,4 @@ main (int argc, char **argv)
return 0;
-#else /* DBUS_ENABLE_EMBEDDED_TESTS */
-
- printf ("Not compiled with test support\n");
-
- return 0;
-#endif
}
diff --git a/bus/test-system.c b/bus/test-system.c
index 2d7848c7..355ec77a 100644
--- a/bus/test-system.c
+++ b/bus/test-system.c
@@ -29,7 +29,10 @@
#include <dbus/dbus-sysdeps.h>
#include <dbus/dbus-internals.h>
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
+#if !defined(DBUS_ENABLE_EMBEDDED_TESTS) || !defined(DBUS_UNIX)
+#error This file is only relevant for the embedded tests on Unix
+#endif
+
static void
die (const char *failure)
{
@@ -50,7 +53,6 @@ check_memleaks (const char *name)
die ("memleaks");
}
}
-#endif /* DBUS_ENABLE_EMBEDDED_TESTS */
static void
test_pre_hook (void)
@@ -67,7 +69,6 @@ test_post_hook (void)
int
main (int argc, char **argv)
{
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
const char *dir;
DBusString test_data_dir;
@@ -98,10 +99,4 @@ main (int argc, char **argv)
printf ("%s: Success\n", argv[0]);
return 0;
-#else /* DBUS_ENABLE_EMBEDDED_TESTS */
-
- printf ("Not compiled with test support\n");
-
- return 0;
-#endif
}
diff --git a/cmake/bus/CMakeLists.txt b/cmake/bus/CMakeLists.txt
index 0dcae65a..ddaafa0f 100644
--- a/cmake/bus/CMakeLists.txt
+++ b/cmake/bus/CMakeLists.txt
@@ -122,6 +122,19 @@ if (DBUS_SERVICE)
install_targets(/bin dbus-service )
endif (DBUS_SERVICE)
+set(LAUNCH_HELPER_SOURCES ${XML_SOURCES}
+ ${BUS_DIR}/config-parser-common.c
+ ${BUS_DIR}/config-parser-trivial.c
+ ${BUS_DIR}/desktop-file.c
+ ${BUS_DIR}/utils.c
+ ${BUS_DIR}/activation-helper.c
+)
+
+if(NOT WIN32)
+ add_executable(dbus-daemon-launch-helper ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/activation-helper-bin.c )
+ target_link_libraries(dbus-daemon-launch-helper ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} )
+endif(NOT WIN32)
+
if (DBUS_ENABLE_EMBEDDED_TESTS)
set(SOURCES ${BUS_SOURCES} ${BUS_DIR}/test-main.c)
add_test_executable(test-bus "${SOURCES}" ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
@@ -135,6 +148,15 @@ if (DBUS_ENABLE_EMBEDDED_TESTS)
${BUS_DIR}/test-system.c
)
add_test_executable(test-bus-system "${test_bus_system_SOURCES}" ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} ${DBUS_BUS_LIBS})
+
+ add_executable(dbus-daemon-launch-helper-test ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/activation-helper-bin.c)
+ set_target_properties(dbus-daemon-launch-helper-test PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST")
+ target_link_libraries(dbus-daemon-launch-helper-test ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} )
+
+ set (SOURCES ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/test-launch-helper.c)
+ add_test_executable(test-bus-launch-helper "${SOURCES}" ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
+ set_target_properties(test-bus-launch-helper PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST -DACTIVATION_LAUNCHER_DO_OOM")
+ install_targets(/lib dbus-daemon-launch-helper)
endif()
endif (DBUS_ENABLE_EMBEDDED_TESTS)
@@ -153,31 +175,6 @@ endif(MSVC)
##install_file(${configdir}/system.d FILE
-
-set(LAUNCH_HELPER_SOURCES ${XML_SOURCES}
- ${BUS_DIR}/config-parser-common.c
- ${BUS_DIR}/config-parser-trivial.c
- ${BUS_DIR}/desktop-file.c
- ${BUS_DIR}/utils.c
- ${BUS_DIR}/activation-helper.c
-
-)
-
-if(NOT WIN32)
-# TODO PENDING(kdab) fix build on windows (activation-helper.c)
- add_executable(dbus-daemon-launch-helper ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/activation-helper-bin.c )
- target_link_libraries(dbus-daemon-launch-helper ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} )
-
- add_executable(dbus-daemon-launch-helper-test ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/activation-helper-bin.c)
- set_target_properties(dbus-daemon-launch-helper-test PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST")
- target_link_libraries(dbus-daemon-launch-helper-test ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} )
-
- set (SOURCES ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/test-launch-helper.c)
- add_test_executable(test-bus-launch-helper "${SOURCES}" ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
- set_target_properties(test-bus-launch-helper PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST -DACTIVATION_LAUNCHER_DO_OOM")
- install_targets(/lib dbus-daemon-launch-helper)
-endif(NOT WIN32)
-
#### Init scripts fun
#SCRIPT_IN_FILES=messagebus.in
# rc.messagebus.in