summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* test: Explicitly enable assertion macrosSimon McVittie2021-03-2625-0/+27
| | | | | | | | | | | | | | | | | To allow dbus-glib to be built with G_DISABLE_ASSERT defined but tests enabled (--disable-asserts --enable-tests), we need to explicitly undefine it when building the tests, otherwise g_test_init() turns into an abort since GLib 2.58. We no longer actually use g_assert() for test-only code, so we can remove the warning about tests' failing results not being reported. test-profile.c still leaves assertions disabled: it does not use g_test_init(), and it is intended to be used for profiling, where the overhead of assertions is potentially significant. Resolves: #16 Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Replace remaining assertions with g_assert_true()Simon McVittie2021-03-269-66/+66
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Replace remaining g_assert (!x) with g_assert_false (x)Simon McVittie2021-03-263-6/+6
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Use g_assert_true, g_assert_false for comparisons with TRUE, FALSESimon McVittie2021-03-261-2/+2
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Compare integers using g_assert_cmpint(), g_assert_cmpuint()Simon McVittie2021-03-263-23/+23
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Compare strings with g_assert_cmpstr()Simon McVittie2021-03-262-21/+21
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Replace g_assert (x == NULL) with g_assert_null (x)Simon McVittie2021-03-263-16/+16
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Replace all g_assert (x != NULL) with g_assert_nonnull (x)Simon McVittie2021-03-2614-58/+58
| | | | | | | This avoids the assertions being removed by G_DISABLE_ASSERT, and gives somewhat better diagnostic messages if the assertion fails. Signed-off-by: Simon McVittie <smcv@collabora.com>
* test-service: Don't close a shared connectionSimon McVittie2019-07-231-13/+2
| | | | | | This is considered incorrect and causes a libdbus check failure. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Add clearer licensing information using SPDX-License-IdentifierSimon McVittie2019-07-1532-0/+64
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* invoke_object_method: when demarshalling fails, use the right errorSimon McVittie2018-12-032-8/+1
| | | | | | | | This replaces the inappropriate org.freedesktop.DBus.GLib.ErrorError with the intended error codes, affecting two tests. Signed-off-by: Simon McVittie <smcv@collabora.com> Resolves: https://gitlab.freedesktop.org/dbus/dbus-glib/issues/1
* Add a regression test for fd.o#80557Simon McVittie2018-12-035-0/+346
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* Check for GLib under the name GLIB, not DBUS_GLIBSimon McVittie2018-01-293-7/+7
| | | | Signed-off-by: Simon McVittie <smcv@debian.org>
* Move tests for dbus-gmain to dbus-gmain/tests/Simon McVittie2018-01-2216-561/+10
| | | | | | | Use dbus-run-session to run the only one that can be used as an automated test right now. Signed-off-by: Simon McVittie <smcv@debian.org>
* dbus-gmain: Move to its own directorySimon McVittie2018-01-224-6/+6
| | | | Signed-off-by: Simon McVittie <smcv@debian.org>
* Build libdbus-gmain into a separate convenience librarySimon McVittie2018-01-221-0/+20
| | | | Signed-off-by: Simon McVittie <smcv@debian.org>
* Make dbus-gmain.h internal, and rename its symbolsSimon McVittie2018-01-223-8/+8
| | | | | | | | If we embed dbus-gmain in dbus-glib, dbus-python, at-spi2-core and others as a submodule or subtree, we won't want it to export the same ABI in all of them. Signed-off-by: Simon McVittie <smcv@debian.org>
* Convert a few tests to only use dbus-gmainSimon McVittie2017-11-013-7/+3
| | | | Signed-off-by: Simon McVittie <smcv@debian.org>
* test_run_until_disconnected: Convert to pure libdbusSimon McVittie2017-11-018-43/+19
| | | | | | This will let us do a few tests with just dbus-gmain. Signed-off-by: Simon McVittie <smcv@debian.org>
* manual test: move to test/coreSimon McVittie2016-01-144-32/+11
| | | | | | | | | | The strange use of source from a sibling directory seems to be breaking distcheck: Making distclean in manual make[3]: Entering directory '/.../dbus-glib-0.105/_build/sub/test/manual' Makefile:409: ../core/.deps/my-object.Po: No such file or directory make[3]: *** No rule to make target '../core/.deps/my-object.Po'. Stop.
* test: stop generating marshallersSimon McVittie2016-01-145-40/+13
| | | | | They haven't been needed since GLib 2.30. Until now, we were also incorrectly distributing the generated marshallers in tarball releases.
* test: stop calling g_mem_profile(), no longer supportedSimon McVittie2016-01-141-6/+0
| | | | This now raises a g_warning() which makes the test fail.
* Replace deprecated INCLUDES with AM_CPPFLAGSSimon McVittie2016-01-143-3/+3
|
* 30574 test: squash some compiler warningsSimon McVittie2015-02-091-2/+1
|
* Stop calling g_thread_init or linking libgthread-2.0Simon McVittie2015-02-096-6/+3
| | | | Since GLib 2.32, which we now depend on, this is unnecessary.
* Require a modern libdbus and a modern GLibSimon McVittie2015-02-091-6/+0
| | | | | | | | | | | | This means we can assume that GLib and libdbus are thread-safe by default. Also explicitly document that the object-mapping layer of dbus-glib is not thread-safe. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=64214 Reviewed-by: Colin Walters <walters@verbum.org> [with review comments to be fixed in subsequent commit -smcv]
* Remove erroneous assert from connection_setup_add_timeoutMike Gorse2015-02-091-29/+36
| | | | | | | | | | | | | | | | | When switching a connection from one main loop to another, timeouts are moved to the new connection, so connection_setup_add_timeout gets called on the new connection for all timeouts that were set on the old connection. This means that the timeout's data can, in fact, be non-NULL, and it will be freed / removed from the old connection as a side-effect of adding it to the new connection. A similar assert was removed from dbus_connection_add_watch a while ago as part of the original patch for this bug. Also, clean up the regression test a bit, and test that a DBusConnection can be migrated when a pending call is present. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=30574 [resolve conflicts -smcv] Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* tests: only remove sources that have not already been removedSimon McVittie2014-09-051-13/+41
| | | | | | | | | | | | | With modern GLib, misusing GSource provokes a critical warning, which is made fatal by our test framework. It is possible (indeed likely) that some or all of the cancel_exit_timeout() calls just before re-adding the timeout are redundant, but I didn't want to waste time on assessing that - easier to just do it every time. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83530 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Fix yet another leak, this one caused by poor documentation (#29195)Simon McVittie2013-10-211-0/+7
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Add infrastructure for running tests under valgrindSimon McVittie2013-10-213-0/+36
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* test-dbus-glib: free numerous leaked objects, and clean up more thoroughlySimon McVittie2013-10-211-4/+26
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Separate the test for shared-bus equivalence into its own binarySimon McVittie2013-10-214-6/+141
| | | | | | | | | When valgrinding tests it's useful to avoid using the shared bus, which cannot be closed. Move all the essential shared-bus use into a test which can be treated specially. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* test-types: use a private bus, and close it afterwardsSimon McVittie2013-10-211-3/+5
| | | | | | | This frees more of the memory. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* registrations test: run the connections to completion and call dbus_shutdownSimon McVittie2013-10-211-2/+6
| | | | | | | This frees more of the memory. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* 30574 test: use a private bus so we can free it more thoroughlySimon McVittie2013-10-211-1/+9
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* test-variant-recursion: use a private bus so we can free it more thoroughlySimon McVittie2013-10-211-2/+10
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* test-variant-recursion: free our GValues and the output string correctlySimon McVittie2013-10-211-19/+26
| | | | | | | | | | | | Previously, if we'd freed the GValues, it would have crashed, because g_value_take_boxed on a value of type G_TYPE_VALUE requires that the inner GValue was g_malloc'd individually, but we were allocating them as a block. This only "worked" because *none* of them were freed... The returned string was also leaked; free it too, but only on success. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* registrations test: bin some unused variablesSimon McVittie2013-10-211-3/+0
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* interfaces test: don't call an undefined function on failure, just use set -eSimon McVittie2013-10-211-1/+3
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* test-client: wait for disconnection, to get more state freedSimon McVittie2013-10-211-1/+14
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* test-client: don't leak NodeInfo and one proxySimon McVittie2013-10-211-0/+4
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* 30574 test: don't leak two messages and a pending call per runSimon McVittie2013-10-211-0/+3
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Add a regression test for CVE-2013-0292Simon McVittie2013-10-212-0/+268
| | | | | | | | Inspired by Sebastian Krahmer's 'darklena.c', which used this bug to exploit pam_fprintd. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68603 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* tests: fix under-linkingSimon McVittie2013-10-211-0/+1
| | | | | | | The test for errors uses dbus_set_error() so it should link -ldbus-1. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68601 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Add a feature test for fd.o #23633, non-default main contextbaserock/morphSimon McVittie2012-12-043-0/+276
| | | | | [rebased and added to run-test.sh -dbcw] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=23633
* test-profile: exit a bit more gracefullySimon McVittie2012-12-041-0/+6
| | | | | | | | | | | | | | | | We close the connection to ourselves, resulting in libdbus shooting us in the head unless we ask it not to. Nice to see how thoroughly this code has been tested... For future reference, it can be tested like this: DBUS_TOP_BUILDDIR=$(pwd) ./test/core/run-test.sh profile (or substitute the real absolute top build directory, if out-of-tree). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40711 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Dan Williams <dcbw@redhat.com>
* test-profile: actually initialize GLib, if requiredSimon McVittie2012-12-041-0/+4
| | | | | | | | | It's alarming how often the phrase "I'm amazed this ever worked" comes up while maintaining dbus-glib. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40711 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Dan Williams <dcbw@redhat.com>
* Remove check for abstract sockets, not relevant to dbus-glibSimon McVittie2012-12-041-19/+1
| | | | | | | | | | | | | | | | | test-profile.c was its only use, and all it was used for was to listen on an abstract or path-based socket, matching what D-Bus would do, when obtaining comparative performance figures for D-Bus vs. plain Unix sockets. test-profile.c isn't normally run, only works on Unix, and the check for abstract sockets was broken on current glibc (fd.o #29895), leading to us using the non-abstract code path anyway, so this clearly wasn't very important. I'm tempted to delete test-profile.c entirely, but until then, let's just make it use path-based sockets. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40711 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Dan Williams <dcbw@redhat.com>
* Move _dbus_gvalue_utils_test into a separate binary, it only uses public APISimon McVittie2012-11-192-0/+491
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40711 Reviewed-by: Dan Williams <dcbw@redhat.com>
* Use more modern assertions in errors testSimon McVittie2012-11-191-3/+2
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40711 Reviewed-by: Dan Williams <dcbw@redhat.com>