Commit graph

825 commits

Author SHA1 Message Date
Simon McVittie
92bd5ef290 _dbus_logv: configurably log to syslog and/or stderr
This changes the behaviour of _dbus_logv() if _dbus_init_system_log() was
not called. Previously, _dbus_logv() would always log to syslog;
additionally, it would log to stderr, unless the process is dbus-daemon
and it was started by systemd. Now, it will log to stderr only,
unless _dbus_init_system_log() was called first.

This is the desired behaviour because when we hook up
_dbus_warn_check_failed() to _dbus_logv() in the next commit, we don't
want typical users of libdbus to start logging their check failures to
syslog - we only want the dbus-daemon to do that.

In practice this is not usually a behaviour change, because there was
only one situation in which we called _dbus_logv() without first calling
_dbus_init_system_log(), namely an error while parsing configuration
files. Initialize the system log "just in time" in that situation
to preserve existing behaviour.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-09-30 19:36:50 +01:00
Simon McVittie
a363822f5f dbus-daemon test: exercise pending fd timeout test
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 18:27:43 +01:00
Simon McVittie
3bc74092ca dbus-daemon test: exercise max_names_per_connection limit
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 17:44:30 +01:00
Simon McVittie
951fd317ca dbus-daemon test: exercise maximum match rules per connection
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 17:44:30 +01:00
Simon McVittie
5cfd755f5d dbus-daemon test: exercise maximum replies per connection
This time we're doing so deliberately.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 17:44:30 +01:00
Simon McVittie
78b40bbde8 dbus-daemon test: avoid reaching pending reply limit
We were not actually doing what was intended (flooding the bus with
10k or 100k messages for the other side) because the bus was limiting
the sender to 128 parallel method calls.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 17:44:30 +01:00
Simon McVittie
de0cf5a070 dbus-daemon test: exercise maximum connection counts
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 17:44:30 +01:00
Simon McVittie
73b03e0bfb name-test, tools: add missing COVERAGE_CFLAGS
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-15 15:17:31 +01:00
Thomas Zimmermann
be04ba8354 Use AX_CODE_COVERAGE for test-coverage statistics
DBus uses custom rules in its Makefiles to implement test-coverage
statistics.

This patch implements test-coverage statistics with the autoconf macro
AX_CODE_COVERAGE. The script automatically tests for tools (e.g., gcov,
lcov), sets build variables and creates Makefile rules.

Run 'configure' with '--enable-code-coverage' to enable support for
test-coverage statistics. Run 'make check-code-coverage' to run the
tests and generate the statistics.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
[smcv: do not alter compiler.m4; move AM_CXXFLAGS to the one place we
compile C++]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88922
2016-08-15 14:30:51 +01:00
Simon McVittie
c56cc26164 Add a regression test for dbus-launch in X11
[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:21:36 +01:00
Simon McVittie
6ce19c8625 test-dbus-daemon-fork: exercise closed stdin, stdout, stderr
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:21:36 +01:00
Simon McVittie
1679f58a14 test: expand dbus-launch-eval test to cover stdin being closed
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:21:36 +01:00
Simon McVittie
a7caca9f47 Add a simple test for dbus-daemon --fork
[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:21:32 +01:00
Simon McVittie
042391e88a test: add a regression test for eval "$(dbus-launch --sh-syntax)"
[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:21:01 +01:00
Simon McVittie
67f2fed1fd test-dbus-launch-x11: extend to cover --exit-with-x11
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:13:47 +01:00
Simon McVittie
01ffa21501 Add a regression test for dbus-launch in X11
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
2016-08-12 18:13:21 +01:00
Simon McVittie
53fe3b44af test-dbus-daemon-fork: exercise closed stdin, stdout, stderr
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
2016-08-12 18:13:13 +01:00
Simon McVittie
4710c60bbf Add a simple test for dbus-daemon --fork
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Colin Walters
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
2016-08-12 18:12:46 +01:00
Simon McVittie
0e0a032aa2 test: add a regression test for eval "$(dbus-launch --sh-syntax)"
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
2016-08-12 18:12:41 +01:00
Simon McVittie
76ae52735e Remove trailing newlines from _dbus_assert_not_reached
This was never necessary: _dbus_assert_not_reached() always added one.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
2016-08-12 17:11:48 +01:00
Simon McVittie
6d8a198de9 various tests: produce better diagnostics on error
Same root cause as <https://bugs.freedesktop.org/show_bug.cgi?id=96653>:
we didn't check whether the message was in fact an error reply.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 10:25:06 +01:00
Simon McVittie
d97d561a46 _dbus_system_log: rename to _dbus_log
This is a step towards making it write to either stderr or syslog
or both, as configured globally.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
2016-08-11 16:41:16 +01:00
Simon McVittie
8ef699dd20 _dbus_init_system_log: record a syslog tag (executable name)
Instead of hard-coding "dbus", report what the executable really is.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
2016-08-11 16:41:16 +01:00
Simon McVittie
e3d76634c3 test-bus: don't write to the syslog
We want to emulate the behaviour of the system bus, but we don't
really want to spam the system log with lots of test messages.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
2016-08-11 16:41:16 +01:00
Simon McVittie
b5bef9dc16 Merge branch 'dbus-1.10' into dbus-1.10-ci 2016-06-30 13:57:29 +01:00
Simon McVittie
e536ea93ec Merge branch 'dbus-1.10' 2016-06-30 13:56:44 +01:00
Руслан Ижбулатов
e0f26388f7 Use dbus_set_error_from_message() to check for an error
Do not rely on dbus_message_get_args() to turn an ERROR message
into DBusError.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=96653
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-06-30 13:52:44 +01:00
Simon McVittie
5602ef4bf2 Merge branch 'dbus-1.10' into dbus-1.10-ci 2016-05-18 18:14:16 +01:00
Simon McVittie
78362cfc62 test-segfault: add missing include of <stdio.h> on Windows
Needed for fprintf (stderr, ...).

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
(cherry picked from commit 07b7dcd717)
2016-05-18 18:13:48 +01:00
Simon McVittie
07b7dcd717 test-segfault: add missing include of <stdio.h> on Windows
Needed for fprintf (stderr, ...).

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-05-16 21:20:19 +02:00
Ralf Habacker
a050be5b6a Merge branch 'dbus-1.10' 2016-05-09 21:50:56 +02:00
Ralf Habacker
5ef167c139 Suppress Windows popups and jit debugger when app crashes with exception.
Based on a patch from Yiyang Fei.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=95155
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-05-09 21:49:22 +02:00
Ralf Habacker
eaf231b7db Fix assert in test-spawn caused by missing initialization of DBusError instance on gcc builds.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=95160
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
(cherry picked from commit 9323a621e8)
2016-04-29 19:19:57 +02:00
Ralf Habacker
9323a621e8 Fix assert in test-spawn caused by missing initialization of DBusError instance on gcc builds.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=95160
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-04-29 13:08:14 +02:00
Simon McVittie
ec6b220e4d name-test: run most C tests directly, not via run-test.sh
The exception is test-autolaunch, which is really not particularly
useful as a build-time test. The only way we can really test
autolaunch is as a whole-system integration test, and "make check"
is not that.

The two tests written in Python and one test based on dbus-send
are also not run directly yet; in particular, that includes both
the tests in run-test-systemserver.sh.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-12 15:26:33 +00:00
Simon McVittie
c7e179f549 name-test C tests: produce structured (TAP) output
Similar to commit 58eefa1031.

test-privserver is a helper executable, not a test. I moved its output
from stdout to stderr so it can't be misinterpreted as the test's
stdout.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-12 15:26:30 +00:00
Simon McVittie
c7f3df0271 Replace $DBUS_USE_TEST_BINARY with $DBUS_TEST_DBUS_LAUNCH
Instead of using $DBUS_USE_TEST_BINARY to control whether to use the
hard-coded test binary TEST_BUS_LAUNCH_BINARY, we can just use
$DBUS_TEST_DBUS_LAUNCH to control what we launch directly, as we
were already doing for $DBUS_TEST_DAEMON.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-12 15:26:23 +00:00
Simon McVittie
384c924c77 Revert "Replace $DBUS_USE_TEST_BINARY with $DBUS_TEST_DBUS_LAUNCH"
This reverts commit 8fd2be6013.
This change was intended for 1.11.
2016-02-12 15:25:15 +00:00
Simon McVittie
9843c724c6 Revert "name-test C tests: produce structured (TAP) output"
This reverts commit fec99c9b3d.
This change was intended for 1.11.
2016-02-12 15:25:13 +00:00
Simon McVittie
c285a053d6 Revert "name-test: run most C tests directly, not via run-test.sh"
This reverts commit d893121efd.
This change was intended for 1.11.
2016-02-12 15:25:12 +00:00
Simon McVittie
d893121efd name-test: run most C tests directly, not via run-test.sh
The exception is test-autolaunch, which is really not particularly
useful as a build-time test. The only way we can really test
autolaunch is as a whole-system integration test, and "make check"
is not that.

The two tests written in Python and one test based on dbus-send
are also not run directly yet; in particular, that includes both
the tests in run-test-systemserver.sh.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-11 02:37:17 +01:00
Simon McVittie
fec99c9b3d name-test C tests: produce structured (TAP) output
Similar to commit 58eefa1031.

test-privserver is a helper executable, not a test. I moved its output
from stdout to stderr so it can't be misinterpreted as the test's
stdout.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-11 02:37:14 +01:00
Simon McVittie
8fd2be6013 Replace $DBUS_USE_TEST_BINARY with $DBUS_TEST_DBUS_LAUNCH
Instead of using $DBUS_USE_TEST_BINARY to control whether to use the
hard-coded test binary TEST_BUS_LAUNCH_BINARY, we can just use
$DBUS_TEST_DBUS_LAUNCH to control what we launch directly, as we
were already doing for $DBUS_TEST_DAEMON.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-11 02:37:11 +01:00
Simon McVittie
67e627ef6c Merge branch 'dbus-1.10' 2016-01-25 15:06:43 +00:00
Simon McVittie
dbeb65c689 Merge branch 'dbus-1.10' into dbus-1.10-ci 2016-01-25 15:06:18 +00:00
Simon McVittie
7eb34fc2cd test/name-test/run-test.sh: output correct result if a C test fails
Loosely based on a patch from amit tewari.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93379
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-01-25 15:05:49 +00:00
Simon McVittie
d5de08f2f9 Don't try to run manual tests in installcheck
We were mistakenly running all installed executables, even manual tests
that never terminate.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02 18:51:08 +00:00
Simon McVittie
0c0cd9aefd Fix shell syntax for installcheck-local with no DESTDIR
A closing brace must be preceded by a semicolon. The CI integration
added later in this branch actually runs "make installcheck"
with no DESTDIR; apparently nobody else has ever tried that.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02 18:51:08 +00:00
Simon McVittie
072d3a6ef7 Don't try to run manual tests in installcheck
We were mistakenly running all installed executables, even manual tests
that never terminate.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02 00:53:00 +01:00
Simon McVittie
81f48a9c62 Fix shell syntax for installcheck-local with no DESTDIR
A closing brace must be preceded by a semicolon. The CI integration
added later in this branch actually runs "make installcheck"
with no DESTDIR; apparently nobody else has ever tried that.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02 00:53:00 +01:00