summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/dbus/CMakeLists.txt1
-rw-r--r--cmake/test/CMakeLists.txt3
-rw-r--r--dbus/Makefile.am1
-rw-r--r--dbus/dbus-test-main.c4
-rw-r--r--dbus/dbus-test.h1
-rw-r--r--test/Makefile.am15
-rw-r--r--test/internals/spawn-oom.c (renamed from dbus/dbus-spawn-test.c)22
7 files changed, 34 insertions, 13 deletions
diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt
index 77b6c10a..d25cc961 100644
--- a/cmake/dbus/CMakeLists.txt
+++ b/cmake/dbus/CMakeLists.txt
@@ -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)
diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt
index b505cc61..8d18119c 100644
--- a/cmake/test/CMakeLists.txt
+++ b/cmake/test/CMakeLists.txt
@@ -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
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
index 08fb850e..aa0f5ed0 100644
--- a/dbus/Makefile.am
+++ b/dbus/Makefile.am
@@ -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)
diff --git a/dbus/dbus-test-main.c b/dbus/dbus-test-main.c
index 7a4eda7e..76036d9c 100644
--- a/dbus/dbus-test-main.c
+++ b/dbus/dbus-test-main.c
@@ -56,10 +56,6 @@ static DBusTestCase tests[] =
{ "transport-unix", _dbus_transport_unix_test },
#endif
-#if !defined(DBUS_WINCE)
- { "spawn", _dbus_spawn_test },
-#endif
-
{ NULL }
};
diff --git a/dbus/dbus-test.h b/dbus/dbus-test.h
index 4476a5e5..29f78915 100644
--- a/dbus/dbus-test.h
+++ b/dbus/dbus-test.h
@@ -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);
diff --git a/test/Makefile.am b/test/Makefile.am
index 1e7c2db4..f408a168 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -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)
diff --git a/dbus/dbus-spawn-test.c b/test/internals/spawn-oom.c
index 6bc6f025..8551effe 100644
--- a/dbus/dbus-spawn-test.c
+++ b/test/internals/spawn-oom.c
@@ -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);
+}