diff options
author | Simon McVittie <smcv@collabora.com> | 2018-10-03 19:01:42 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2019-01-21 15:18:46 +0000 |
commit | e23bba929a54a4fa3b140e7240955d8121942a5d (patch) | |
tree | fc1a2eda22cce212bdcc2ff9108f217b69190ee4 | |
parent | b28e0886ed58570b769d1ea7a8c6518e0fc0237f (diff) | |
download | dbus-e23bba929a54a4fa3b140e7240955d8121942a5d.tar.gz |
test: Move dbus-daemon-launch-helper-test here, and rename
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>
-rw-r--r-- | bus/Makefile.am | 35 | ||||
-rw-r--r-- | cmake/CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/bus/CMakeLists.txt | 8 | ||||
-rw-r--r-- | cmake/test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | test/Makefile.am | 7 | ||||
-rw-r--r-- | test/bus/launch-helper-for-tests.c | 8 |
7 files changed, 19 insertions, 44 deletions
diff --git a/bus/Makefile.am b/bus/Makefile.am index fef3210a..455437a8 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -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 diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 429205b3..336fd049 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -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}") diff --git a/cmake/bus/CMakeLists.txt b/cmake/bus/CMakeLists.txt index 31a03fff..47479dfb 100644 --- a/cmake/bus/CMakeLists.txt +++ b/cmake/bus/CMakeLists.txt @@ -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) diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index ccc783e7..def93a4c 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -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() diff --git a/configure.ac b/configure.ac index a5a7fd3e..98afc6d2 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/test/Makefile.am b/test/Makefile.am index 63d748c0..02797721 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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 index 00000000..6ad003d0 --- /dev/null +++ b/test/bus/launch-helper-for-tests.c @@ -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" |