activation test: don't crash if AppArmor is built but unavailable

Also don't try to clean up a process we didn't start.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98666
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
This commit is contained in:
Simon McVittie 2016-11-29 00:48:14 +00:00 committed by Simon McVittie
parent 6dd92fd825
commit ca2cdab866

View file

@ -801,9 +801,15 @@ teardown (Fixture *f,
f->activated = NULL;
}
test_kill_pid (f->daemon_pid);
g_spawn_close_pid (f->daemon_pid);
test_main_context_unref (f->ctx);
if (f->daemon_pid != 0)
{
test_kill_pid (f->daemon_pid);
g_spawn_close_pid (f->daemon_pid);
}
if (f->ctx != NULL)
test_main_context_unref (f->ctx);
g_free (f->address);
}