Commit graph

944 commits

Author SHA1 Message Date
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
Simon McVittie
66c15a41b6 Merge branch 'dbus-1.10' 2015-11-23 21:30:21 +00:00
Simon McVittie
edb1e57260 uid-permissions test: don't assert that root can UpdateActivationEnvironment
Since 1.10.4 this is hard-coded to be disallowed when an activation
helper is used. That would be a security flaw waiting to happen,
and makes little sense anyway, because the activation helper sanitises
its environment.

Use BecomeMonitor() instead, as our way to assert that root and
messagebus are privileged.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93036
Reviewed-by: Iain Lane
2015-11-23 20:59:48 +00:00
Simon McVittie
f3be583b40 monitor: use the addressed_recipient to select matches
This means we respect the destination keyword in arguments to
BecomeMonitor.

In bus_dispatch(), this means that we need to defer capturing until
we have decided whether there is an addressed recipient; so instead
of capturing once, we capture at each leaf of the decision tree.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92074
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Reviewed-by: Lars Uebernickel <lars@uebernic.de>
2015-11-17 20:53:08 +00:00
Simon McVittie
6c0c7ce255 name-test: don't run these tests with autotools if targeting Windows.
The wrapper shell script that sets up their environment is nowhere
near being portable. In particular, it uses dbus-run-session,
which is Unix-specific.

[rh: Add autotools scope in commit title]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Rewieved-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-11-17 21:09:47 +01:00
Jan Alexander Steffens (heftig)
6e63e23983 test/sd-activation: Test UpdateActivationEnvironment forwarding
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92857
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-17 18:21:26 +00:00
Simon McVittie
a12c9cebb7 manual-backtrace: use proper prototypes, and make functions static
Otherwise this will fail to compile with our default Autotools
compiler warnings.
2015-11-17 15:32:43 +00:00
Simon McVittie
a7cc817895 Merge branch 'dbus-1.10' 2015-11-17 15:28:50 +00:00
Simon McVittie
32f966b908 fdpass test: assert that TCP connections don't say they can pass fds
As well as slightly increasing our test coverage, this ensures
that at least one test-case in this test is not skipped, working
around CMake's lack of support for the Automake-style exit code
produced by GTest executables (they exit 77 if everything was skipped).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92887
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-11-17 14:48:23 +01:00
Ralf Habacker
5ce3b93c71 Add backtrace test app.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-17 14:30:54 +01:00
Ralf Habacker
8b31f2fee9 shell-test: Calling _dbus_string_init without checking return value (CID 60587).
Reported by Coverity: CID 60587: Unchecked return value (CHECKED_RETURN)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-12 23:07:30 +01:00
Simon McVittie
a89e450181 Merge branch 'dbus-1.10' 2015-11-06 12:12:55 +01:00
Ralf Habacker
34d0c73f99 Test system bus config files on Unix only
Previously, we didn't consistently test parsing of every file in
valid-config-files-system/ everywhere that we tested valid-config-files/.
We now test it on Unix.

The system bus is not supported on Windows, so we do not test
valid-config-files-system/ there.

valid-config-files/many-rules.conf contains <user> and <group> rules
which are not applicable to Windows. Copy the original many-rules.conf
to valid-config-files-system/ so that it will be tested on Unix, and
remove the non-portable rules from valid-config-files/many-rules.conf.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
[rh:base patch came from Simon]
2015-11-03 14:22:30 +01:00
Simon McVittie
6e8f9c35e6 refs test: reduce number of repeats under Wine
Under Wine, the API calls we use to do this are implemented via IPC
to wineserver, which makes it unreasonably slow to try to brute-force
bugs by having many threads stress-test refcounting. Do a few
repetitions just to verify that refcounting basically works, but
don't do the full stress-test.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92538
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[rh: add WINESERVERSOCKET related hint]
2015-10-29 06:35:44 +01:00
Simon McVittie
24342d5912 When running TAP tests, filter out trailing \r from Windows .exe
If we're running Windows executables using Wine, then tap-driver.sh
won't accept "1..4\r\n" as TAP syntax.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92538
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-10-29 05:50:27 +01:00
Simon McVittie
e09e6ee69e Merge branch 'dbus-1.10' 2015-10-26 12:49:18 +00:00
Simon McVittie
dc8bb27099 Add a regression test for invalid BecomeMonitor calls
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92298
2015-10-26 12:46:55 +00:00
Simon McVittie
71a9153d85 Merge branch 'dbus-1.10' 2015-10-26 12:11:35 +00:00
Simon McVittie
4eddd1bf52 When running dbus-daemon --session in tests, override listen address
Otherwise, we can't reliably run tests for Windows, because the default
listening address on Windows is "autolaunch:" which is global to
a machine, resulting in testing an installed dbus-daemon instead of
the one we intended to test.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92538
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-10-26 11:57:35 +00:00
Simon McVittie
382cb17d37 Disable activation tests on Windows builds
These rely on the --systemd-activation code path, which is not
compiled for Windows.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92538
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-10-22 17:35:59 +01:00
Simon McVittie
f830e14d30 Use DBusString for all relocation and install-root code
This means we handle OOM correctly, and makes it obvious
that we are not overflowing buffers. This change does not
affect the actual content of the strings.

Instead of redefining DBUS_DATADIR to be a function call
(which hides the fact that DBUS_DATADIR is used),
this patch makes each use explicit: DBUS_DATADIR
is always the #define from configure or cmake, before
replacing the prefix.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83539
Tested-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-10-05 16:29:29 +01:00
Simon McVittie
0a0206d9a6 Distribute tap-test.sh.in unconditionally
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=91684
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
2015-08-25 16:42:15 +01:00
Simon McVittie
27a6538d5b Add test-case for the same situation as fd.o #90952
This does not directly test the code in the previous commit, but it does
confirm that calling dbus_connection_set_route_peer_messages() is enough
to fix the observed bug.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90952
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
[smcv: re-worded commit message in response to review]
2015-07-21 16:52:23 +01:00
Simon McVittie
54357a9692 tests: use the new bus setup for make installcheck
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280
Reviewed-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
2015-06-17 16:06:53 +01:00
Dimitri John Ledkov
b2c61ca6ea Move session & system bus configuration to datadir, by default.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-05-27 11:49:34 +01:00
Simon McVittie
f5e1c1391f Turn DBusSocket into a type-safe struct, preventing inappropriate conversion
Fix the remaining platform-specific code to look at the struct's
appropriate platform-specific member.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
2015-05-12 18:35:56 +01:00
Ralf Habacker
c396b8ea56 test_command_line_internal: Fix variable original_argv going out of scope leaks the storage it points to (CID 60588).
Reported by Coverity: CID 60588: Resource leak (RESOURCE_LEAK)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-05-01 23:05:14 +02:00
Ralf Habacker
e48dd5b3ca test_command_line_internal: Fix 'variable shell_argv going out of scope leaks the storage it points to' (CID 54751)
Reported by Coverity: CID 54751: Resource leak (RESOURCE_LEAK)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-05-01 23:05:05 +02:00
Simon McVittie
15e6b4f5b5 Move Autoconf/Automake droppings into /build-aux/
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846
2015-04-16 13:06:33 +01:00
Simon McVittie
0de568e52b Run name-test tests under the TAP driver
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846
2015-04-16 13:06:32 +01:00
Simon McVittie
56e1448bed name-test: remove unused die function
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846
2015-04-16 13:06:31 +01:00
Simon McVittie
4f4801346e Run most tests under the TAP driver, with a simple adaptor for non-TAP tests
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846
2015-04-16 13:06:29 +01:00