tests: Consistently don't try to kill pid 0
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 20 Feb 2017 17:44:09 +0000 (17:44 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 21 Feb 2017 11:56:56 +0000 (11:56 +0000)
daemon_pid will still be 0 if any tests were skipped. In particular
this happens during `make installcheck`.

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>
test/dbus-daemon-eavesdrop.c
test/monitor.c

index be51f6a..d2c0872 100644 (file)
@@ -407,8 +407,12 @@ teardown (Fixture *f,
       f->eavesdropper = NULL;
     }
 
-  test_kill_pid (f->daemon_pid);
-  g_spawn_close_pid (f->daemon_pid);
+  if (f->daemon_pid != 0)
+    {
+      test_kill_pid (f->daemon_pid);
+      g_spawn_close_pid (f->daemon_pid);
+      f->daemon_pid = 0;
+    }
 
   test_main_context_unref (f->ctx);
 }
index 9446294..0402d4a 100644 (file)
@@ -1769,8 +1769,12 @@ teardown (Fixture *f,
       f->activated = NULL;
     }
 
-  test_kill_pid (f->daemon_pid);
-  g_spawn_close_pid (f->daemon_pid);
+  if (f->daemon_pid != 0)
+    {
+      test_kill_pid (f->daemon_pid);
+      g_spawn_close_pid (f->daemon_pid);
+      f->daemon_pid = 0;
+    }
 
   test_main_context_unref (f->ctx);