diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2017-02-14 19:40:28 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2017-02-21 11:57:15 +0000 |
commit | ec9d39b95c2ff335992ff71e05b1fa6dbfec1342 (patch) | |
tree | cf0a5bae96afe7848c34fc24ccb805938f14e507 /test/test-utils-glib.c | |
parent | 06904a8d96c8ddc9fe22d0b3e36dd5ecc0c245a7 (diff) | |
download | dbus-ec9d39b95c2ff335992ff71e05b1fa6dbfec1342.tar.gz |
test-utils-glib: Wait for the killed process to exit
Otherwise, removing transient service directories that are being
watched by the dbus-daemon can fail with EAGAIN.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99825
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'test/test-utils-glib.c')
-rw-r--r-- | test/test-utils-glib.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test-utils-glib.c b/test/test-utils-glib.c index c5059edb..fac5ddaf 100644 --- a/test/test-utils-glib.c +++ b/test/test-utils-glib.c @@ -418,9 +418,25 @@ test_connect_to_bus_as_user (TestMainContext *ctx, #endif } +static void +pid_died (GPid pid, + gint status, + gpointer user_data) +{ + gboolean *result = user_data; + + g_assert (result != NULL); + g_assert (!*result); + *result = TRUE; +} + void test_kill_pid (GPid pid) { + gint died = FALSE; + + g_child_watch_add (pid, pid_died, &died); + #ifdef DBUS_WIN if (pid != NULL) TerminateProcess (pid, 1); @@ -428,6 +444,9 @@ test_kill_pid (GPid pid) if (pid > 0) kill (pid, SIGTERM); #endif + + while (!died) + g_main_context_iteration (NULL, TRUE); } static gboolean |