[jsonrpc-glib] tests: ignore SIGPIPE



commit 02acd6cc1729021e8aad87d84c8d4007753aba52
Author: Christian Hergert <chergert redhat com>
Date:   Fri Aug 10 15:54:49 2018 -0700

    tests: ignore SIGPIPE
    
    Just to make sure none of our pipe[2] usage causes SIGPIPE from close().

 tests/test-gauntlet.c | 3 +++
 tests/test-server.c   | 3 +++
 tests/test-stress.c   | 3 +++
 3 files changed, 9 insertions(+)
---
diff --git a/tests/test-gauntlet.c b/tests/test-gauntlet.c
index e7d2a63..4080edf 100644
--- a/tests/test-gauntlet.c
+++ b/tests/test-gauntlet.c
@@ -20,6 +20,7 @@
 #include <gio/gunixoutputstream.h>
 #include <glib-unix.h>
 #include <jsonrpc-glib.h>
+#include <signal.h>
 
 static GMainLoop *main_loop;
 
@@ -83,6 +84,8 @@ test_gauntlet (void)
   gint pair_a[2];
   gint pair_b[2];
 
+  signal (SIGPIPE, SIG_IGN);
+
   main_loop = g_main_loop_new (NULL, FALSE);
 
   r = g_unix_open_pipe (pair_a, FD_CLOEXEC, &error);
diff --git a/tests/test-server.c b/tests/test-server.c
index 765253c..a0d5f48 100644
--- a/tests/test-server.c
+++ b/tests/test-server.c
@@ -26,6 +26,7 @@
 #include <gio/gunixinputstream.h>
 #include <glib-unix.h>
 #include <jsonrpc-glib.h>
+#include <signal.h>
 #include <unistd.h>
 
 static void
@@ -127,6 +128,8 @@ test_basic (gboolean use_gvariant)
   gint count = 0;
   gint r;
 
+  signal (SIGPIPE, SIG_IGN);
+
   r = g_unix_open_pipe (pair_a, FD_CLOEXEC, &error);
   g_assert_no_error (error);
   g_assert_cmpint (r, ==, TRUE);
diff --git a/tests/test-stress.c b/tests/test-stress.c
index 28e3f6e..432504e 100644
--- a/tests/test-stress.c
+++ b/tests/test-stress.c
@@ -20,6 +20,7 @@
 #include <gio/gunixinputstream.h>
 #include <gio/gunixoutputstream.h>
 #include <jsonrpc-glib.h>
+#include <signal.h>
 
 static GMainLoop *main_loop;
 static gint n_ops;
@@ -189,6 +190,8 @@ main (gint   argc,
   gint pair1[2];
   gint pair2[2];
 
+  signal (SIGPIPE, SIG_IGN);
+
   main_loop = g_main_loop_new (NULL, FALSE);
 
   n_ops = 1000;


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