]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test: Move dbus-daemon and d-d-launch-helper tests from bus/
authorSimon McVittie <smcv@collabora.com>
Wed, 3 Oct 2018 17:49:56 +0000 (18:49 +0100)
committerSimon McVittie <smcv@collabora.com>
Mon, 21 Jan 2019 15:16:51 +0000 (15:16 +0000)
This groups them with the other tests, and avoids having them influence
the test coverage stats in bus/.

Signed-off-by: Simon McVittie <smcv@collabora.com>
bus/Makefile.am
cmake/bus/CMakeLists.txt
cmake/test/CMakeLists.txt
test/Makefile.am
test/bus/launch-helper-oom.c [moved from bus/test-launch-helper.c with 86% similarity]
test/bus/main.c [moved from bus/test-main.c with 97% similarity]
test/bus/system.c [moved from bus/test-system.c with 98% similarity]

index 3b049df52155e51a86cb552f27e32438cf5a9665..fef3210acc4ef56f0b86e5b11fa383838cd487ca 100644 (file)
@@ -183,19 +183,6 @@ dbus_daemon_launch_helper_test_CPPFLAGS = \
        $(AM_CPPFLAGS) \
        -DACTIVATION_LAUNCHER_TEST
 
-## we build yet another binary so we can do the OOM tests
-## DO NOT INSTALL THIS FILE
-test_bus_launch_helper_SOURCES = \
-       activation-helper.c \
-       test-launch-helper.c \
-       $(NULL)
-test_bus_launch_helper_LDADD = liblaunch-helper-internal.la
-
-test_bus_launch_helper_CPPFLAGS = \
-       $(AM_CPPFLAGS) \
-       -DACTIVATION_LAUNCHER_TEST      \
-       -DACTIVATION_LAUNCHER_DO_OOM
-
 noinst_PROGRAMS =
 dbus_daemon_exec_PROGRAMS = dbus-daemon
 if DBUS_UNIX
@@ -212,24 +199,13 @@ if DBUS_ENABLE_EMBEDDED_TESTS
 ## we use noinst_PROGRAMS not check_PROGRAMS so that we build
 ## even when not doing "make check"
 
-# run as a test by test/Makefile.am
-noinst_PROGRAMS += test-bus
-
 if DBUS_UNIX
-# run as a test by test/Makefile.am
-noinst_PROGRAMS += test-bus-launch-helper test-bus-system
 # this is used by the tests but is not,itself, a test
 noinst_PROGRAMS += dbus-daemon-launch-helper-test
 endif DBUS_UNIX
 
 endif DBUS_ENABLE_EMBEDDED_TESTS
 
-test_bus_system_SOURCES = test-system.c
-test_bus_system_LDADD = liblaunch-helper-internal.la
-
-test_bus_SOURCES = test-main.c
-test_bus_LDADD = libdbus-daemon-internal.la
-
 install-data-hook:
        $(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/session.d
        $(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/services
index 24f3bf69e02739d269f331366da347661c8002fc..31a03fff888ae1a2a7d36d6f90e4a913215d0984 100644 (file)
@@ -156,19 +156,10 @@ if(NOT WIN32)
 endif(NOT WIN32)
 
 if (DBUS_ENABLE_EMBEDDED_TESTS)
-       set(SOURCES ${BUS_DIR}/test-main.c)
-       add_test_executable(test-bus "${SOURCES}" dbus-daemon-internal ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES})
-       set_target_properties(test-bus PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
        if (NOT WIN32)
-               add_test_executable(test-bus-system ${BUS_DIR}/test-system.c launch-helper-internal)
-
                add_executable(dbus-daemon-launch-helper-test ${BUS_DIR}/activation-helper.c ${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 launch-helper-internal)
-
-               set (SOURCES ${BUS_DIR}/activation-helper.c ${BUS_DIR}/test-launch-helper.c)
-               add_test_executable(test-bus-launch-helper "${SOURCES}" launch-helper-internal)
-               set_target_properties(test-bus-launch-helper PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST -DACTIVATION_LAUNCHER_DO_OOM")
        endif()
 endif (DBUS_ENABLE_EMBEDDED_TESTS)
 
index 8d18119c37102871ec4c81441bf76cebf8975fa6..71d358d3b3b5e6dd9a2d9d0d1d52012f0a898ccf 100644 (file)
@@ -92,6 +92,17 @@ if(WIN32)
     add_helper_executable(manual-paths ${manual-paths_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
 endif()
 
+if(DBUS_ENABLE_EMBEDDED_TESTS)
+    set(SOURCES ${TEST_DIR}/bus/main.c)
+    add_test_executable(test-bus "${SOURCES}" dbus-daemon-internal ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES})
+    set_target_properties(test-bus PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
+
+    if(NOT WIN32)
+        add_test_executable(test-bus-system ${TEST_DIR}/bus/system.c launch-helper-internal)
+        add_test_executable(test-bus-launch-helper-oom ${TEST_DIR}/bus/launch-helper-oom.c launch-helper-internal)
+    endif()
+endif()
+
 if(DBUS_WITH_GLIB)
     message(STATUS "with glib test apps")
 
index f408a1680b9dde85ad0e0caaa828084aaf5ad5ca..5d34f2be13d47ab82983ef6f1706af7cfa8b6630 100644 (file)
@@ -79,16 +79,11 @@ if !DBUS_WINCE
 uninstallable_test_programs += test-spawn-oom
 endif
 
-## These are conceptually part of directories that come earlier in SUBDIRS
-## order, but we don't want to run them til we arrive in this directory,
-## since they depend on stuff from this directory. We wrap some of them in a
-## simple shell script to get TAP output.
-
-TESTS += ../bus/test-bus$(EXEEXT)
+uninstallable_test_programs += test-bus
 
 if DBUS_UNIX
-TESTS += ../bus/test-bus-launch-helper$(EXEEXT)
-TESTS += ../bus/test-bus-system$(EXEEXT)
+uninstallable_test_programs += test-bus-launch-helper-oom
+uninstallable_test_programs += test-bus-system
 endif
 
 TESTS += ../dbus/test-dbus$(EXEEXT)
@@ -164,6 +159,15 @@ manual_paths_LDADD = $(top_builddir)/dbus/libdbus-internal.la
 manual_tcp_SOURCES = manual-tcp.c
 manual_tcp_LDADD = $(top_builddir)/dbus/libdbus-internal.la
 
+test_bus_launch_helper_oom_SOURCES = bus/launch-helper-oom.c
+test_bus_launch_helper_oom_LDADD = $(top_builddir)/bus/liblaunch-helper-internal.la
+
+test_bus_system_SOURCES = bus/system.c
+test_bus_system_LDADD = $(top_builddir)/bus/liblaunch-helper-internal.la
+
+test_bus_SOURCES = bus/main.c
+test_bus_LDADD = $(top_builddir)/bus/libdbus-daemon-internal.la
+
 EXTRA_DIST += dbus-test-runner
 
 testexecdir = $(libexecdir)/installed-tests/dbus
similarity index 86%
rename from bus/test-launch-helper.c
rename to test/bus/launch-helper-oom.c
index 3b0d0d99a003c779a98cbfe77e97c6522c91729f..4aaa03c2e932cc60fd7cfc689a5c98be9c7b2bc8 100644 (file)
  */
 
 #include <config.h>
-#include "test.h"
-#include "activation-helper.h"
+
+#include "bus/test.h"
 
 #include <dbus/dbus-internals.h>
 #include <dbus/dbus-test-tap.h>
 #include <dbus/dbus-test-wrappers.h>
 
+#include "bus/activation-helper.h"
+
 #if !defined(DBUS_ENABLE_EMBEDDED_TESTS) || !defined(DBUS_UNIX)
 #error This file is only relevant for the embedded tests on Unix
 #endif
 
-#ifdef ACTIVATION_LAUNCHER_DO_OOM
+/* Embed a version of the real activation helper that has been altered
+ * to be testable. We monkey-patch it like this because we don't want to
+ * compile test-only code into the real setuid executable, and Automake
+ * versions older than 1.16 can't cope with expanding directory variables
+ * in SOURCES when using subdir-objects. */
+#define ACTIVATION_LAUNCHER_TEST
+#define ACTIVATION_LAUNCHER_DO_OOM
+#include "bus/activation-helper.c"
 
 /* returns true if good things happen, or if we get OOM */
 static dbus_bool_t
@@ -69,8 +78,6 @@ bus_activation_helper_oom_test (void        *data,
   return retval;
 }
 
-#endif
-
 static dbus_bool_t
 bus_activation_helper_test (const char *test_data_dir)
 {
similarity index 97%
rename from bus/test-main.c
rename to test/bus/main.c
index d6dbe8b38fabb8d877cc27dd1adb7b7e58689a93..67e5c65ce15ad71bf11eafa6076c8c73732acab4 100644 (file)
 
 #include <config.h>
 
-#include "test.h"
+#include "bus/test.h"
 
 #include <dbus/dbus-test-tap.h>
 #include <dbus/dbus-test-wrappers.h>
 
-#include "selinux.h"
+#include "bus/selinux.h"
 
 #ifndef DBUS_ENABLE_EMBEDDED_TESTS
 #error This file is only relevant for the embedded tests
similarity index 98%
rename from bus/test-system.c
rename to test/bus/system.c
index a2a4458e5358f7c5c25d181a8cadfa8f8a7e557e..9a41826a49a1e4b39206f51ed207e491e348187c 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <config.h>
 
-#include "test.h"
+#include "bus/test.h"
 
 #include <dbus/dbus-test-tap.h>
 #include <dbus/dbus-test-wrappers.h>