summaryrefslogtreecommitdiff
path: root/test/test-utils.h
Commit message (Collapse)AuthorAgeFilesLines
* test: Move TAP helpers into dbus-testutils if embedded tests are disabledSimon McVittie2020-04-201-0/+2
| | | | | | | This lets us run a subset of the tests that previously relied on extra test-only code being compiled into libdbus. Signed-off-by: Simon McVittie <smcv@collabora.com>
* tests: Improve messages when fd leaks are diagnosedSimon McVittie2019-07-021-1/+2
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* Move _dbus_check_fdleaks_* from dbus-message-util to testsSimon McVittie2019-07-021-1/+6
| | | | | | This is only called from test code. Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Add basic test coverage for DBUS_COOKIE_SHA1Simon McVittie2019-06-091-0/+8
| | | | | | | | | We don't actually complete successful authentication, because that would require us to generate a cookie and compute the correct SHA1, which is difficult to do in a deterministic authentication script. However, we do assert that dbus#269 (CVE-2019-12749) has been fixed. Signed-off-by: Simon McVittie <smcv@collabora.com>
* _dbus_test_main: Move to test-utilsSimon McVittie2019-01-211-0/+24
| | | | | | | | | | | | | | | | | 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-utils: Add copyright and licensingSimon McVittie2019-01-211-0/+27
| | | | | | | | | | | | | | 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>
* Enable "unused result" warning for Visual Studio >= 2012 (MSVC 11.0)Daniel Wendt2018-03-151-4/+4
| | | | | | | | | | | | | | The _Must_inspect_result_ annotation is documented to be used in both the declaration and implementation, but in testing with the MSVC 2012 compiler it appears to be sufficient to use the annotation only in the declaration to get a compiler warning, as with the GCC compiler. So the annotation is not necessary in the C implementation. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105460 [smcv: Rebase dbus-sysdeps.h changes on master] [smcv: Clarify commit message] Reviewed-by: Simon McVittie <smcv@collabora.com> Tested-by: Daniel Wendt <daniel.wendt@linux.com>
* test-utils: Separate failable and non-failable functionsSimon McVittie2017-12-041-2/+11
| | | | | | | | | | | | | test_object_try_whatever() now has libdbus-like OOM handling, while test_object_whatever() has GLib-like OOM handling. This is because an overwhelming majority of the callers of these functions either didn't check for OOM anyway, or checked for it but then aborted. In the uncommon case where we do care, we can use the _try_ version. 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>
* tests: always use libdbus-internal for main loop, never dbus-glibSimon McVittie2015-02-201-12/+3
| | | | | | | | | | This gets rid of a potential circular dependency, which is annoying when bootstrapping. It is nice to have the regression tests use the shared libdbus, but we're about to make it possible to do that anyway, even though some of them use internal symbols. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83115 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* Factor out some utility functions from test/dbus-daemon*Simon McVittie2015-02-031-0/+2
| | | | | | | | | | | In the process, make test_kill_pid() safer: do not try to terminate more than one pid, or the NULL handle. Also stop leaking the address_fd in spawn_dbus_daemon, a pre-existing bug that was spotted by Philip Withnall during review. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810 Reviewed-by: Philip Withnall
* Tests: allow dbus-glib to be replaced with use of libdbus-internalSimon McVittie2013-09-031-9/+26
| | | | | | | | | | | | | | | | | | | | | | 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>
* Define DBUS_COMPILATION externally for all tests that use internal stuffSimon McVittie2013-09-031-4/+0
| | | | | | | It might as well go in the AM_CPPFLAGS rather than in the source code. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
* Consistently include <config.h> in all C source files and never in header files.Marcus Brinkmann2010-03-191-1/+0
|
* Add noinst convenience test library, add a test-shutdownColin Walters2008-05-301-0/+2
| | | | | | | | | | | | | * test/Makefile.am: New convenience library libdbus_testutils_la. Reorder build so that test/ gets built before test/name-test so name-test files can depend on it. * test/name-test/test-shutdown.c: New file, exercises dbus_shutdown () a bit. * test/name-test/run-test.sh Run test-shutdown. * test/test-utils.h: In some cases we already have DBUS_COMPILATION defined, avoid double definition warning.
* Add test library functions for using DBusServerColin Walters2008-05-301-0/+4
| | | | | | * test/test-utils.h, test/test-utils.c: Add functions which hook up a DBusServer to a DBusLoop, useful for test cases.
* 2003-04-07 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-04-071-0/+3
| | | | | | | | | | | | | * doc/dbus-specification.sgml: require that base service names start with ':' and that the base service is created/deleted as first and last things a connection does on the bus * bus/dispatch.c (check_existent_service_activation): lots more work on the activation test; it doesn't fully pass yet... * test/test-service.c (main): fix so we don't memleak the connection to the message bus (filter_func): accept a message asking us to exit
* having a bad cvs add day apparentlyHavoc Pennington2003-04-071-0/+17