summaryrefslogtreecommitdiff
path: root/test/Makefile.am
Commit message (Collapse)AuthorAgeFilesLines
* build: Don't assume we can set permissions on a directorySimon McVittie2019-04-171-1/+4
| | | | | | | | MSYS2 has enough of a Unixish environment to run Autotools, but apparently not enough of a Unixish environment to have functional permissions. Closes: dbus#216
* Configure option to disable traditional activationTopi Miettinen2019-03-251-2/+12
| | | | | | | | Traditional activation could be disabled if all services use SystemdService activation instead. Provide an example of a hardened DBus systemd service drop-in file for such a setup. Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
* Consistently add CODE_COVERAGE_LIBS everywhereSimon McVittie2019-01-211-1/+4
| | | | | | | | | | | | We need to link the code coverage objects, directly or indirectly, into every executable and every shared library. The rule I've followed to make it clear that we do this, without too much repetition, is: each executable, shared library or convenience library has CODE_COVERAGE_LIBS in its LDADD or LIBADD, unless it is linked to a convenience library in the same directory that has CODE_COVERAGE_LIBS in *its* LIBADD. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Adapt to API change in AX_CODE_COVERAGE version 28Simon McVittie2019-01-211-2/+4
| | | | | | | | | | | | | | | | AX_CODE_COVERAGE recently changed the way it embedded its Makefile rules in the output file: instead of using @CODE_COVERAGE_RULES@, users are now meant to include aminclude_static.am. The new AX_CODE_COVERAGE is only in the latest autoconf-archive release, version 2019.01.06, which is inconveniently new, so bundle everything we need for the moment. This requires us to stop using the deprecated CODE_COVERAGE_LDFLAGS (which we still used to support older versions of autoconf-archive) and replace them with CODE_COVERAGE_LIBS. Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Move sysdeps tests hereSimon McVittie2019-01-211-0/+1
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Move string tests (most of dbus-string-util.c) hereSimon McVittie2019-01-211-0/+1
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Move marshalling tests into test/Simon McVittie2019-01-211-1/+11
| | | | | | | dbus-marshal-recursive-util.c contains utility functions used by the other two, as well as tests. The others are purely test code. Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Move dbus-message-factory and most of dbus-message-util into test/Simon McVittie2019-01-211-1/+7
| | | | | | | As with previous moves, I've tried to extract the possible copyright holders from the git history. Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Move auth, credentials tests from libdbus-internal into test/Simon McVittie2019-01-211-1/+8
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Split slow parts of the former test-dbus into their own executablesSimon McVittie2019-01-211-0/+12
| | | | | | | This makes it easier for a developer to run just the fast parts while debugging some issue reproduced by the faster tests. Signed-off-by: Simon McVittie <smcv@collabora.com>
* _dbus_test_main: Move to test-utilsSimon McVittie2019-01-211-7/+22
| | | | | | | | | | | | | | | | | Now that there is no code outside test/ that calls into this, we can move it into test/, reducing the size of libdbus. dbus-test-tap.[ch] still need to stay in dbus/ as long as there is code in dbus/ or bus/ relying on them, and also need to be linked into libdbus as long as there is other code in libdbus relying on them, so they stay where they are for now. Similarly, dbus-tests.h lists the tests that are still embedded in libdbus, and must stay where it is for the moment. With this move, various tests now need to be linked to the dbus-testutils convenience library. Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Move dbus-daemon-launch-helper-test here, and renameSimon McVittie2019-01-211-1/+6
| | | | | | | | | The -test suffix does not indicate that this is a test, but rather that it is for tests (similar to the -unix and -win suffixes on modules like dbus-sysdeps). This seems unnecessarily confusing, so rename it to end with -for-tests. Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Move libdbus embedded tests from dbus/ to test/Simon McVittie2019-01-211-2/+4
| | | | | | | | | | | | | | This groups them with the rest of the tests, and enables parts of the test code to be unembedded from libdbus and moved to test/ too. Rename the executable to test-misc-internals, not test-dbus. The name test-dbus made some sense as "the executable that contains the code in dbus/", but makes a lot less sense in test/: dbus is the name of the entire project, so this test has no particular special claim to that name. test-libdbus doesn't seem right either, because all the tests exercise libdbus one way or another. Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Break out the slow parts of test-bus into their own executablesSimon McVittie2019-01-211-1/+11
| | | | | | | This makes it more convenient to re-run the rest of test-bus as required when debugging. Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Move dbus-daemon and d-d-launch-helper tests from bus/Simon McVittie2019-01-211-8/+12
| | | | | | | This groups them with the other tests, and avoids having them influence the test coverage stats in bus/. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Convert spawn test into a standalone test executableSimon McVittie2019-01-211-1/+14
| | | | | | | This test is sufficiently well-separated that there's no real need to embed it in libdbus. Move it into the test directory instead. Signed-off-by: Simon McVittie <smcv@collabora.com>
* test-privserver: Move helper executable out of name-test/Simon McVittie2018-12-131-2/+2
| | | | | | | | | | 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>
* build: Add a way to set CFLAGS for AddressSanitizer etc.Simon McVittie2018-12-111-0/+7
| | | | | | | | | | | | | | | We don't want to set these globally via the normal CFLAGS, because if we did, AddressSanitizer would catch test-segfault deliberately segfaulting, and "helpfully" turn it into exit status 1, which in turn makes our test fail because it asserts that the segfault is reported as a segfault. A typical use with gcc as compiler, on a reasonably recent Debian, would be: ./configure SANITIZE_CFLAGS="-fsanitize=address -fsanitize=undefined -fPIE -pie" Signed-off-by: Simon McVittie <smcv@collabora.com>
* Move _dbus_disable_crash_handling() back into test/ directorySimon McVittie2018-12-111-2/+10
| | | | | | | | | | 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>
* Add build system variable DBUS_NAME_TEST_EXEC to cover differences in ↵Ralf Habacker2018-12-111-0/+2
| | | | | | | | | | | | | | | | executable paths Autotools creates executable applications in the respective subdirectory of the build directory, while cmake creates them in <build-root>/bin. This leads to different paths in the file created from org.freedesktop.DBus.TestSuite.PrivServer.service.in, which are fixed by the new variable. Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/135 Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de> Reviewed-by: Simon McVittie <smcv@collabora.com>
* Translate Python-based tests to CSimon McVittie2018-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies bootstrapping: now you don't have to build dbus, build dbus-python (with GLib), and use dbus-python to test dbus. It also avoids test failures when using facilities like AddressSanitizer. When libdbus is built with AddressSanitizer, but the system copies of Python and dbus-python were not, dbus-python will exit the Python interpreter on load, because libasan wasn't already initialized. The simplest way to avoid this is to not use Python: the scripts are not *that* hard to translate into C. Both of these tests happen to be conditionally compiled for Unix only. test_activation_forking() relies on code in TestSuiteForkingEchoService that calls fork(), which can only work on Unix; meanwhile, test_system_signals() tests the system bus configuration, which is only relevant to Unix because we don't support using dbus-daemon as a privilege boundary on Windows (and in any case D-Bus is not a Windows OS feature, so the system bus cannot be used to communicate with OS services like it can on most Linux systems). This is also a partial solution to <https://gitlab.freedesktop.org/dbus/dbus/issues/135>, by reducing the size of name-test/. For this to work, we need to build the test-service helper executable even if embedded tests are disabled. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Add a test for assertionsSimon McVittie2018-11-201-0/+4
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* _dbus_disable_crash_handling: Factor out from test-segfaultSimon McVittie2018-11-201-0/+3
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* tests: Add a unit test for _dbus_command_for_pid()Simon McVittie2018-10-311-0/+4
| | | | | | In particular this demonstrates that dbus#222 has been solved. Signed-off-by: Simon McVittie <smcv@collabora.com>
* tests: Build test-sleep-forever even if embedded tests are disabledSimon McVittie2018-10-311-1/+1
| | | | | | | It will be used as a long-running subprocess to test _dbus_command_for_pid(). Signed-off-by: Simon McVittie <smcv@collabora.com>
* tests: Build installable helpers whenever any tests are enabledSimon McVittie2018-10-311-2/+10
| | | | | | | | | | | | We might need these to run tests at build-time, so we should build them whenever either modular or embedded tests are enabled, even if installed-tests aren't. We haven't noticed this bug until now because $(installable_helpers) only contained test-apparmor-activation, which isn't normally needed at build-time because the AppArmor test can only work when run as root. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Add basic test coverage for the bus' desktop file parserSimon McVittie2018-10-191-0/+10
| | | | | | | This doesn't cover backslash-escaping in values, or various other corner cases, but it's a start. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Use separate bus configuration files for executing test cases with a ↵Ralf Habacker2018-10-181-1/+6
| | | | | | | | | | | temporary session bus Instead of the previous adaptation of the existing template for the session bus, a separate template is now used, which can be more easily adapted to the requirements of the test applications. Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/57
* Add more test coverage for config file parsingSimon McVittie2018-08-301-0/+22
| | | | | | | | | minimal.conf is a valid config file added to make it obvious why the new invalid config files are invalid. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107739
* Allow longer for tests under valgrindSimon McVittie2018-08-021-0/+1
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107194
* Add a unit test for the dbus-daemon resetting its fd limitSimon McVittie2018-02-201-0/+3
| | | | | | | Reviewed-by: David King <dking@redhat.com> [smcv: Fix typo in cmake macro name] Signed-off-by: Simon McVittie <smcv@collabora.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105165
* Add new test for waiting on pending calls in threadsSimon McVittie2018-02-061-0/+7
| | | | | | | | | | | | 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
* test: Add a test-case for EXTERNAL auth rejecting usernamesSimon McVittie2018-01-151-0/+1
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588
* test: Add a test for authenticating with an empty authorization identitySimon McVittie2018-01-151-0/+1
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588
* Add a test for header fieldsSimon McVittie2018-01-111-0/+10
| | | | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317 Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
* test/containers: Exercise the resource limitsSimon McVittie2017-12-121-0/+2
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* test/containers: New testSimon McVittie2017-12-111-0/+7
| | | | | | | | So far it only exercises SupportedArguments. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* Add a targeted test for OOM during _dbus_server_new_for_tcp_socket()Simon McVittie2017-11-241-0/+4
| | | | | | | | | | 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
* Remove test data in the "message builder" domain-specific languageSimon McVittie2017-11-151-30/+0
| | | | | | | | | | | | | | | | | | | | | 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
* test-bus*: Output TAP directlySimon McVittie2017-11-151-9/+3
| | | | | | Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
* test-dbus: Produce machine-readable TAP outputSimon McVittie2017-11-151-8/+4
| | | | | | | | See http://testanything.org/ for more information on TAP. Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
* build: Use $(MKDIR_P) syntax suitable for install-shilovezfs2017-10-311-1/+1
| | | | | | | | This fixes the build when a GNU-compatible `mkdir -p` is not available. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103521 [smcv: Add commit message] Reviewed-by: Simon McVittie <smcv@collabora.com>
* build: Distribute more test data in source tarballsSimon McVittie2017-10-231-0/+2
| | | | | | | | | | | test-bus exercises the parser by trying to parse every file in these directories. A couple of files were accidentally left out, meaning those parsing code paths are tested when we build from git, but not when we build from a tarball release. 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
* test/data: Test impossible send_broadcast/send_destination pairSimon McVittie2017-09-251-0/+1
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Bug: https://bugs.freedesktop.org/92853 Reviewed-by: Philip Withnall <withnall@endlessm.com>
* userdb: Respect $HOME for the home directory of our own uidSimon McVittie2017-07-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This lets cooperating processes with the same value of $HOME interoperate for DBUS_COOKIE_SHA1 by reading and writing $HOME, even if their $HOME differs from the uid's "official" home directory according to getpwuid(). Out of paranoia, we only do this if the uid and the euid are equal, since if they were unequal the correct thing to do would be ambiguous. In particular, Debian autobuilders run as a user whose "official" home directory in /etc/passwd is "/nonexistent", as a mechanism to detect non-deterministic build processes that rely on the contents of the home directory. Until now, this meant we couldn't run dbus' build-time tests, because every test that used DBUS_COOKIE_SHA1 would fail in this environment. In the tests, set HOME as well as DBUS_TEST_HOMEDIR. We keep DBUS_TEST_HOMEDIR too, because Windows doesn't use HOME, only HOMEDRIVE and HOMEPATH. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101960 Bug-Debian: https://bugs.debian.org/630152 Signed-off-by: Simon McVittie <smcv@debian.org> Reviewed-by: Philip Withnall <withnall@endlessm.com>
* test: Exercise min_fds, max_fdsSimon McVittie2017-07-281-0/+1
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* Add a test-case for combining receive_type and send_destinationSimon McVittie2017-07-281-0/+1
| | | | | | | | | Until the previous commit, this would have worked. Now it correctly fails with "send and receive attributes cannot be combined". Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Thiago Macieira <thiago@kde.org> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92853
* Merge branch 'dbus-1.10'Simon McVittie2017-07-071-0/+2
|\
| * tests: Make tests fail if they try to connect to the real session busSimon McVittie2017-07-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is too easy for a developer working in an environment that has a session bus to write tests that pass locally, but fail in minimal environments. This is also risky because the tests might do destructive things on the developer's real session bus. We can avoid connecting to the session bus by consistently removing its address from the environment, and replacing it with something that will always fail. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101698
* | test-variant: Add a regression test for DBusVariantSimon McVittie2017-07-051-0/+4
| | | | | | | | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101568