diff options
author | Colin Walters <walters@verbum.org> | 2008-06-11 18:01:16 -0400 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2010-12-04 23:03:13 +0100 |
commit | aff626356112ad2d94972e59b16eed267e603fe6 (patch) | |
tree | b7adb0b7b9e8ee7cbde1fbf4a3c90f68ec3569cb /test/name-test | |
parent | 2366423e9795f7bd7e8f7e0f0be7418bf81c5152 (diff) | |
download | dbus-aff626356112ad2d94972e59b16eed267e603fe6.tar.gz dbus-aff626356112ad2d94972e59b16eed267e603fe6.tar.bz2 dbus-aff626356112ad2d94972e59b16eed267e603fe6.zip |
Added a test-autolaunch.
* test/name-test/test-autolaunch.c: New file,
unsets DBUS_SESSION_BUS_ADDRESS so we should
fall back to autolaunch:.
* test/name-test/run-test.sh: Run it.
* test/name-test/Makefile.am: Build it.
Diffstat (limited to 'test/name-test')
-rw-r--r-- | test/name-test/Makefile.am | 15 | ||||
-rwxr-xr-x | test/name-test/run-test.sh | 3 | ||||
-rw-r--r-- | test/name-test/test-autolaunch.c | 31 |
3 files changed, 48 insertions, 1 deletions
diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am index 11dc56d1..1b5722b0 100644 --- a/test/name-test/Makefile.am +++ b/test/name-test/Makefile.am @@ -16,7 +16,13 @@ if DBUS_BUILD_TESTS ## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we ## build even when not doing "make check" -noinst_PROGRAMS=test-pending-call-dispatch test-pending-call-timeout test-threads-init test-ids test-shutdown test-privserver test-privserver-client +noinst_PROGRAMS=test-pending-call-dispatch test-pending-call-timeout test-threads-init test-ids test-shutdown test-privserver test-privserver-client test-autolaunch + +test_names_SOURCES= \ + test-names.c + +test_names_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS) +test_names_LDFLAGS=@R_DYNAMIC_LDFLAG@ AM_CPPFLAGS = -DDBUS_STATIC_BUILD test_pending_call_dispatch_SOURCES = \ @@ -64,4 +70,11 @@ test_privserver_client_CFLAGS= test_privserver_client_LDADD=$(top_builddir)/dbus/libdbus-internal.la ../libdbus-testutils.la $(DBUS_TEST_LIBS) test_privserver_client_LDFLAGS=@R_DYNAMIC_LDFLAG@ +test_autolaunch_SOURCES = \ + test-autolaunch.c + +test_autolaunch_CFLAGS= +test_autolaunch_LDADD=$(top_builddir)/dbus/libdbus-internal.la ../libdbus-testutils.la $(DBUS_TEST_LIBS) +test_autolaunch_LDFLAGS=@R_DYNAMIC_LDFLAG@ + endif diff --git a/test/name-test/run-test.sh b/test/name-test/run-test.sh index 832ce0a5..a70055bb 100755 --- a/test/name-test/run-test.sh +++ b/test/name-test/run-test.sh @@ -53,3 +53,6 @@ if ! python $DBUS_TOP_SRCDIR/test/name-test/test-activation-forking.py; then echo "Failed test-activation-forking" exit 1 fi + +echo "running test-autolaunch" +${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-autolaunch || die "test-autolaunch failed" diff --git a/test/name-test/test-autolaunch.c b/test/name-test/test-autolaunch.c new file mode 100644 index 00000000..d3f42e35 --- /dev/null +++ b/test/name-test/test-autolaunch.c @@ -0,0 +1,31 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <dbus/dbus.h> +#include "dbus/dbus-sysdeps.h" + +int +main (int argc, char *argv[]) +{ + DBusConnection *conn = NULL; + DBusError error; + + _dbus_setenv ("DBUS_SESSION_BUS_ADDRESS", NULL); + + dbus_error_init (&error); + + conn = dbus_bus_get (DBUS_BUS_SESSION, &error); + if (dbus_error_is_set (&error)) + { + fprintf (stderr, "*** Failed to autolaunch session bus: %s\n", + error.message); + dbus_error_free (&error); + return 1; + } + + return 0; +} |