summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-23 19:44:36 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-23 19:44:36 +0000
commit34dda85b1b2fbccea5ea875e631df2616eb7a99c (patch)
treea55128754f73bb706de4ef5a15d81a18549429c9 /base
parentd2cf63114443ab592bee4acaa04a431356a23cd8 (diff)
downloadchromium_src-34dda85b1b2fbccea5ea875e631df2616eb7a99c.zip
chromium_src-34dda85b1b2fbccea5ea875e631df2616eb7a99c.tar.gz
chromium_src-34dda85b1b2fbccea5ea875e631df2616eb7a99c.tar.bz2
Ignore SIGPIPE when running tests.
BUG=15046 TEST=unit_tests --gtest_filter=IPCSyncChannelTest.NoHang should complete and not be taken down by SIGPIPE; when EPIPE occurs, a harmless "broken pipe" message should be logged. Review URL: http://codereview.chromium.org/147019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19045 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/test_suite.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/base/test_suite.h b/base/test_suite.h
index 584b945..352c0b8 100644
--- a/base/test_suite.h
+++ b/base/test_suite.h
@@ -24,7 +24,13 @@
#if defined(OS_WIN)
#include <windows.h>
-#elif defined(OS_LINUX)
+#endif
+
+#if defined(OS_POSIX)
+#include <signal.h>
+#endif
+
+#if defined(OS_LINUX)
#include <gtk/gtk.h>
#endif
@@ -108,6 +114,17 @@ class TestSuite {
// Note: temporarily enabled timestamps in an effort to catch bug 6361.
logging::SetLogItems(true, true, true, true);
+#if defined(OS_POSIX)
+ // When running in an application, our code typically expects SIGPIPE
+ // to be ignored. Therefore, when testing that same code, it should run
+ // with SIGPIPE ignored as well.
+ struct sigaction action;
+ action.sa_handler = SIG_IGN;
+ action.sa_flags = 0;
+ sigemptyset(&action.sa_mask);
+ CHECK(sigaction(SIGPIPE, &action, NULL) == 0);
+#endif // OS_POSIX
+
#if defined(OS_WIN)
// For unit tests we turn on the high resolution timer and disable
// base::Time's use of SystemMonitor. Tests create and destroy the message