Commit graph

74 commits

Author SHA1 Message Date
Simon McVittie
9490e954d0 test-privserver: Move helper executable out of name-test/
This means we don't need to distinguish between DBUS_NAME_TEST_EXEC and
DBUS_TEST_EXEC any more, because all test helper executables are in the
same place, both during build and when installed (we don't install
test-privserver since no installed test requires it yet, but in
principle we could).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-13 13:08:00 +00:00
Simon McVittie
64f94d3f5b Move _dbus_disable_crash_handling() back into test/ directory
It's only used in test code. We have to put it in its own translation
unit with no non-libc dependencies so that we can compile a copy of it
without AddressSanitizer support, because in a subsequent commit we will
special-case test-segfault to be compiled without using AddressSanitizer,
which would make linking to an AddressSanitizer-instrumented libdbus fail.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-11 12:47:22 +00:00
Simon McVittie
a889e5aa8c Add a test for assertions
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-11-20 12:58:17 +00:00
Simon McVittie
93c1d08300 tests: Add a unit test for _dbus_command_for_pid()
In particular this demonstrates that dbus#222 has been solved.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-10-31 16:56:36 +00:00
Ralf Habacker
f2f4f4795c Cleanup of the cmake definitions of source directories
Since the cmake build system is located below the cmake/
subdirectory, references to the source files used such as
../../bus or ${CMAKE_SOURCE_DIR}/../dbus etc. are required.
To standardize and simplify this, a cmake variable is now
defined in each of the listed directories, which contains
the corresponding path.
2018-10-25 13:23:20 +00:00
Simon McVittie
bd9b26ae47 desktop-file test: Add to CMake build
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-10-19 11:11:55 +00:00
Simon McVittie
4e3bfe0c97 cmake: Fold GObject detection into GLib detection
Everywhere that we want GLib, we also want GObject and GIO. Detecting
GLib and GIO but not GObject makes very little sense anyway, because
GIO depends on GObject.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105521
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2018-03-19 12:33:45 +00:00
Simon McVittie
0b1e292860 Add new test for waiting on pending calls in threads
Based on code contributed by Manish Narang. This is not included in the
automated test suite, because it isn't reliable on heavily-loaded
automatic test infrastructure like Travis-CI.

Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Add the test to the CMake build system too, as requested]
[smcv: Convert into a manual test]
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=102839
2018-02-06 22:36:30 +00:00
Simon McVittie
ac6c4d384d Add a targeted test for OOM during _dbus_server_new_for_tcp_socket()
This also covers _dbus_server_new_for_socket(), which is one of the
worse places in terms of complexity of the error-unwinding path
(3 labels).

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
2017-11-24 12:17:35 +00:00
Simon McVittie
85e89a4e9b Remove references to test/data/incomplete-messages too
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-15 15:28:11 +00:00
Simon McVittie
6fb2f4c00a tests: Remove leftover references to valid-messages directory
Now that the directory doesn't exist in git, the embedded tests fail
in a clean git checkout.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-11-15 15:04:44 +00:00
Simon McVittie
09076dfea0 Remove test data in the "message builder" domain-specific language
These tests were disabled by commit 9c3d566, which rewrote the D-Bus
type system to be fully recursive, back in 2005. The message builder
was subsequently removed by commit 9d21554, also in early 2005.

It will probably take significant work to turn these files into
test-cases that use the current D-Bus type system and so can be run
this decade. Until that work is done, let's not ship them: we can
always fetch them from git history if we want them.

The single .message-raw file can still be read and has been retained,
although it hasn't actually tested the intended failure mode since
2005 due to changes to the D-Bus specification (it is a wire-protocol
version 0 message, and the recursive type system introduced in commit
9c3d566 changed the wire-protocol version to 1).

Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103758
2017-11-15 13:59:05 +00:00
Simon McVittie
1e8c52c647 build: Remove various unused files from build system
These were in git but not distributed in source tarballs, and in fact
not hooked up to the Autotools build system at all.
test/data/valid-introspection-files was mentioned in the CMake build
system (copied from the source directory to the build directory), but
according to `git grep` is not used for anything.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103420
2017-10-23 16:08:32 +01:00
Ralf Habacker
93aec34b10 Add test-uid-permissions test case to cmake build system.
Reviewed-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99586
2017-01-30 17:47:43 +01:00
Simon McVittie
4ddf4be03c cmake: copy the systemd-activation directory too
It is needed for a couple of test-cases.

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
90a5da3a05 cmake: manual-tcp is not an automated test
Don't run it when we run automated tests.

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
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
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
Ralf Habacker
12214344a2 Keep cmake build system in sync with autotools (add test-monitor).
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92298
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-10-21 13:26:16 +02:00
Ralf Habacker
2c7abec29e Add test-fdpass to cmake build system.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=17289
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-04 18:43:54 +00:00
Ralf Habacker
53d3914946 Add manual-paths test executable with cmake build support.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83539
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-02-12 23:22:18 +01:00
Simon McVittie
94610d7de6 Add a common test_init() for GLib tests which prevents hanging forever
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46787
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
2015-02-04 17:15:36 +00:00
Ralf Habacker
b36747519a Link tests to test-utils-glib.c under CMake too
[Separated out from a larger commit -smcv]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88964
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-02-04 15:11:48 +00:00
Ralf Habacker
fa1ada44ea Add manual tcp test case.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=87999
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-01-30 09:33:40 +01:00
Ralf Habacker
ea54a97f05 Merge branch 'dbus-1.8'
Conflicts:
	NEWS
	configure.ac
2015-01-05 11:49:48 +01:00
Ralf Habacker
01af167b55 Windows cmake cross compile fix
We need to include 'test' subdir in any case not only when using glib.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88009
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-01-05 11:47:13 +01:00
Ralf Habacker
8ad6a5575f Include test-dbus and test-bus in cmake 'make check' target.
Because test-dbus and test-bus lives in subdirectory dbus/bus, we need
to define make 'check' in top level source directory.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-24 18:49:44 +02:00
Simon McVittie
8fd6e561df cmake: only copy session.conf and system.conf into test data dir
Historically, CMake used the glob *.conf.in whereas Autotools listed
the files explicitly. This used to be equivalent, but broke down
when we added example-*.conf.in which are just snippets rather than
complete configuration files (they're intended to go in session.d
or system.d, or otherwise get included by the main config file).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-10-24 16:51:53 +02:00
Ralf Habacker
89c6173706 Add directory test application 'manual-dir-iter' to cmake and autotools build system.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=57272
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-08 14:33:37 +00:00
Ralf Habacker
d8394d75d1 Win32 cmake msvc16 64 bit native and mingw32/64 4.8.3 cross compile fix.
This patch fixes a "missing include directory" compile error on test-print build target.

Bug: http://lists.freedesktop.org/archives/dbus/2014-August/016260.html
Reviewed-by: rony@wu.ac.at
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-08-08 19:03:05 +02:00
Ralf Habacker
5dfc800644 Let cmake 'make check' run test applications as test group.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17 16:29:37 +00:00
Ralf Habacker
54440baa21 Rename spawn-test to test-spawn to match common test application naming scheme.
[Same change as for shell-test in the previous commit. -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17 16:29:19 +00:00
Ralf Habacker
e782b0806e Rename shell-test to test-shell to match common test application naming scheme.
[Add its source file to SOURCES: this test was previously relying on the
Automake feature that the default value of foo_bar_SOURCES is foo-bar.c. -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17 16:28:39 +00:00
Ralf Habacker
8e728f36d1 Use macros for test and helper executable targets on cmake build system.
The new macros add_test_executables and add helper_executables provides a
platform independent way for specifing dbus test and service applications.

On native Windows and Linux/UNIX systems the test applications are
directly runable.

When cross compiling for Windows on Linux test applications could be
executed on the Linux host system with the help of wine and activated
binfmt_misc support for wine.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-10 01:24:56 +01:00
Ralf Habacker
79a7a30cdb Add 'check' cmake target to keep in sync with autotools.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-10 01:07:38 +01:00
Ralf Habacker
21ad24ada5 Create session.conf and system.conf for test/data/valid-config-files from *.in files on cmake.
We need to patch the listen address.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-10 00:48:50 +01:00
Ralf Habacker
67a78c4ef6 Define TEST_BUS_LAUNCH_BINARY for cmake to keep in sync with autotools.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-10 00:41:02 +01:00
Ralf Habacker
9866c2d785 Remove obsolete cmake project tags in sub directories; we only have one project.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68506
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-08 01:35:49 +01:00
Ralf Habacker
e09eb12683 Add glib support to cmake buildsystem.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68506
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-07 19:06:26 +01:00
Simon McVittie
30e7a81302 Tests: allow dbus-glib to be replaced with use of libdbus-internal
We only use dbus-glib for its main loop; within dbus, DBusLoop is
available as an alternative, although it isn't thread-safe and
isn't public API.

For tests that otherwise only use libdbus public API, it's desirable to
be able to avoid DBusLoop, so we can run them against an installed
libdbus as an integration test. However, if we don't have dbus-glib,
we're going to have to use an in-tree main loop, which might as well
be DBusLoop.

The major disadvantage of using dbus-glib is that it isn't safe to
link both dbus-1 and dbus-internal at the same time. This is awkward
for a future test case that wants to use _dbus_getsid() in dbus-daemon.c,
but only on Windows (fd.o #54445). If we use the same API wrapper around
both dbus-glib and DBusLoop, we can compile that test against dbus-glib
or against DBusLoop, depending on the platform.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-03 12:00:51 +01:00
Chengwei Yang
0cb7d487bc tests to embedded tests: replaced in cmake files
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66291
2013-06-28 12:18:32 +01:00
Simon McVittie
f56a55af1a Revert "made session service dirs customizable: cmake part"
This reverts commit 89e453216c.
It makes the tests fail under autotools.
2012-01-04 18:20:15 +00:00
Ralf Habacker
89e453216c made session service dirs customizable: cmake part 2011-11-21 12:21:01 +01:00
Simon McVittie
c141af6147 Remove EXT variable from CMake, just use Automake-compatible EXEEXT
According to Ralf, there's no standard name for this in CMake, so we
might as well use the standard Automake name.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41222
2011-09-28 19:01:15 +01:00
Simon McVittie
e9f0378bbf Merge tests' cmake and autotools bus configuration
In Unix, the tests listened on both debug-pipe (which is a socketpair,
or a TCP emulation of socketpair on Windows) and a Unix socket.

In the Windows port, the tests were hard-coded to listen on a particular
port, which allowed the dispatch test to connect to that port, as long
as no two tests ran simultaneously (which I don't think was ever guaranteed -
make -j can violate this). That's valid out-of-process, and also
fully-specified, so they only needed one <listen> directive, so the
CMake input only had one.

To make the tests work under CMake on Unix, there was a hack: the string
substituted for the content of the <listen> directive contained
</listen><listen> to get the other address in, which is pretty nasty.

Instead of doing that, I've made both build systems, on both Unix and
Windows, use both debug-pipe and a more normal transport (Unix or TCP).
debug-pipe has a Windows implementation and it's used in
dbus-spawn-win.c, so it'd better work. The use of debug-pipe is now
hard-coded rather than being a configure parameter (there's no reason
to vary it in different builds), and I used TEST_LISTEN as the name of the
Unix/TCP address, because it's a "vague" address (no specific Unix path, no
TCP port), that you can listen on but not connect to.

This in turn means that we can merge the Autoconf .in and CMake .cmake
files, similar to Bug #41033.

You might wonder why I've kept debug-pipe. I did try to get rid of it, but
it turns out that the tests in dispatch.c rely on
dbus_connection_open_private() not blocking, and normal socket
connections block on connect(). Until we fix that by adding an async
version of dbus_connection_open_private(), it won't be safe to have a
test like dispatch.c that "talks to itself", unless it uses a transport
as trivial as debug-pipe in which neither end has to block on the other.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41222
2011-09-28 19:00:56 +01:00
Simon McVittie
274e0fbc20 Simplify linking for tests that use libdbus-testutils
This is the library used by tests that link libdbus-internal and DBusLoop.
By linking libdbus-internal into it, we can avoid having to repeat that
dependency all over the place - libtool and cmake both know how to follow
recursive dependencies.

In cmake, also use libdbus-testutils for more tests, in preference to
repeating its source files.
2011-07-29 11:17:17 +01:00
Simon McVittie
9a97f82079 Import compiler.m4 and lcov.am from telepathy-glib, and use them to replace gcov
Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=10887
2011-02-17 17:07:12 +00:00
Ralf Habacker
37619035de Keep in sync with automake. 2010-12-04 23:05:56 +01:00
Ralf Habacker
280cdc2ad8 Added missing test libraries and tools to keep in sync with autotools. 2010-04-13 21:18:41 +02:00
Ralf Habacker
e828d41e3e Keep test file directories in sync with autotools 2010-04-13 21:17:31 +02:00