diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-01-26 19:02:59 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-02-03 16:18:57 +0000 |
commit | 8b238f3f0dee18395769f9f009e98623cdce951c (patch) | |
tree | f861c1f94242d8c8f9ef81ee8373479f42e7eb50 /test/test-utils.c | |
parent | 6976a7f1997472e06bf83b0a8828f335a1c65c4a (diff) | |
download | dbus-8b238f3f0dee18395769f9f009e98623cdce951c.tar.gz |
Factor out some utility functions from test/dbus-daemon*
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
Diffstat (limited to 'test/test-utils.c')
-rw-r--r-- | test/test-utils.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test-utils.c b/test/test-utils.c index 9a4f3584..9686a9a8 100644 --- a/test/test-utils.c +++ b/test/test-utils.c @@ -7,6 +7,14 @@ #endif #ifdef DBUS_TEST_USE_INTERNAL +# define test_assert(x) _dbus_assert(x) +#elif defined(g_assert_true) +# define test_assert(x) g_assert_true(x) +#else +# define test_assert(x) g_assert(x) +#endif + +#ifdef DBUS_TEST_USE_INTERNAL typedef struct { @@ -390,3 +398,13 @@ void test_main_context_iterate (TestMainContext *ctx, g_main_context_iteration (ctx, may_block); #endif } + +void +test_pending_call_store_reply (DBusPendingCall *pc, + void *data) +{ + DBusMessage **message_p = data; + + *message_p = dbus_pending_call_steal_reply (pc); + test_assert (*message_p != NULL); +} |