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

Unified Diff: user_collector.cc

Issue 4190014: crash-reporter: add filtering to make crash tests resilient to crashy builds (Closed) Base URL: http://git.chromium.org/git/crash-reporter.git
Patch Set: Created 10 years, 2 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: user_collector.cc
diff --git a/user_collector.cc b/user_collector.cc
index f9cb494009376efceda68b39f70c2996836ba704..02025c20d9db86a53b3193e4c5474721a42cd1e1 100644
--- a/user_collector.cc
+++ b/user_collector.cc
@@ -21,8 +21,12 @@
#include "crash-reporter/system_logging.h"
#include "gflags/gflags.h"
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
DEFINE_bool(core2md_failure_test, false, "Core2md failure test");
DEFINE_bool(directory_failure_test, false, "Spool directory failure test");
+DEFINE_string(filter_in, "",
+ "Ignore all crashes but this for testing");
+#pragma GCC diagnostic error "-Wstrict-aliasing"
static const char kCollectionErrorSignature[] =
"crash_reporter-user-collection";
@@ -423,6 +427,19 @@ bool UserCollector::HandleCrash(int signal, int pid, const char *force_exec) {
// failing by indicating an unknown name.
exec = "unknown";
}
+
+ // Allow us to test the crash reporting mechanism successfully even if
+ // other parts of the system crash.
+ if (!FLAGS_filter_in.empty() &&
+ (FLAGS_filter_in == "none" ||
+ FLAGS_filter_in != exec)) {
+ // We use a different format message to make it more obvious in tests
+ // which crashes are test generated and which are real.
+ logger_->LogWarning("Ignoring crash from %s[%d] while filter_in=%s",
+ exec.c_str(), pid, FLAGS_filter_in.c_str());
+ return true;
+ }
+
bool feedback = is_feedback_allowed_function_();
logger_->LogWarning("Received crash notification for %s[%d] sig %d (%s)",
exec.c_str(), pid, signal,
« 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