mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-17 22:58:07 +02:00
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.
This commit is contained in:
parent
2366423e97
commit
aff6263561
3 changed files with 48 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
31
test/name-test/test-autolaunch.c
Normal file
31
test/name-test/test-autolaunch.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue