]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test: Move dbus-daemon-launch-helper-test here, and rename
authorSimon McVittie <smcv@collabora.com>
Wed, 3 Oct 2018 18:01:42 +0000 (19:01 +0100)
committerSimon McVittie <smcv@collabora.com>
Mon, 21 Jan 2019 15:18:46 +0000 (15:18 +0000)
The -test suffix does not indicate that this is a test, but rather that
it is for tests (similar to the -unix and -win suffixes on modules like
dbus-sysdeps). This seems unnecessarily confusing, so rename it to end
with -for-tests.

Signed-off-by: Simon McVittie <smcv@collabora.com>
bus/Makefile.am
cmake/CMakeLists.txt
cmake/bus/CMakeLists.txt
cmake/test/CMakeLists.txt
configure.ac
test/Makefile.am
test/bus/launch-helper-for-tests.c [new file with mode: 0644]

index fef3210acc4ef56f0b86e5b11fa383838cd487ca..455437a8ace01baf97477f6b4c257f687d33f95d 100644 (file)
@@ -155,8 +155,8 @@ liblaunch_helper_internal_la_SOURCES =              \
 
 ## This is the installed launch helper with the setuid checks
 ## All files that have special cases #ifdef ACTIVATION_LAUNCHER_TEST must
-## be here and in dbus_daemon_launch_helper_test_SOURCES, not in
-## liblaunch-helper-internal.la.
+## be listed here and included in test/bus/launch-helper-for-tests.c,
+## not in liblaunch-helper-internal.la.
 dbus_daemon_launch_helper_SOURCES = \
        activation-helper.c \
        activation-helper-bin.c \
@@ -168,21 +168,6 @@ liblaunch_helper_internal_la_LIBADD = \
        $(top_builddir)/dbus/libdbus-internal.la \
        $(DBUS_LAUNCHER_LIBS)
 
-## we build another binary so we can do the launch testing without root privs.
-## DO NOT INSTALL THIS FILE
-## All files that have special cases #ifdef ACTIVATION_LAUNCHER_TEST must
-## be here and in dbus_daemon_launch_helper_SOURCES, not in
-## liblaunch-helper-internal.la.
-dbus_daemon_launch_helper_test_SOURCES=                \
-       activation-helper.c \
-       activation-helper-bin.c \
-       $(NULL)
-dbus_daemon_launch_helper_test_LDADD = liblaunch-helper-internal.la
-
-dbus_daemon_launch_helper_test_CPPFLAGS = \
-       $(AM_CPPFLAGS) \
-       -DACTIVATION_LAUNCHER_TEST
-
 noinst_PROGRAMS =
 dbus_daemon_exec_PROGRAMS = dbus-daemon
 if DBUS_UNIX
@@ -190,22 +175,6 @@ noinst_LTLIBRARIES += liblaunch-helper-internal.la
 libexec_PROGRAMS = dbus-daemon-launch-helper
 endif DBUS_UNIX
 
-## Note that TESTS has special meaning (stuff to use in make check).
-## We don't actually want to run any of these tests until test/ has been
-## compiled, so we don't put them in TESTS here; we run them in test/
-## instead.
-
-if DBUS_ENABLE_EMBEDDED_TESTS
-## we use noinst_PROGRAMS not check_PROGRAMS so that we build
-## even when not doing "make check"
-
-if DBUS_UNIX
-# 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
-
 install-data-hook:
        $(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/session.d
        $(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/services
index 429205b30c98a8ec3eca9c5eb55e0b22634aa649..336fd049bcb05ed5d8a1b8ba008c3effe973ad0a 100644 (file)
@@ -495,7 +495,7 @@ if (DBUS_BUILD_TESTS)
     set(DBUS_TEST_DBUS_LAUNCH ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN}/dbus-launch${EXEEXT})
     set(DBUS_TEST_HOMEDIR ${Z_DRIVE_IF_WINE}${CMAKE_BINARY_DIR}/dbus)
     set(DBUS_TEST_RUN_SESSION ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN}/dbus-run-session${EXEEXT})
-    set(TEST_LAUNCH_HELPER_BINARY ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN}/dbus-daemon-launch-helper-test${EXEEXT})
+    set(TEST_LAUNCH_HELPER_BINARY ${Z_DRIVE_IF_WINE}${DBUS_TEST_EXEC}/dbus-daemon-launch-helper-for-tests${EXEEXT})
     if (UNIX)
         set(TEST_SOCKET_DIR ${DBUS_SESSION_SOCKET_DIR})
         set(TEST_LISTEN "unix:tmpdir=${TEST_SOCKET_DIR}")
index 31a03fff888ae1a2a7d36d6f90e4a913215d0984..47479dfbe36e4b52e9ab4f6e38011c66760b70ff 100644 (file)
@@ -155,14 +155,6 @@ if(NOT WIN32)
        target_link_libraries(dbus-daemon-launch-helper launch-helper-internal)
 endif(NOT WIN32)
 
-if (DBUS_ENABLE_EMBEDDED_TESTS)
-       if (NOT WIN32)
-               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)
-       endif()
-endif (DBUS_ENABLE_EMBEDDED_TESTS)
-
 if(MSVC)
        project_source_group(${GROUP_CODE} bus_test_SOURCES dummy)
 endif(MSVC)
index ccc783e757d94bdbf22c9fb85df65c7326e229ec..def93a4cf205c7f61a9511a9373e7d16b9fc479b 100644 (file)
@@ -111,6 +111,7 @@ if(DBUS_ENABLE_EMBEDDED_TESTS)
     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)
+        add_helper_executable(dbus-daemon-launch-helper-for-tests ${TEST_DIR}/bus/launch-helper-for-tests.c launch-helper-internal)
     endif()
 endif()
 
index a5a7fd3e9dcaf44413b75011f919cb3543a02123..98afc6d255732ead624b5aab3e119fd309a95a87 100644 (file)
@@ -1565,7 +1565,7 @@ AC_DEFINE_UNQUOTED([DBUS_EXEEXT], ["$EXEEXT"],
                    [Extension for executables, typically empty or .exe])
 
 ## Export the non-setuid external helper
-TEST_LAUNCH_HELPER_BINARY="$DBUS_PWD/bus/dbus-daemon-launch-helper-test$EXEEXT"
+TEST_LAUNCH_HELPER_BINARY="$DBUS_TEST_EXEC/dbus-daemon-launch-helper-for-tests$EXEEXT"
 AC_SUBST(TEST_LAUNCH_HELPER_BINARY)
 AC_DEFINE_UNQUOTED(DBUS_TEST_LAUNCH_HELPER_BINARY, "$TEST_LAUNCH_HELPER_BINARY",
                    [Full path to the launch helper test program in the builddir])
index 63d748c0c63da0fadb8cbe7cc9c55c4b113e6a0f..02797721838250bbfae65dcc77d7f12d5fa5760f 100644 (file)
@@ -89,6 +89,8 @@ uninstallable_test_programs += \
 if DBUS_UNIX
 uninstallable_test_programs += test-bus-launch-helper-oom
 uninstallable_test_programs += test-bus-system
+# this is used by the tests but is not, itself, a test
+TEST_BINARIES += dbus-daemon-launch-helper-for-tests
 endif
 
 noinst_PROGRAMS += $(uninstallable_test_programs)
@@ -165,6 +167,9 @@ 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
 
+dbus_daemon_launch_helper_for_tests_SOURCES = bus/launch-helper-for-tests.c
+dbus_daemon_launch_helper_for_tests_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
 
@@ -661,7 +666,7 @@ uninstalled-config-local:
                        -e 's,[@]DBUS_TEST_EXEC[@],@abs_builddir@,' \
                        -e 's,[@]DBUS_USER[@],$(DBUS_USER),' \
                        -e 's,[@]EXEEXT[@],$(EXEEXT),' \
-                       -e 's,[@]TEST_LAUNCH_HELPER_BINARY[@],@abs_top_builddir@/bus/dbus-daemon-launch-helper-test$(EXEEXT),' \
+                       -e 's,[@]TEST_LAUNCH_HELPER_BINARY[@],@abs_top_builddir@/test/dbus-daemon-launch-helper-for-tests$(EXEEXT),' \
                        -e 's,[@]TEST_LISTEN[@],$(TEST_LISTEN),' \
                        < $(srcdir)/"$$F" > "$${F%.in}"; \
        done
diff --git a/test/bus/launch-helper-for-tests.c b/test/bus/launch-helper-for-tests.c
new file mode 100644 (file)
index 0000000..6ad003d
--- /dev/null
@@ -0,0 +1,8 @@
+/* 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
+#include "bus/activation-helper.c"
+#include "bus/activation-helper-bin.c"