test: Move dbus-daemon and d-d-launch-helper tests from bus/

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>
This commit is contained in:
Simon McVittie 2018-10-03 18:49:56 +01:00
parent 2732038528
commit a15839da9b
7 changed files with 38 additions and 49 deletions

View 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

View 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)

View 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")

View 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

View file

@ -23,18 +23,27 @@
*/
#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)
{

View file

@ -24,12 +24,12 @@
#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

View 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>