summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am14
-rw-r--r--test/Makefile.in85
-rw-r--r--test/data/valid-config-files/session.conf63
-rw-r--r--test/data/valid-config-files/system.conf83
-rw-r--r--test/dbus-daemon.c5
-rw-r--r--test/internals/refs.c613
-rw-r--r--test/internals/syslog.c100
-rw-r--r--test/name-test/Makefile.am2
-rw-r--r--test/name-test/Makefile.in11
-rwxr-xr-xtest/name-test/run-test-systemserver.sh5
-rwxr-xr-xtest/name-test/run-test.sh4
-rw-r--r--test/relay.c12
12 files changed, 831 insertions, 166 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index c308c4bc..0981d1f0 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -97,6 +97,14 @@ shell_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
spawn_test_LDADD=$(TEST_LIBS)
spawn_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
+test_refs_SOURCES = internals/refs.c
+test_refs_CPPFLAGS = -DDBUS_STATIC_BUILD $(GLIB_CFLAGS)
+test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS) $(TEST_LIBS)
+
+test_syslog_SOURCES = internals/syslog.c
+test_syslog_CPPFLAGS = -DDBUS_STATIC_BUILD $(GLIB_CFLAGS)
+test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS) $(TEST_LIBS)
+
EXTRA_DIST = dbus-test-runner
testexecdir = $(libdir)/dbus-1.0/test
@@ -108,7 +116,9 @@ installable_tests = \
test-dbus-daemon \
test-loopback \
test-marshal \
+ test-refs \
test-relay \
+ test-syslog \
$(NULL)
installcheck_tests =
@@ -267,6 +277,8 @@ clean-local:
REVERSEDIRS="$$D $$REVERSEDIRS" ; \
done ; \
for D in $$REVERSEDIRS; do \
- rmdir $(top_builddir)/test/$$D || exit 1 ; \
+ rmdir $(top_builddir)/test/$$D || \
+ test ! -d $(top_builddir)/test/$$D || \
+ exit 1 ; \
done ; \
fi
diff --git a/test/Makefile.in b/test/Makefile.in
index 0deb1890..ed2cc1d8 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -80,7 +80,7 @@ am__v_lt_0 = --silent
@DBUS_BUILD_TESTS_TRUE@ test-sleep-forever$(EXEEXT)
am__EXEEXT_2 = test-corrupt$(EXEEXT) test-dbus-daemon$(EXEEXT) \
test-loopback$(EXEEXT) test-marshal$(EXEEXT) \
- test-relay$(EXEEXT)
+ test-refs$(EXEEXT) test-relay$(EXEEXT) test-syslog$(EXEEXT)
@DBUS_ENABLE_INSTALLED_TESTS_FALSE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_3 = $(am__EXEEXT_2)
@DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_4 = $(am__EXEEXT_2)
am__installdirs = "$(DESTDIR)$(testexecdir)"
@@ -138,6 +138,10 @@ test_names_DEPENDENCIES = libdbus-testutils.la $(am__DEPENDENCIES_2)
test_names_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(test_names_LDFLAGS) $(LDFLAGS) -o $@
+am_test_refs_OBJECTS = test_refs-refs.$(OBJEXT)
+test_refs_OBJECTS = $(am_test_refs_OBJECTS)
+test_refs_DEPENDENCIES = libdbus-testutils.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_2)
am_test_relay_OBJECTS = test_relay-relay.$(OBJEXT)
test_relay_OBJECTS = $(am_test_relay_OBJECTS)
test_relay_DEPENDENCIES = $(top_builddir)/dbus/libdbus-1.la \
@@ -165,6 +169,10 @@ test_shell_service_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
am_test_sleep_forever_OBJECTS = test-sleep-forever.$(OBJEXT)
test_sleep_forever_OBJECTS = $(am_test_sleep_forever_OBJECTS)
test_sleep_forever_LDADD = $(LDADD)
+am_test_syslog_OBJECTS = test_syslog-syslog.$(OBJEXT)
+test_syslog_OBJECTS = $(am_test_syslog_OBJECTS)
+test_syslog_DEPENDENCIES = libdbus-testutils.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_2)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -195,16 +203,18 @@ SOURCES = $(libdbus_testutils_la_SOURCES) $(shell_test_SOURCES) \
$(spawn_test_SOURCES) $(test_corrupt_SOURCES) \
$(test_dbus_daemon_SOURCES) $(test_exit_SOURCES) \
$(test_loopback_SOURCES) $(test_marshal_SOURCES) \
- $(test_names_SOURCES) $(test_relay_SOURCES) \
- $(test_segfault_SOURCES) $(test_service_SOURCES) \
- $(test_shell_service_SOURCES) $(test_sleep_forever_SOURCES)
+ $(test_names_SOURCES) $(test_refs_SOURCES) \
+ $(test_relay_SOURCES) $(test_segfault_SOURCES) \
+ $(test_service_SOURCES) $(test_shell_service_SOURCES) \
+ $(test_sleep_forever_SOURCES) $(test_syslog_SOURCES)
DIST_SOURCES = $(libdbus_testutils_la_SOURCES) $(shell_test_SOURCES) \
$(spawn_test_SOURCES) $(test_corrupt_SOURCES) \
$(test_dbus_daemon_SOURCES) $(test_exit_SOURCES) \
$(test_loopback_SOURCES) $(test_marshal_SOURCES) \
- $(test_names_SOURCES) $(test_relay_SOURCES) \
- $(test_segfault_SOURCES) $(test_service_SOURCES) \
- $(test_shell_service_SOURCES) $(test_sleep_forever_SOURCES)
+ $(test_names_SOURCES) $(test_refs_SOURCES) \
+ $(test_relay_SOURCES) $(test_segfault_SOURCES) \
+ $(test_service_SOURCES) $(test_shell_service_SOURCES) \
+ $(test_sleep_forever_SOURCES) $(test_syslog_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
@@ -367,6 +377,11 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
RC = @RC@
R_DYNAMIC_LDFLAG = @R_DYNAMIC_LDFLAG@
@@ -438,9 +453,13 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -506,6 +525,12 @@ shell_test_LDADD = libdbus-testutils.la $(TEST_LIBS)
shell_test_LDFLAGS = @R_DYNAMIC_LDFLAG@
spawn_test_LDADD = $(TEST_LIBS)
spawn_test_LDFLAGS = @R_DYNAMIC_LDFLAG@
+test_refs_SOURCES = internals/refs.c
+test_refs_CPPFLAGS = -DDBUS_STATIC_BUILD $(GLIB_CFLAGS)
+test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS) $(TEST_LIBS)
+test_syslog_SOURCES = internals/syslog.c
+test_syslog_CPPFLAGS = -DDBUS_STATIC_BUILD $(GLIB_CFLAGS)
+test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS) $(TEST_LIBS)
EXTRA_DIST = dbus-test-runner
testexecdir = $(libdir)/dbus-1.0/test
installable_tests = \
@@ -513,7 +538,9 @@ installable_tests = \
test-dbus-daemon \
test-loopback \
test-marshal \
+ test-refs \
test-relay \
+ test-syslog \
$(NULL)
installcheck_tests = $(am__append_3)
@@ -709,6 +736,9 @@ test-marshal$(EXEEXT): $(test_marshal_OBJECTS) $(test_marshal_DEPENDENCIES)
test-names$(EXEEXT): $(test_names_OBJECTS) $(test_names_DEPENDENCIES)
@rm -f test-names$(EXEEXT)
$(AM_V_CCLD)$(test_names_LINK) $(test_names_OBJECTS) $(test_names_LDADD) $(LIBS)
+test-refs$(EXEEXT): $(test_refs_OBJECTS) $(test_refs_DEPENDENCIES)
+ @rm -f test-refs$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_refs_OBJECTS) $(test_refs_LDADD) $(LIBS)
test-relay$(EXEEXT): $(test_relay_OBJECTS) $(test_relay_DEPENDENCIES)
@rm -f test-relay$(EXEEXT)
$(AM_V_CCLD)$(test_relay_LINK) $(test_relay_OBJECTS) $(test_relay_LDADD) $(LIBS)
@@ -724,6 +754,9 @@ test-shell-service$(EXEEXT): $(test_shell_service_OBJECTS) $(test_shell_service_
test-sleep-forever$(EXEEXT): $(test_sleep_forever_OBJECTS) $(test_sleep_forever_DEPENDENCIES)
@rm -f test-sleep-forever$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_sleep_forever_OBJECTS) $(test_sleep_forever_LDADD) $(LIBS)
+test-syslog$(EXEEXT): $(test_syslog_OBJECTS) $(test_syslog_DEPENDENCIES)
+ @rm -f test-syslog$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_syslog_OBJECTS) $(test_syslog_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -744,7 +777,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dbus_daemon-dbus-daemon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_loopback-loopback.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_marshal-marshal.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_refs-refs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_relay-relay.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_syslog-syslog.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -834,6 +869,22 @@ test_marshal-marshal.obj: marshal.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_marshal_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_marshal-marshal.obj `if test -f 'marshal.c'; then $(CYGPATH_W) 'marshal.c'; else $(CYGPATH_W) '$(srcdir)/marshal.c'; fi`
+test_refs-refs.o: internals/refs.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_refs-refs.o -MD -MP -MF $(DEPDIR)/test_refs-refs.Tpo -c -o test_refs-refs.o `test -f 'internals/refs.c' || echo '$(srcdir)/'`internals/refs.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_refs-refs.Tpo $(DEPDIR)/test_refs-refs.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internals/refs.c' object='test_refs-refs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_refs-refs.o `test -f 'internals/refs.c' || echo '$(srcdir)/'`internals/refs.c
+
+test_refs-refs.obj: internals/refs.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_refs-refs.obj -MD -MP -MF $(DEPDIR)/test_refs-refs.Tpo -c -o test_refs-refs.obj `if test -f 'internals/refs.c'; then $(CYGPATH_W) 'internals/refs.c'; else $(CYGPATH_W) '$(srcdir)/internals/refs.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_refs-refs.Tpo $(DEPDIR)/test_refs-refs.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internals/refs.c' object='test_refs-refs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_refs-refs.obj `if test -f 'internals/refs.c'; then $(CYGPATH_W) 'internals/refs.c'; else $(CYGPATH_W) '$(srcdir)/internals/refs.c'; fi`
+
test_relay-relay.o: relay.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_relay_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_relay-relay.o -MD -MP -MF $(DEPDIR)/test_relay-relay.Tpo -c -o test_relay-relay.o `test -f 'relay.c' || echo '$(srcdir)/'`relay.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_relay-relay.Tpo $(DEPDIR)/test_relay-relay.Po
@@ -850,6 +901,22 @@ test_relay-relay.obj: relay.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_relay_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_relay-relay.obj `if test -f 'relay.c'; then $(CYGPATH_W) 'relay.c'; else $(CYGPATH_W) '$(srcdir)/relay.c'; fi`
+test_syslog-syslog.o: internals/syslog.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_syslog_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_syslog-syslog.o -MD -MP -MF $(DEPDIR)/test_syslog-syslog.Tpo -c -o test_syslog-syslog.o `test -f 'internals/syslog.c' || echo '$(srcdir)/'`internals/syslog.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_syslog-syslog.Tpo $(DEPDIR)/test_syslog-syslog.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internals/syslog.c' object='test_syslog-syslog.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_syslog_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_syslog-syslog.o `test -f 'internals/syslog.c' || echo '$(srcdir)/'`internals/syslog.c
+
+test_syslog-syslog.obj: internals/syslog.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_syslog_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_syslog-syslog.obj -MD -MP -MF $(DEPDIR)/test_syslog-syslog.Tpo -c -o test_syslog-syslog.obj `if test -f 'internals/syslog.c'; then $(CYGPATH_W) 'internals/syslog.c'; else $(CYGPATH_W) '$(srcdir)/internals/syslog.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_syslog-syslog.Tpo $(DEPDIR)/test_syslog-syslog.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internals/syslog.c' object='test_syslog-syslog.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_syslog_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_syslog-syslog.obj `if test -f 'internals/syslog.c'; then $(CYGPATH_W) 'internals/syslog.c'; else $(CYGPATH_W) '$(srcdir)/internals/syslog.c'; fi`
+
mostlyclean-libtool:
-rm -f *.lo
@@ -1337,7 +1404,9 @@ clean-local:
REVERSEDIRS="$$D $$REVERSEDIRS" ; \
done ; \
for D in $$REVERSEDIRS; do \
- rmdir $(top_builddir)/test/$$D || exit 1 ; \
+ rmdir $(top_builddir)/test/$$D || \
+ test ! -d $(top_builddir)/test/$$D || \
+ exit 1 ; \
done ; \
fi
diff --git a/test/data/valid-config-files/session.conf b/test/data/valid-config-files/session.conf
deleted file mode 100644
index dde5ef6b..00000000
--- a/test/data/valid-config-files/session.conf
+++ /dev/null
@@ -1,63 +0,0 @@
-<!-- This configuration file controls the per-user-login-session message bus.
- Add a session-local.conf and edit that rather than changing this
- file directly. -->
-
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
- <!-- Our well-known bus type, don't change this -->
- <type>session</type>
-
- <!-- If we fork, keep the user's original umask to avoid affecting
- the behavior of child processes. -->
- <keep_umask/>
-
- <listen>unix:tmpdir=/tmp</listen>
-
- <standard_session_servicedirs />
-
- <policy context="default">
- <!-- Allow everything to be sent -->
- <allow send_destination="*" eavesdrop="true"/>
- <!-- Allow everything to be received -->
- <allow eavesdrop="true"/>
- <!-- Allow anyone to own anything -->
- <allow own="*"/>
- </policy>
-
- <!-- Config files are placed here that among other things,
- further restrict the above policy for specific services. -->
- <includedir>session.d</includedir>
-
- <!-- This is included last so local configuration can override what's
- in this standard file -->
- <include ignore_missing="yes">session-local.conf</include>
-
- <include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
-
- <!-- For the session bus, override the default relatively-low limits
- with essentially infinite limits, since the bus is just running
- as the user anyway, using up bus resources is not something we need
- to worry about. In some cases, we do set the limits lower than
- "all available memory" if exceeding the limit is almost certainly a bug,
- having the bus enforce a limit is nicer than a huge memory leak. But the
- intent is that these limits should never be hit. -->
-
- <!-- the memory limits are 1G instead of say 4G because they can't exceed 32-bit signed int max -->
- <limit name="max_incoming_bytes">1000000000</limit>
- <limit name="max_incoming_unix_fds">250000000</limit>
- <limit name="max_outgoing_bytes">1000000000</limit>
- <limit name="max_outgoing_unix_fds">250000000</limit>
- <limit name="max_message_size">1000000000</limit>
- <limit name="max_message_unix_fds">4096</limit>
- <limit name="service_start_timeout">120000</limit>
- <limit name="auth_timeout">240000</limit>
- <limit name="max_completed_connections">100000</limit>
- <limit name="max_incomplete_connections">10000</limit>
- <limit name="max_connections_per_user">100000</limit>
- <limit name="max_pending_service_starts">10000</limit>
- <limit name="max_names_per_connection">50000</limit>
- <limit name="max_match_rules_per_connection">50000</limit>
- <limit name="max_replies_per_connection">50000</limit>
-
-</busconfig>
diff --git a/test/data/valid-config-files/system.conf b/test/data/valid-config-files/system.conf
deleted file mode 100644
index 828fd032..00000000
--- a/test/data/valid-config-files/system.conf
+++ /dev/null
@@ -1,83 +0,0 @@
-<!-- This configuration file controls the systemwide message bus.
- Add a system-local.conf and edit that rather than changing this
- file directly. -->
-
-<!-- Note that there are any number of ways you can hose yourself
- security-wise by screwing up this file; in particular, you
- probably don't want to listen on any more addresses, add any more
- auth mechanisms, run as a different user, etc. -->
-
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-
- <!-- Our well-known bus type, do not change this -->
- <type>system</type>
-
- <!-- Run as special user -->
- <user>messagebus</user>
-
- <!-- Fork into daemon mode -->
- <fork/>
-
- <!-- We use system service launching using a helper -->
- <standard_system_servicedirs/>
-
- <!-- This is a setuid helper that is used to launch system services -->
- <servicehelper>/usr/local/libexec/dbus-daemon-launch-helper</servicehelper>
-
- <!-- Write a pid file -->
- <pidfile>/usr/local/var/run/dbus/pid</pidfile>
-
- <!-- Enable logging to syslog -->
- <syslog/>
-
- <!-- Only allow socket-credentials-based authentication -->
- <auth>EXTERNAL</auth>
-
- <!-- Only listen on a local socket. (abstract=/path/to/socket
- means use abstract namespace, don't really create filesystem
- file; only Linux supports this. Use path=/whatever on other
- systems.) -->
- <listen>unix:path=/usr/local/var/run/dbus/system_bus_socket</listen>
-
- <policy context="default">
- <!-- All users can connect to system bus -->
- <allow user="*"/>
-
- <!-- Holes must be punched in service configuration files for
- name ownership and sending method calls -->
- <deny own="*"/>
- <deny send_type="method_call"/>
-
- <!-- Signals and reply messages (method returns, errors) are allowed
- by default -->
- <allow send_type="signal"/>
- <allow send_requested_reply="true" send_type="method_return"/>
- <allow send_requested_reply="true" send_type="error"/>
-
- <!-- All messages may be received by default -->
- <allow receive_type="method_call"/>
- <allow receive_type="method_return"/>
- <allow receive_type="error"/>
- <allow receive_type="signal"/>
-
- <!-- Allow anyone to talk to the message bus -->
- <allow send_destination="org.freedesktop.DBus"/>
- <!-- But disallow some specific bus services -->
- <deny send_destination="org.freedesktop.DBus"
- send_interface="org.freedesktop.DBus"
- send_member="UpdateActivationEnvironment"/>
- </policy>
-
- <!-- Config files are placed here that among other things, punch
- holes in the above policy for specific services. -->
- <includedir>system.d</includedir>
-
- <!-- This is included last so local configuration can override what's
- in this standard file -->
- <include ignore_missing="yes">system-local.conf</include>
-
- <include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
-
-</busconfig>
diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c
index ed10d098..e192c68f 100644
--- a/test/dbus-daemon.c
+++ b/test/dbus-daemon.c
@@ -34,6 +34,7 @@
#include <string.h>
#ifdef DBUS_WIN
+# include <io.h>
# include <windows.h>
#else
# include <signal.h>
@@ -44,7 +45,7 @@ typedef struct {
DBusError e;
GError *ge;
- gint daemon_pid;
+ GPid daemon_pid;
DBusConnection *left_conn;
@@ -66,7 +67,7 @@ _assert_no_error (const DBusError *e,
static gchar *
spawn_dbus_daemon (gchar *binary,
gchar *configuration,
- gint *daemon_pid)
+ GPid *daemon_pid)
{
GError *error = NULL;
GString *address;
diff --git a/test/internals/refs.c b/test/internals/refs.c
new file mode 100644
index 00000000..3d21c894
--- /dev/null
+++ b/test/internals/refs.c
@@ -0,0 +1,613 @@
+/* Regression test for thread-safe reference-counting
+ *
+ * Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+ * Copyright © 2011 Nokia Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+
+#define DBUS_COMPILATION /* this test uses libdbus-internal */
+#include <dbus/dbus.h>
+#include <dbus/dbus-connection-internal.h>
+#include <dbus/dbus-mainloop.h>
+#include <dbus/dbus-message-internal.h>
+#include <dbus/dbus-pending-call-internal.h>
+#include <dbus/dbus-server-protected.h>
+#include "test-utils.h"
+
+static void
+assert_no_error (const DBusError *e)
+{
+ if (G_UNLIKELY (dbus_error_is_set (e)))
+ g_error ("expected success but got error: %s: %s", e->name, e->message);
+}
+
+#define N_THREADS 200
+#define N_REFS 10000
+G_STATIC_ASSERT (((unsigned) N_THREADS * (unsigned) N_REFS) < G_MAXINT32);
+
+static dbus_int32_t connection_slot = -1;
+static dbus_int32_t server_slot = -1;
+static dbus_int32_t message_slot = -1;
+static dbus_int32_t pending_call_slot = -1;
+
+typedef struct {
+ DBusError e;
+ DBusLoop *loop;
+ DBusServer *server;
+ DBusConnection *connection;
+ DBusConnection *server_connection;
+ DBusMessage *message;
+ GThread *threads[N_THREADS];
+ gboolean last_unref;
+} Fixture;
+
+typedef void *(*RefFunc) (void *);
+typedef void (*VoidFunc) (void *);
+
+typedef struct {
+ void *thing;
+ RefFunc ref;
+ VoidFunc ref_void;
+ VoidFunc unref;
+ void *mutex;
+ VoidFunc lock;
+ VoidFunc unlock;
+} Thread;
+
+static gpointer
+ref_thread (gpointer data)
+{
+ Thread *thread = data;
+ int i;
+
+ for (i = 0; i < N_REFS; i++)
+ {
+ if (thread->lock != NULL)
+ (thread->lock) (thread->mutex);
+
+ if (thread->ref != NULL)
+ {
+ gpointer ret = (thread->ref) (thread->thing);
+
+ g_assert (ret == thread->thing);
+ }
+ else
+ {
+ (thread->ref_void) (thread->thing);
+ }
+
+ if (thread->unlock != NULL)
+ (thread->unlock) (thread->mutex);
+ }
+
+ return NULL;
+}
+
+static gpointer
+cycle_thread (gpointer data)
+{
+ Thread *thread = data;
+ int i;
+
+ for (i = 0; i < N_REFS; i++)
+ {
+ if (thread->lock != NULL)
+ (thread->lock) (thread->mutex);
+
+ if (thread->ref != NULL)
+ {
+ gpointer ret = (thread->ref) (thread->thing);
+
+ g_assert (ret == thread->thing);
+ }
+ else
+ {
+ (thread->ref_void) (thread->thing);
+ }
+
+ (thread->unref) (thread->thing);
+
+ if (thread->unlock != NULL)
+ (thread->unlock) (thread->mutex);
+ }
+
+ return NULL;
+}
+
+static gpointer
+unref_thread (gpointer data)
+{
+ Thread *thread = data;
+ int i;
+
+ for (i = 0; i < N_REFS; i++)
+ {
+ if (thread->lock != NULL)
+ (thread->lock) (thread->mutex);
+
+ (thread->unref) (thread->thing);
+
+ if (thread->unlock != NULL)
+ (thread->unlock) (thread->mutex);
+ }
+
+ return NULL;
+}
+
+static void
+last_unref (void *data)
+{
+ Fixture *f = data;
+
+ g_assert (!f->last_unref);
+ f->last_unref = TRUE;
+}
+
+static void
+wait_for_all_threads (Fixture *f)
+{
+ int i;
+
+ for (i = 0; i < N_THREADS; i++)
+ g_thread_join (f->threads[i]);
+}
+
+static void
+new_conn_cb (DBusServer *server,
+ DBusConnection *server_connection,
+ void *data)
+{
+ Fixture *f = data;
+ dbus_bool_t have_mem;
+
+ g_assert (f->server_connection == NULL);
+ f->server_connection = dbus_connection_ref (server_connection);
+
+ test_connection_setup (f->loop, f->server_connection);
+}
+
+static void
+setup (Fixture *f,
+ gconstpointer data)
+{
+ if (!dbus_threads_init_default ())
+ g_error ("OOM");
+
+ f->loop = _dbus_loop_new ();
+ g_assert (f->loop != NULL);
+
+ dbus_error_init (&f->e);
+
+ f->server = dbus_server_listen ("tcp:host=127.0.0.1", &f->e);
+ assert_no_error (&f->e);
+ g_assert (f->server != NULL);
+
+ if (!dbus_connection_allocate_data_slot (&connection_slot))
+ g_error ("OOM");
+
+ if (!dbus_server_allocate_data_slot (&server_slot))
+ g_error ("OOM");
+
+ if (!dbus_message_allocate_data_slot (&message_slot))
+ g_error ("OOM");
+
+ if (!dbus_pending_call_allocate_data_slot (&pending_call_slot))
+ g_error ("OOM");
+}
+
+static void
+setup_connection (Fixture *f,
+ gconstpointer data)
+{
+ char *address;
+
+ setup (f, data);
+
+ dbus_server_set_new_connection_function (f->server,
+ new_conn_cb, f, NULL);
+
+ if (!test_server_setup (f->loop, f->server))
+ g_error ("failed to set up server");
+
+ address = dbus_server_get_address (f->server);
+ g_assert (address != NULL);
+ f->connection = dbus_connection_open_private (address, &f->e);
+ assert_no_error (&f->e);
+ g_assert (f->connection != NULL);
+ dbus_free (address);
+
+ if (!test_connection_setup (f->loop, f->connection))
+ g_error ("failed to set up connection");
+
+ while (f->server_connection == NULL)
+ _dbus_loop_iterate (f->loop, TRUE);
+
+ test_connection_shutdown (f->loop, f->connection);
+ test_server_shutdown (f->loop, f->server);
+}
+
+static void
+test_connection (Fixture *f,
+ gconstpointer data)
+{
+ Thread public_api = { f->connection,
+ (RefFunc) dbus_connection_ref,
+ NULL,
+ (VoidFunc) dbus_connection_unref,
+ NULL,
+ NULL,
+ NULL };
+ Thread internal_api = { f->connection,
+ (RefFunc) _dbus_connection_ref_unlocked,
+ NULL,
+ (VoidFunc) _dbus_connection_unref_unlocked,
+ f->connection,
+ (VoidFunc) _dbus_connection_lock,
+ (VoidFunc) _dbus_connection_unlock };
+ int i;
+
+ /* Use a slot as a pseudo-weakref */
+ if (!dbus_connection_set_data (f->connection, connection_slot, f,
+ last_unref))
+ g_error ("OOM");
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ if ((i % 2) == 0)
+ f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL);
+ else
+ f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE,
+ NULL);
+
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ if ((i % 2) == 0)
+ f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE,
+ NULL);
+ else
+ f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE,
+ NULL);
+
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ if ((i % 2) == 0)
+ f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE,
+ NULL);
+ else
+ f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE,
+ NULL);
+
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ /* Destroy the connection. This should be the last-unref. */
+ g_assert (!f->last_unref);
+ dbus_connection_close (f->connection);
+ dbus_connection_unref (f->connection);
+ f->connection = NULL;
+ g_assert (f->last_unref);
+}
+
+static void
+server_lock (void *server)
+{
+ SERVER_LOCK (((DBusServer *) server));
+}
+
+static void
+server_unlock (void *server)
+{
+ SERVER_UNLOCK (((DBusServer *) server));
+}
+
+static void
+test_server (Fixture *f,
+ gconstpointer data)
+{
+ Thread public_api = { f->server,
+ (RefFunc) dbus_server_ref,
+ NULL,
+ (VoidFunc) dbus_server_unref,
+ NULL,
+ NULL,
+ NULL };
+ Thread internal_api = { f->server,
+ NULL,
+ (VoidFunc) _dbus_server_ref_unlocked,
+ (VoidFunc) _dbus_server_unref_unlocked,
+ f->server,
+ server_lock,
+ server_unlock };
+ int i;
+
+ if (!dbus_server_set_data (f->server, server_slot, f, last_unref))
+ g_error ("OOM");
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ if ((i % 2) == 0)
+ f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL);
+ else
+ f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE,
+ NULL);
+
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ if ((i % 2) == 0)
+ f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE,
+ NULL);
+ else
+ f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE,
+ NULL);
+
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ if ((i % 2) == 0)
+ f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE,
+ NULL);
+ else
+ f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE,
+ NULL);
+
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ /* Destroy the server. This should be the last-unref. */
+ g_assert (!f->last_unref);
+ dbus_server_disconnect (f->server);
+ dbus_server_unref (f->server);
+ f->server = NULL;
+ g_assert (f->last_unref);
+}
+
+static void
+test_message (Fixture *f,
+ gconstpointer data)
+{
+ DBusMessage *message = dbus_message_new_signal ("/foo", "foo.bar.baz",
+ "Foo");
+ Thread public_api = { message,
+ (RefFunc) dbus_message_ref,
+ NULL,
+ (VoidFunc) dbus_message_unref,
+ NULL,
+ NULL,
+ NULL };
+ int i;
+
+ if (!dbus_message_set_data (message, message_slot, f, last_unref))
+ g_error ("OOM");
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL);
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE, NULL);
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE, NULL);
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ /* Destroy the server. This should be the last-unref. */
+ g_assert (!f->last_unref);
+ dbus_message_unref (message);
+ g_assert (f->last_unref);
+}
+
+static void
+test_pending_call (Fixture *f,
+ gconstpointer data)
+{
+ Thread public_api = { NULL,
+ (RefFunc) dbus_pending_call_ref,
+ NULL,
+ (VoidFunc) dbus_pending_call_unref,
+ NULL,
+ NULL,
+ NULL };
+ Thread internal_api = { NULL,
+ (RefFunc) _dbus_pending_call_ref_unlocked,
+ NULL,
+ (VoidFunc) dbus_pending_call_unref,
+ f->connection,
+ (VoidFunc) _dbus_connection_lock,
+ (VoidFunc) _dbus_connection_unlock };
+ /* This one can't be used to ref, only to cycle or unref. */
+ Thread unref_and_unlock_api = { NULL,
+ (RefFunc) _dbus_pending_call_ref_unlocked,
+ NULL,
+ (VoidFunc) _dbus_pending_call_unref_and_unlock,
+ f->connection,
+ (VoidFunc) _dbus_connection_lock,
+ NULL };
+ int i;
+ DBusPendingCall *pending_call;
+
+ _dbus_connection_lock (f->connection);
+ pending_call = _dbus_pending_call_new_unlocked (f->connection,
+ DBUS_TIMEOUT_INFINITE, NULL);
+ g_assert (pending_call != NULL);
+ _dbus_connection_unlock (f->connection);
+
+ public_api.thing = pending_call;
+ internal_api.thing = pending_call;
+ unref_and_unlock_api.thing = pending_call;
+
+ if (!dbus_pending_call_set_data (pending_call, pending_call_slot, f,
+ last_unref))
+ g_error ("OOM");
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ if ((i % 2) == 0)
+ f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL);
+ else
+ f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE,
+ NULL);
+
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ switch (i % 3)
+ {
+ case 0:
+ f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE,
+ NULL);
+ break;
+ case 1:
+ f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE,
+ NULL);
+ break;
+ default:
+ f->threads[i] = g_thread_create (cycle_thread,
+ &unref_and_unlock_api, TRUE, NULL);
+ }
+
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ for (i = 0; i < N_THREADS; i++)
+ {
+ switch (i % 3)
+ {
+ case 0:
+ f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE,
+ NULL);
+ break;
+ case 1:
+ f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE,
+ NULL);
+ break;
+ default:
+ f->threads[i] = g_thread_create (unref_thread,
+ &unref_and_unlock_api, TRUE, NULL);
+ }
+
+ g_assert (f->threads[i] != NULL);
+ }
+
+ wait_for_all_threads (f);
+
+ /* Destroy the pending call. This should be the last-unref. */
+ g_assert (!f->last_unref);
+ dbus_pending_call_unref (pending_call);
+ g_assert (f->last_unref);
+}
+
+static void
+teardown (Fixture *f,
+ gconstpointer data)
+{
+ if (f->server_connection != NULL)
+ {
+ dbus_connection_close (f->server_connection);
+ dbus_connection_unref (f->server_connection);
+ }
+
+ if (f->connection != NULL)
+ {
+ dbus_connection_close (f->connection);
+ dbus_connection_unref (f->connection);
+ }
+
+ if (f->server != NULL)
+ {
+ dbus_server_disconnect (f->server);
+ dbus_server_unref (f->server);
+ }
+
+ dbus_connection_free_data_slot (&connection_slot);
+ dbus_server_free_data_slot (&server_slot);
+ dbus_message_free_data_slot (&message_slot);
+ dbus_pending_call_free_data_slot (&pending_call_slot);
+
+ _dbus_loop_unref (f->loop);
+ dbus_error_free (&f->e);
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ g_thread_init (NULL);
+ g_test_init (&argc, &argv, NULL);
+ g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+
+ g_test_add ("/refs/connection", Fixture, NULL, setup_connection,
+ test_connection, teardown);
+ g_test_add ("/refs/message", Fixture, NULL, setup,
+ test_message, teardown);
+ g_test_add ("/refs/pending-call", Fixture, NULL, setup_connection,
+ test_pending_call, teardown);
+ g_test_add ("/refs/server", Fixture, NULL, setup,
+ test_server, teardown);
+
+ return g_test_run ();
+}
diff --git a/test/internals/syslog.c b/test/internals/syslog.c
new file mode 100644
index 00000000..4f6b7c22
--- /dev/null
+++ b/test/internals/syslog.c
@@ -0,0 +1,100 @@
+/* Manual regression test for syslog support
+ *
+ * Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+ * Copyright © 2011 Nokia Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <glib.h>
+
+#define DBUS_COMPILATION /* this test uses libdbus-internal */
+#include <dbus/dbus.h>
+#include <dbus/dbus-sysdeps.h>
+
+typedef struct {
+ int dummy;
+} Fixture;
+
+static void
+setup (Fixture *f,
+ gconstpointer data)
+{
+}
+
+/* hopefully clear enough that people don't think these messages in syslog
+ * are a bug */
+#define MESSAGE "regression test for _dbus_system_log(): "
+
+static void
+test_syslog (Fixture *f,
+ gconstpointer data)
+{
+ if (g_test_trap_fork (0, 0))
+ {
+ _dbus_init_system_log ();
+ _dbus_system_log (DBUS_SYSTEM_LOG_FATAL, MESSAGE "%d", 23);
+ /* should not be reached: exit 0 so the assertion in the main process
+ * will fail */
+ exit (0);
+ }
+
+ g_test_trap_assert_failed ();
+ g_test_trap_assert_stderr ("*" MESSAGE "23\n*");
+
+ if (g_test_trap_fork (0, 0))
+ {
+ _dbus_init_system_log ();
+ _dbus_system_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42);
+ _dbus_system_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666);
+ exit (0);
+ }
+
+ g_test_trap_assert_passed ();
+ g_test_trap_assert_stderr ("*" MESSAGE "42\n*" MESSAGE "666\n*");
+
+ /* manual test (this is the best we can do on Windows) */
+ _dbus_init_system_log ();
+ _dbus_system_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42);
+ _dbus_system_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666);
+}
+
+static void
+teardown (Fixture *f,
+ gconstpointer data)
+{
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ g_test_init (&argc, &argv, NULL);
+ g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+
+ g_test_add ("/syslog", Fixture, NULL, setup, test_syslog, teardown);
+
+ return g_test_run ();
+}
diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am
index 5f11f0be..45c21d46 100644
--- a/test/name-test/Makefile.am
+++ b/test/name-test/Makefile.am
@@ -4,7 +4,7 @@ INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_TEST_C
## so if adding tests not to be run in make check, don't add them to
## TESTS
if DBUS_BUILD_TESTS
-TESTS_ENVIRONMENT=DBUS_TOP_BUILDDIR=@abs_top_builddir@ DBUS_TOP_SRCDIR=@abs_top_srcdir@
+TESTS_ENVIRONMENT=DBUS_TOP_BUILDDIR=@abs_top_builddir@ DBUS_TOP_SRCDIR=@abs_top_srcdir@ PYTHON=@PYTHON@
TESTS=run-test.sh run-test-systemserver.sh
else
TESTS=
diff --git a/test/name-test/Makefile.in b/test/name-test/Makefile.in
index ca488449..69360109 100644
--- a/test/name-test/Makefile.in
+++ b/test/name-test/Makefile.in
@@ -310,6 +310,11 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
RC = @RC@
R_DYNAMIC_LDFLAG = @R_DYNAMIC_LDFLAG@
@@ -381,9 +386,13 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -394,7 +403,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_TEST_CFLAGS) -DDBUS_COMPILATION
-@DBUS_BUILD_TESTS_TRUE@TESTS_ENVIRONMENT = DBUS_TOP_BUILDDIR=@abs_top_builddir@ DBUS_TOP_SRCDIR=@abs_top_srcdir@
+@DBUS_BUILD_TESTS_TRUE@TESTS_ENVIRONMENT = DBUS_TOP_BUILDDIR=@abs_top_builddir@ DBUS_TOP_SRCDIR=@abs_top_srcdir@ PYTHON=@PYTHON@
EXTRA_DIST = run-test.sh run-test-systemserver.sh test-wait-for-echo.py test-activation-forking.py
@DBUS_BUILD_TESTS_TRUE@AM_CPPFLAGS = -DDBUS_STATIC_BUILD
@DBUS_BUILD_TESTS_TRUE@test_pending_call_dispatch_SOURCES = \
diff --git a/test/name-test/run-test-systemserver.sh b/test/name-test/run-test-systemserver.sh
index d3b8d557..afd1f045 100755
--- a/test/name-test/run-test-systemserver.sh
+++ b/test/name-test/run-test-systemserver.sh
@@ -41,10 +41,11 @@ if ! grep -q 'DBus.Error' echo-error-output.tmp; then
fi
echo "running test echo signal"
-if ! python $DBUS_TOP_SRCDIR/test/name-test/test-wait-for-echo.py; then
+if test "x$PYTHON" = "x:"; then
+ echo "Skipped test-echo-signal: Python interpreter not found"
+elif ! $PYTHON $DBUS_TOP_SRCDIR/test/name-test/test-wait-for-echo.py; then
echo "Failed test-wait-for-echo"
exit 1
fi
-
exit 0
diff --git a/test/name-test/run-test.sh b/test/name-test/run-test.sh
index a70055bb..cad5937e 100755
--- a/test/name-test/run-test.sh
+++ b/test/name-test/run-test.sh
@@ -49,7 +49,9 @@ echo "running test-shutdown"
${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-shutdown || die "test-shutdown failed"
echo "running test activation forking"
-if ! python $DBUS_TOP_SRCDIR/test/name-test/test-activation-forking.py; then
+if test "x$PYTHON" = "x:"; then
+ echo "Skipped test-activation-forking: Python interpreter not found"
+elif ! $PYTHON $DBUS_TOP_SRCDIR/test/name-test/test-activation-forking.py; then
echo "Failed test-activation-forking"
exit 1
fi
diff --git a/test/relay.c b/test/relay.c
index bad39f47..f4129d0a 100644
--- a/test/relay.c
+++ b/test/relay.c
@@ -137,12 +137,15 @@ test_connect (Fixture *f,
gconstpointer data G_GNUC_UNUSED)
{
dbus_bool_t have_mem;
+ char *address;
g_assert (f->left_server_conn == NULL);
g_assert (f->right_server_conn == NULL);
- f->left_client_conn = dbus_connection_open_private (
- dbus_server_get_address (f->server), &f->e);
+ address = dbus_server_get_address (f->server);
+ g_assert (address != NULL);
+
+ f->left_client_conn = dbus_connection_open_private (address, &f->e);
assert_no_error (&f->e);
g_assert (f->left_client_conn != NULL);
dbus_connection_setup_with_g_main (f->left_client_conn, NULL);
@@ -153,12 +156,13 @@ test_connect (Fixture *f,
g_main_context_iteration (NULL, TRUE);
}
- f->right_client_conn = dbus_connection_open_private (
- dbus_server_get_address (f->server), &f->e);
+ f->right_client_conn = dbus_connection_open_private (address, &f->e);
assert_no_error (&f->e);
g_assert (f->right_client_conn != NULL);
dbus_connection_setup_with_g_main (f->right_client_conn, NULL);
+ dbus_free (address);
+
while (f->right_server_conn == NULL)
{
g_print (".");