From a7bd49924445d11fe1843db659e61ca6fb2bb5cf Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 23 Feb 2017 13:33:48 +0000 Subject: [PATCH] tests: regressions: Ignore SIGPIPE in test. The test tests/regressions/rhbz914931.c works by causing the daemon to segfault while writing to it. For reasons unknown, when configured --without-libvirt, this causes the test to fail receiving SIGPIPE (exit code 141). We can prevent this by installing a signal handler to ignore SIGPIPE, so the signal is converted to EPIPE which the code handles properly. --- tests/regressions/rhbz914931.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/regressions/rhbz914931.c b/tests/regressions/rhbz914931.c index 93878dbf5..bfc8f83ea 100644 --- a/tests/regressions/rhbz914931.c +++ b/tests/regressions/rhbz914931.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,7 @@ int main (int argc, char *argv[]) { + struct sigaction sa; guestfs_h *g; int r; char *str; @@ -50,6 +52,14 @@ main (int argc, char *argv[]) exit (77); } + /* This test can fail with SIGPIPE (shows up as exit code 141) + * unless we ignore that signal. + */ + memset (&sa, 0, sizeof sa); + sa.sa_handler = SIG_IGN; + sa.sa_flags = SA_RESTART; + sigaction (SIGPIPE, &sa, NULL); + g = guestfs_create (); if (!g) error (EXIT_FAILURE, errno, "guestfs_create");