## 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 \
$(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
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
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}")
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)
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()
[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])
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)
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
-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
--- /dev/null
+/* 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"