Commit 0994cc31 authored by Marco Trevisan's avatar Marco Trevisan
Browse files

main: Ensure that a gcov flush happens on SIGTERM

When coverage is enabled fprintd test won't generate any .gcda file and so
apparently no data, this happens because gcov doesn't handle properly the
process termination when SIGTERM is used, and so when in we
terminate the process no coverage data is reported.

To avoid this, quit the main loop cleanly on SIGTERM, so that we will exit
from the main function cleanly, making libc to perform a gcov flush when we
exit the program.
parent 09b1f1f1
......@@ -27,6 +27,7 @@
#include <glib/gi18n.h>
#include <fprint.h>
#include <glib-object.h>
#include <glib-unix.h>
#include <gmodule.h>
#include "fprintd.h"
......@@ -129,6 +130,14 @@ static const GOptionEntry entries[] = {
{ NULL }
static gboolean sigterm_callback(gpointer data)
GMainLoop *loop = data;
g_main_loop_quit (loop);
return FALSE;
int main(int argc, char **argv)
GOptionContext *context;
......@@ -178,6 +187,7 @@ int main(int argc, char **argv)
store.init ();
loop = g_main_loop_new(NULL, FALSE);
g_unix_signal_add (SIGTERM, sigterm_callback, loop);
g_debug("Launching FprintObject");
......@@ -233,7 +233,7 @@ class FPrintdTest(dbusmock.DBusTestCase):
except OSError:
self.daemon = None
self.client = None
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment