Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Unified Diff: base/test_suite.h

Issue 147019: Ignore SIGPIPE when running tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test_suite.h
===================================================================
--- base/test_suite.h (revision 19025)
+++ base/test_suite.h (working copy)
@@ -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 @@
// 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698