Commit graph

5706 commits

Author SHA1 Message Date
Simon McVittie
d7644b7d4f build: Compile most bus/ files into static libraries
This means we can share them between tests without having to compile
the same file repeatedly, and makes them easier to share between
directories when we move test executables into test/.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-01-21 15:14:29 +00:00
Simon McVittie
651a82e685 test-utils: Add copyright and licensing
As far as I can tell, the only significant contributions have been
from Red Hat and Collabora, both of which have given permission to
relicense their parts of the dbus codebase to MIT/X11; so let's go
with that.

I'm assuming here that tree-wide changes from
_DBUS_GNUC_WARN_UNUSED_RESULT to _DBUS_WARN_UNUSED_RESULT, and tree-wide
changes to how we include config.h, are not significant for copyright
purposes.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-01-21 15:14:29 +00:00
Simon McVittie
470d3f9d4b Merge branch 'fix-ctest-runtime-path-issue' into 'master'
Make sure ctest on Windows uses the currently built dbus library

See merge request dbus/dbus!83
2019-01-10 21:45:55 +00:00
Ralf Habacker
7f9eb9cea8 Make sure ctest on Windows uses the currently built dbus library
The ctest application is usually not installed in the dbus build
directory. If an older dbus library is contained in this path, it will
be used instead of the currently built one, which can lead to runtime
errors (e.g.: c0000139) if the internal dbus API differs.
2019-01-10 20:19:04 +01:00
Ralf Habacker
85253791ff Merge branch 'rename-dbus-socket-set' into 'master'
Rename structure DBusSocketSet to DBusPollableSet and adjust the corresponding functions/files

See merge request dbus/dbus!81

Reviewed-by: Simon McVittie
2019-01-09 17:54:07 +00:00
Ralf Habacker
4573c15ebb Rename structure DBusSocketSet to DBusPollableSet and adjust the corresponding functions/files
Because the implementation of DBusSocketSet already supports non-socket
pollables like pipes and inotify fd on Unix, DBusPollableSet is a better
name.
2019-01-09 15:20:19 +01:00
Simon McVittie
20deb4b61b Merge branch 'windows-spawn-cleanup' into 'master'
Windows spawn cleanup

See merge request dbus/dbus!80
2019-01-07 11:06:16 +00:00
Ralf Habacker
276e766c97 Merge branch 'glib-2.38-support' into 'master'
Add glib 2.38 support

See merge request dbus/dbus!79

Reviewed-by: Philip Withnall
Reviewed-by: Simon McVittie
2019-01-07 09:27:55 +00:00
Ralf Habacker
602f4506a8 Add glib 2.38 support 2019-01-06 21:24:10 +01:00
Ralf Habacker
0c0056c7d6 dbus-spawn-win.c: Simplify logic of return value from call to _dbus_spawn_program()
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-05 11:41:58 +01:00
Ralf Habacker
4cae5cb81c dbus-spawn-win.c: Return valid error if child could not be spawned
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-05 11:41:58 +01:00
Ralf Habacker
bcd750fa2e dbus-spawn-win.c: Don't wait for babysitter thread to start
Now that we start the spawned program from the main thread, there
is no need to wait for it before dereferencing `sitter->child_handle`.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-05 11:41:58 +01:00
Ralf Habacker
61c76cae02 dbus-spawn-win.c: Move out argv copy from DBusSitter struct
Since the child program is started in the main thread, there is no
need to pass a copy of argv to the thread waiting for the child's
termination.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-05 11:41:58 +01:00
Simon McVittie
88032367a9 dbus-spawn: Don't take ownership of envp
It's unexpected for a function to take ownership of its arguments
without indicating that in its name, or at least documenting it.

The only caller with envp != NULL is in
bus_activation_activate_service(), which has been updated.

Based on part of a larger commit by Ralf Habacker.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-01-05 11:41:58 +01:00
Simon McVittie
5b72329d7d dbus-spawn-win: Move _dbus_spawn_program() to main thread
We would like to stop taking ownership of envp, but we can't do that
without a deep copy if a different thread might still be using it
(asynchronously) after the main thread has returned from
_dbus_spawn_async_with_babysitter().

Originally part of a larger commit by Ralf Habacker.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-01-05 11:41:58 +01:00
Simon McVittie
fb7484121a Merge branch 'cmake-custom-install-dirs' into 'master'
In cmake use variables provided from GNUInstallDirs consequently

See merge request dbus/dbus!77
2019-01-04 18:27:50 +00:00
Ralf Habacker
fb799c6fd3 In cmake use variables provided from GNUInstallDirs consequently
This is required to support a custom installation layout, e.g. the
KDE binary factory.
2018-12-21 19:55:07 +01:00
Simon McVittie
f843e56d50 Merge branch 'test-defend-getenv' into 'master'
test-wrappers: Copy strings that might come from getenv()

Closes #240

See merge request dbus/dbus!74

Reviewed-by: Philip Withnall
2018-12-20 13:28:42 +00:00
Simon McVittie
6b71e92fd6 Merge branch 'test-main-boilerplate' into 'master'
Consolidate boilerplate from embedded tests' main()

See merge request dbus/dbus!73

Reviewed-by: Ralf Habacker
2018-12-20 13:27:42 +00:00
Simon McVittie
910ac29384 Merge branch 'deprecate-packaged-xml-in-sysconfdir' into 'master'
Deprecate packaged XML policies in ${sysconfdir}

See merge request dbus/dbus!76

Reviewed-by: Tom Gundersen
2018-12-20 13:25:21 +00:00
Simon McVittie
3c4a663800 dbus-daemon(1): Give more comprehensive examples of how to add services
While writing the wording to deprecate XML policy installed by packages
into ${sysconfdir}, I realised we didn't give a typical example of
what packages *should* do.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-19 17:29:11 +00:00
Simon McVittie
dee0f55111 Officially deprecate package-supplied dbus-daemon policy in ${sysconfdir}
Now that dbus 1.10 has become widely available, we should start to
treat ${sysconfdir} as reserved for the sysadmin, and encourage
third-party software packages to install their integration files into
${datadir}.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-19 17:27:15 +00:00
Ralf Habacker
e1752785f3 Merge branch '135-session-test-support-windows' into 'master'
name-test: Run most tests in CMake, via dbus-run-session

See merge request dbus/dbus!23
2018-12-18 07:15:01 +00:00
Ralf Habacker
d6ee9ad0d6 Fix multi-configuration generator support
Multi-configuration generators (VS, Xcode) append a per-configuration
subdirectory to the specified CMAKE_xxx_OUTPUT_DIRECTORY} directory.

To use the real output paths in test applications, this subdirectory
must be added to the corresponding cmake variables.
2018-12-17 16:37:41 +01:00
Ralf Habacker
b60cd32515 Add cmake support for session based test executables
This patch introduces a new cmake macro add_session_test_executable,
which uses dbus-run-session to start a dbus-daemon process with a
temporary session bus in the background and the desired client file.

add_session_test_executable requires additional environment variables
defined in the top level CMakeLists.txt.

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/135
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2018-12-17 16:36:32 +01:00
Ralf Habacker
578ea41d8c Add cmake support for session based test executables
This patch introduces a new cmake macro add_session_test_executable,
which uses dbus-run-session to start a dbus-daemon process with a
temporary session bus in the background and the desired client file.

add_session_test_executable requires additional environment variables
defined in the top level CMakeLists.txt.

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/135
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2018-12-17 16:25:12 +01:00
Ralf Habacker
a9e25f06c8 Use prefined variables to setup environment in cmake macro add_test_executable
Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/135
2018-12-17 16:25:12 +01:00
Ralf Habacker
b1cba7b169 Add missing extension to TEST_LAUNCH_HELPER_BINARY in cmake 2018-12-17 16:25:12 +01:00
Ralf Habacker
ae96d7c55c Fix setup of build time output paths in cmake
Instead of the variables EXECUTABLE_OUTPUT_PATH and
LIBRARY_OUTPUT_PATH, which have become obsolete since
cmake 3.x, CMAKE_xxx_OUTPUT_PATH is now used to define
output paths in the build directory.
2018-12-17 16:25:03 +01:00
Simon McVittie
132bd470b0 test-wrappers: Copy strings that might come from getenv()
It is not safe to assume that the result of getenv() is not invalidated
by a subsequent call to setenv(), and dbus#240 demonstrates that this
can be a problem in practice when running Windows code under Wine.

Closes: https://gitlab.freedesktop.org/dbus/dbus/issues/240
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-17 14:13:22 +00:00
Simon McVittie
295e5a19a7 tests: Collect common code from embedded-test main executables
This all seems to have been written by Red Hat or by Collabora, so we
have permission to relicense it under the MIT/X11 license, and we
might as well do so.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-17 14:12:59 +00:00
Simon McVittie
9c4f9206c4 bus tests: Skip unsupported fd-passing test internally, not from main()
This results in one less special case in test-main, which will be
significant when we want to make the tests more data-driven.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-17 14:12:59 +00:00
Simon McVittie
4587be1442 embedded tests: Time how long each test takes
This will help to split them up into modules that each take a
reasonable time.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-17 14:12:59 +00:00
Simon McVittie
0315809596 embedded tests: Conform to the same API for all tests
This will make it possible to unify the wrapper code that runs them.

I'm using a plain C string rather than a DBusString to make it
more straightforward to carve out tests into their own executables.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-17 14:12:59 +00:00
Simon McVittie
bb58ce1707 dbus-marshal-validate.h: Make self-contained
This header mentions DBusString, so it had better include dbus-string.h.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-17 14:12:59 +00:00
Simon McVittie
e64c60cf46 Merge branch 'copyright-whitespace' into 'master'
trivial: Remove trailing whitespace from copyright notices

See merge request dbus/dbus!75

Reviewed-by: pwithnall
2018-12-17 12:13:12 +00:00
Simon McVittie
39ea37b587 trivial: Remove trailing whitespace from copyright notices
We don't usually mass-remove trailing whitespace from the actual source
code because it would complicate cherry-picking bug fixes to older
branches, but that reasoning doesn't really apply to the comments
containing copyright and licensing notices.

Removing trailing whitespace makes it much easier to move code around:
we have a commit hook that rejects commits containing trailing
whitespace, but that commit hook counts moving a file as a delete + add
pair, so it objects to moving code that contains trailing whitespace.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-17 11:22:39 +00:00
Simon McVittie
95797dc99a Merge branch 'remove-threads-init-debug' into 'master'
_dbus_threads_init_debug: Remove

See merge request dbus/dbus!72
2018-12-17 10:28:07 +00:00
Simon McVittie
83034f38be _dbus_threads_init_debug: Remove
libdbus has been thread-safe by default since 1.7.6 (2013):
dbus_threads_init_default() is called on a just-in-time basis
whenever needed, and _dbus_thread_init_debug() is equivalent to that.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 20:06:02 +00:00
Simon McVittie
c3f401a673 Merge branch 'gitignore' into 'master'
trivial: Clean up .gitignore files

See merge request dbus/dbus!70

Reviewed-by: pwithnall
2018-12-14 15:11:51 +00:00
Simon McVittie
fa63c16346 .gitignore: Ignore many more generated files
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 13:28:50 +00:00
Simon McVittie
5e66241c77 Merge branch 'reduce-test-refs-run-time' into 'master'
Decrease the runtime of test-refs under Windows

Closes #244

See merge request dbus/dbus!65
2018-12-14 13:08:01 +00:00
Simon McVittie
d3fffaa72f .gitignore: Normalize into LC_ALL=C sort order
If lists are in a completely arbitrary order, sorting them consistently
means that there is only one correct place to insert a new entry, avoiding
the merge conflicts that would occur if we always append new entries.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:53:08 +00:00
Simon McVittie
0c62a9a5f4 .gitignore: Make match patterns more specific
In subdirectories we mostly only want to match at the current level,
not in nested subdirectories.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:53:08 +00:00
Simon McVittie
dfd09355ef valid-config-files-system .gitignore: Don't ignore many-rules.conf
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:53:08 +00:00
Simon McVittie
2fd386245b .gitignore: Remove obsolete patterns
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:53:08 +00:00
Simon McVittie
c95873e537 .gitignore: Consolidate generic patterns at top level
Patterns in the top-level .gitignore match in all subdirectories, so
there's no need to repeat ourselves quite so much for generic
C, Autotools and gcov patterns.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:53:08 +00:00
Simon McVittie
d79986db28 Top level .gitignore: Sort anchored patterns in LC_ALL=C sort order
If lists are in a completely arbitrary order, sorting them consistently
means that there is only one correct place to insert a new entry, avoiding
the merge conflicts that would occur if we always append new entries.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:52:15 +00:00
Simon McVittie
9984e6ebed Top level .gitignore: Group anchored and unanchored patterns
The anchored patterns match only in the top directory; the unanchored
patterns match in any subdirectory. While I'm moving the unanchored
patterns around anyway, sort them in lexicographical (LC_ALL=C sort)
order.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:42:22 +00:00
Simon McVittie
27d69a8899 .gitignore: Anchor patterns for files that are only at top level
There shouldn't be an aclocal.m4 in any subdirectory, for instance,
so there's no need to ignore it.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-14 12:40:22 +00:00