mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 05:18:00 +02:00
Convert spawn test into a standalone test executable
This test is sufficiently well-separated that there's no real need to embed it in libdbus. Move it into the test directory instead. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
d7644b7d4f
commit
037d19a328
7 changed files with 34 additions and 13 deletions
|
|
@ -171,7 +171,6 @@ set (DBUS_UTIL_SOURCES
|
|||
if (DBUS_ENABLE_EMBEDDED_TESTS)
|
||||
set (DBUS_UTIL_SOURCES
|
||||
${DBUS_UTIL_SOURCES}
|
||||
${DBUS_DIR}/dbus-spawn-test.c
|
||||
${DBUS_DIR}/dbus-test-wrappers.c
|
||||
)
|
||||
endif (DBUS_ENABLE_EMBEDDED_TESTS)
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ add_test_executable(test-printf ${TEST_DIR}/internals/printf.c dbus-testutils)
|
|||
add_helper_executable(test-privserver ${TEST_DIR}/test-privserver.c dbus-testutils)
|
||||
add_helper_executable(test-shell-service ${test-shell-service_SOURCES} dbus-testutils)
|
||||
add_helper_executable(test-spawn ${test-spawn_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
|
||||
if(NOT WINCE)
|
||||
add_test_executable(test-spawn-oom ${TEST_DIR}/internals/spawn-oom.c ${DBUS_INTERNAL_LIBRARIES})
|
||||
endif()
|
||||
add_helper_executable(test-exit ${test-exit_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
|
||||
# the second argument of add_helper_executable() is a whitespace-separated
|
||||
# list of source files and the third and subsequent arguments are libraries
|
||||
|
|
|
|||
|
|
@ -270,7 +270,6 @@ DBUS_UTIL_SOURCES= \
|
|||
|
||||
if DBUS_ENABLE_EMBEDDED_TESTS
|
||||
DBUS_UTIL_SOURCES += \
|
||||
dbus-spawn-test.c \
|
||||
dbus-test-wrappers.c \
|
||||
dbus-test-wrappers.h \
|
||||
$(NULL)
|
||||
|
|
|
|||
|
|
@ -56,10 +56,6 @@ static DBusTestCase tests[] =
|
|||
{ "transport-unix", _dbus_transport_unix_test },
|
||||
#endif
|
||||
|
||||
#if !defined(DBUS_WINCE)
|
||||
{ "spawn", _dbus_spawn_test },
|
||||
#endif
|
||||
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ DBUS_PRIVATE_EXPORT
|
|||
dbus_bool_t _dbus_data_slot_test (const char *test_data_dir);
|
||||
|
||||
dbus_bool_t _dbus_sysdeps_test (const char *test_data_dir);
|
||||
dbus_bool_t _dbus_spawn_test (const char *test_data_dir);
|
||||
|
||||
DBUS_PRIVATE_EXPORT
|
||||
dbus_bool_t _dbus_userdb_test (const char *test_data_dir);
|
||||
|
|
|
|||
|
|
@ -58,8 +58,12 @@ EXTRA_DIST += glib-tap-test.sh
|
|||
EXTRA_DIST += tap-test.sh.in
|
||||
|
||||
TESTS =
|
||||
noinst_PROGRAMS =
|
||||
|
||||
if DBUS_ENABLE_EMBEDDED_TESTS
|
||||
|
||||
uninstallable_test_programs =
|
||||
|
||||
## break-loader removed for now
|
||||
## these binaries are used in tests but are not themselves tests
|
||||
TEST_BINARIES = \
|
||||
|
|
@ -71,6 +75,10 @@ TEST_BINARIES = \
|
|||
test-shell-service \
|
||||
$(NULL)
|
||||
|
||||
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
|
||||
|
|
@ -85,13 +93,16 @@ endif
|
|||
|
||||
TESTS += ../dbus/test-dbus$(EXEEXT)
|
||||
|
||||
noinst_PROGRAMS += $(uninstallable_test_programs)
|
||||
TESTS += $(uninstallable_test_programs)
|
||||
|
||||
else !DBUS_ENABLE_EMBEDDED_TESTS
|
||||
|
||||
TEST_BINARIES=
|
||||
|
||||
endif !DBUS_ENABLE_EMBEDDED_TESTS
|
||||
|
||||
noinst_PROGRAMS= $(TEST_BINARIES)
|
||||
noinst_PROGRAMS += $(TEST_BINARIES)
|
||||
|
||||
# This helper is meant to crash, so if we're compiling the rest with
|
||||
# AddressSanitizer, we need to stop it from catching the SIGSEGV and
|
||||
|
|
@ -108,6 +119,8 @@ test_shell_SOURCES = shell-test.c
|
|||
test_shell_LDADD = libdbus-testutils.la
|
||||
test_spawn_SOURCES = spawn-test.c
|
||||
test_spawn_LDADD = $(top_builddir)/dbus/libdbus-internal.la
|
||||
test_spawn_oom_SOURCES = internals/spawn-oom.c
|
||||
test_spawn_oom_LDADD = $(top_builddir)/dbus/libdbus-internal.la
|
||||
|
||||
test_assertions_SOURCES = internals/assertions.c
|
||||
test_assertions_LDADD = libdbus-testutils.la $(GLIB_LIBS)
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@
|
|||
*/
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "dbus-spawn.h"
|
||||
#include "dbus-sysdeps.h"
|
||||
#include "dbus-test.h"
|
||||
#include "dbus/dbus-internals.h"
|
||||
#include "dbus/dbus-spawn.h"
|
||||
#include "dbus/dbus-sysdeps.h"
|
||||
#include "dbus/dbus-test.h"
|
||||
#include "dbus/dbus-test-wrappers.h"
|
||||
|
||||
static char *
|
||||
get_test_exec (const char *exe,
|
||||
|
|
@ -265,7 +266,7 @@ check_spawn_and_kill (void *data,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
dbus_bool_t
|
||||
static dbus_bool_t
|
||||
_dbus_spawn_test (const char *test_data_dir)
|
||||
{
|
||||
if (!_dbus_test_oom_handling ("spawn_nonexistent",
|
||||
|
|
@ -290,3 +291,14 @@ _dbus_spawn_test (const char *test_data_dir)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static DBusTestCase test = { "spawn", _dbus_spawn_test };
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char **argv)
|
||||
{
|
||||
return _dbus_test_main (argc, argv, 1, &test,
|
||||
DBUS_TEST_FLAGS_CHECK_MEMORY_LEAKS,
|
||||
NULL, NULL);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue