summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2021-03-26test: Explicitly enable assertion macrosSimon McVittie25-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>
2021-03-26test: Replace remaining assertions with g_assert_true()Simon McVittie9-66/+66
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-26test: Replace remaining g_assert (!x) with g_assert_false (x)Simon McVittie3-6/+6
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-26test: Use g_assert_true, g_assert_false for comparisons with TRUE, FALSESimon McVittie1-2/+2
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-26test: Compare integers using g_assert_cmpint(), g_assert_cmpuint()Simon McVittie3-23/+23
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-26test: Compare strings with g_assert_cmpstr()Simon McVittie2-21/+21
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-26test: Replace g_assert (x == NULL) with g_assert_null (x)Simon McVittie3-16/+16
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-26test: Replace all g_assert (x != NULL) with g_assert_nonnull (x)Simon McVittie14-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>
2019-07-23test-service: Don't close a shared connectionSimon McVittie1-13/+2
This is considered incorrect and causes a libdbus check failure. Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-15Add clearer licensing information using SPDX-License-IdentifierSimon McVittie32-0/+64
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-03invoke_object_method: when demarshalling fails, use the right errorSimon McVittie2-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
2018-12-03Add a regression test for fd.o#80557Simon McVittie5-0/+346
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-01-29Check for GLib under the name GLIB, not DBUS_GLIBSimon McVittie3-7/+7
Signed-off-by: Simon McVittie <smcv@debian.org>
2018-01-22Move tests for dbus-gmain to dbus-gmain/tests/Simon McVittie16-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>
2018-01-22dbus-gmain: Move to its own directorySimon McVittie4-6/+6
Signed-off-by: Simon McVittie <smcv@debian.org>
2018-01-22Build libdbus-gmain into a separate convenience librarySimon McVittie1-0/+20
Signed-off-by: Simon McVittie <smcv@debian.org>
2018-01-22Make dbus-gmain.h internal, and rename its symbolsSimon McVittie3-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>
2017-11-01Convert a few tests to only use dbus-gmainSimon McVittie3-7/+3
Signed-off-by: Simon McVittie <smcv@debian.org>
2017-11-01test_run_until_disconnected: Convert to pure libdbusSimon McVittie8-43/+19
This will let us do a few tests with just dbus-gmain. Signed-off-by: Simon McVittie <smcv@debian.org>
2016-01-14manual test: move to test/coreSimon McVittie4-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.
2016-01-14test: stop generating marshallersSimon McVittie5-40/+13
They haven't been needed since GLib 2.30. Until now, we were also incorrectly distributing the generated marshallers in tarball releases.
2016-01-14test: stop calling g_mem_profile(), no longer supportedSimon McVittie1-6/+0
This now raises a g_warning() which makes the test fail.
2016-01-14Replace deprecated INCLUDES with AM_CPPFLAGSSimon McVittie3-3/+3
2015-02-0930574 test: squash some compiler warningsSimon McVittie1-2/+1
2015-02-09Stop calling g_thread_init or linking libgthread-2.0Simon McVittie6-6/+3
Since GLib 2.32, which we now depend on, this is unnecessary.
2015-02-09Require a modern libdbus and a modern GLibSimon McVittie1-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]
2015-02-09Remove erroneous assert from connection_setup_add_timeoutMike Gorse1-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>
2014-09-05tests: only remove sources that have not already been removedSimon McVittie1-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>
2013-10-21Fix yet another leak, this one caused by poor documentation (#29195)Simon McVittie1-0/+7
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-21Add infrastructure for running tests under valgrindSimon McVittie3-0/+36
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-21test-dbus-glib: free numerous leaked objects, and clean up more thoroughlySimon McVittie1-4/+26
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-21Separate the test for shared-bus equivalence into its own binarySimon McVittie4-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>
2013-10-21test-types: use a private bus, and close it afterwardsSimon McVittie1-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>
2013-10-21registrations test: run the connections to completion and call dbus_shutdownSimon McVittie1-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>
2013-10-2130574 test: use a private bus so we can free it more thoroughlySimon McVittie1-1/+9
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-21test-variant-recursion: use a private bus so we can free it more thoroughlySimon McVittie1-2/+10
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-21test-variant-recursion: free our GValues and the output string correctlySimon McVittie1-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>
2013-10-21registrations test: bin some unused variablesSimon McVittie1-3/+0
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-21interfaces test: don't call an undefined function on failure, just use set -eSimon McVittie1-1/+3
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-21test-client: wait for disconnection, to get more state freedSimon McVittie1-1/+14
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-21test-client: don't leak NodeInfo and one proxySimon McVittie1-0/+4
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-2130574 test: don't leak two messages and a pending call per runSimon McVittie1-0/+3
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41129 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-21Add a regression test for CVE-2013-0292Simon McVittie2-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>
2013-10-21tests: fix under-linkingSimon McVittie1-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>
2012-12-04Add a feature test for fd.o #23633, non-default main contextSimon McVittie3-0/+276
[rebased and added to run-test.sh -dbcw] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=23633
2012-12-04test-profile: exit a bit more gracefullySimon McVittie1-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>
2012-12-04test-profile: actually initialize GLib, if requiredSimon McVittie1-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>
2012-12-04Remove check for abstract sockets, not relevant to dbus-glibSimon McVittie1-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>
2012-11-19Move _dbus_gvalue_utils_test into a separate binary, it only uses public APISimon McVittie2-0/+491
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40711 Reviewed-by: Dan Williams <dcbw@redhat.com>
2012-11-19Use more modern assertions in errors testSimon McVittie1-3/+2
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40711 Reviewed-by: Dan Williams <dcbw@redhat.com>