[gnome-logs/wip/test: 24/33] Close gnome-logs-test UI after test



commit e8a24cbb290ecf23b769e0163e5fc198f5e25884
Author: Rashi Aswani <aswanirashi19 gmail com>
Date:   Mon Jul 27 00:11:02 2015 +0530

    Close gnome-logs-test UI after test

 tests/gnome-logs-test.c |   35 +++++++++++++++++++++--------------
 1 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/tests/gnome-logs-test.c b/tests/gnome-logs-test.c
index 260277a..dffc06b 100644
--- a/tests/gnome-logs-test.c
+++ b/tests/gnome-logs-test.c
@@ -33,8 +33,9 @@
 #include "../src/gl-eventviewrow.h"
 #include "../src/gl-util.h"
 #include "../src/gl-window.h"
+#include <unistd.h>
 
-
+void *myThreadFun(void *);
 static void
 check_log_message (void)
 {  
@@ -48,19 +49,25 @@ int
 main (int argc, char** argv)
 {
     GtkApplication *application;
-    int status;
-
-    bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-    bind_textdomain_codeset (PACKAGE_TARNAME, "UTF-8");
-    textdomain (GETTEXT_PACKAGE);
-
-    g_set_prgname (PACKAGE_TARNAME);
-    application = gl_application_new ();
-    status = g_application_run (G_APPLICATION (application), argc, argv);
     g_test_init (&argc, &argv, NULL);
     g_test_add_func ("/util/check_log_message", check_log_message);
-    g_object_unref (application);
-    //g_application_quit (G_APPLICATION (application));
-     
-    return g_test_run ();
+    
+    int status;
+    pid_t pid = fork();
+    if(pid==0)
+    {
+       bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+       bind_textdomain_codeset (PACKAGE_TARNAME, "UTF-8");
+       textdomain (GETTEXT_PACKAGE);
+       g_set_prgname (PACKAGE_TARNAME);
+       application = gl_application_new ();
+       status = g_application_run (G_APPLICATION (application), argc, argv);
+       g_object_unref (application);
+    }
+    else if(pid > 0)
+    {
+       sleep (1);
+       kill(pid, SIGKILL);
+    }
+    return g_test_run();
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]