diff options
author | Havoc Pennington <hp@redhat.com> | 2003-04-05 00:37:17 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-04-05 00:37:17 +0000 |
commit | 03b9ca6d4ecf2577958530b8390d675c73a58825 (patch) | |
tree | be0569a447ef9acaf5a0004fb9bfe1a2022c9eb1 /test | |
parent | 45d1479fad0fb55f1775c394e696643dad3e8e4d (diff) |
2003-04-04 Havoc Pennington <hp@redhat.com>
* dbus/dbus-spawn.c, dbus/dbus-spawn.h: Change dbus_spawn to
return a "babysitter" object that is used to monitor the status of
the spawned process and reap it when required.
* test/test-segfault.c, test/test-exit.c,
test/test-sleep-forever.c: binaries that do various lame things,
used in the test suite.
* dbus/dbus-sysdeps.c: kill _dbus_errno_to_string()
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 11 | ||||
-rw-r--r-- | test/spawn-test.c | 3 | ||||
-rw-r--r-- | test/test-exit.c | 8 | ||||
-rw-r--r-- | test/test-segfault.c | 14 | ||||
-rw-r--r-- | test/test-sleep-forever.c | 12 |
5 files changed, 46 insertions, 2 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index d0429aaf..c46b2797 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,7 +2,7 @@ INCLUDES=-I$(top_srcdir) $(DBUS_TEST_CFLAGS) if DBUS_BUILD_TESTS -TEST_BINARIES=test-service echo-client echo-server unbase64 break-loader spawn-test +TEST_BINARIES=test-service echo-client echo-server unbase64 break-loader spawn-test test-segfault test-exit test-sleep-forever else TEST_BINARIES= endif @@ -40,6 +40,15 @@ break_loader_SOURCES= \ spawn_test_SOURCES= \ spawn-test.c +test_exit_SOURCES = \ + test-exit.c + +test_segfault_SOURCES = \ + test-segfault.c + +test_sleep_forever_SOURCES = \ + test-sleep-forever.c + TEST_LIBS=$(DBUS_TEST_LIBS) $(top_builddir)/dbus/libdbus-convenience.la echo_client_LDADD=$(TEST_LIBS) diff --git a/test/spawn-test.c b/test/spawn-test.c index 18462eba..f323368f 100644 --- a/test/spawn-test.c +++ b/test/spawn-test.c @@ -2,6 +2,7 @@ #define DBUS_COMPILATION /* cheat and use dbus-sysdeps */ #include <dbus/dbus-sysdeps.h> +#include <dbus/dbus-spawn.h> #undef DBUS_COMPILATION #include <stdio.h> @@ -30,7 +31,7 @@ main (int argc, char **argv) argv_copy [i] = argv[i + 1]; argv_copy[argc - 1] = NULL; - if (!_dbus_spawn_async (argv_copy, setup_func, NULL, &error)) + if (!_dbus_spawn_async_with_babysitter (NULL, argv_copy, setup_func, NULL, &error)) { fprintf (stderr, "Could not launch application: \"%s\"\n", error.message); diff --git a/test/test-exit.c b/test/test-exit.c new file mode 100644 index 00000000..abb95865 --- /dev/null +++ b/test/test-exit.c @@ -0,0 +1,8 @@ +/* This is a process that just exits with a failure code */ + +int +main (int argc, char **argv) +{ + + return 1; +} diff --git a/test/test-segfault.c b/test/test-segfault.c new file mode 100644 index 00000000..6c197823 --- /dev/null +++ b/test/test-segfault.c @@ -0,0 +1,14 @@ +/* This is simply a process that segfaults */ +#include <signal.h> + +int +main (int argc, char **argv) +{ + char *p = 0; + + raise (SIGSEGV); + + *p = 'a'; + + return 0; +} diff --git a/test/test-sleep-forever.c b/test/test-sleep-forever.c new file mode 100644 index 00000000..7d9541e8 --- /dev/null +++ b/test/test-sleep-forever.c @@ -0,0 +1,12 @@ +/* This is a process that just sleeps infinitely. */ + +#include <unistd.h> + +int +main (int argc, char **argv) +{ + while (1) + sleep (10000000); + + return 1; +} |