Modify crash-reporter to collect crash information for unofficial builds. The original code review link is here: http://codereview.chromium.org/6559003/ BUG=chromium-os:12207 TESTS=logging_UserCrash, logging_CrashSender, manual test which involves purposely crashing a test to determine if minidump information is properly collected Change-Id: I20274050cd698434951c65612e246f510c8082cb TEST= Review URL: http://codereview.chromium.org/6615021
diff --git a/crash_collector.cc b/crash_collector.cc index 9600b44..5247d91 100644 --- a/crash_collector.cc +++ b/crash_collector.cc
@@ -24,6 +24,7 @@ static const char kShellPath[] = "/bin/sh"; static const char kSystemCrashPath[] = "/var/spool/crash"; static const char kUserCrashPath[] = "/home/chronos/user/crash"; +static const char kCrashTestInProgressPath[] = "/tmp/crash-test-in-progress"; // Directory mode of the user crash spool directory. static const mode_t kUserCrashPathMode = 0755; @@ -349,3 +350,7 @@ LOG(ERROR) << "Unable to write " << meta_path.value(); } } + +bool CrashCollector::IsCrashTestInProgress() { + return file_util::PathExists(FilePath(kCrashTestInProgressPath)); +}
diff --git a/crash_collector.h b/crash_collector.h index 3c09e2f..28503a1 100644 --- a/crash_collector.h +++ b/crash_collector.h
@@ -131,6 +131,9 @@ const std::string &exec_name, const std::string &payload_path); + // Returns true if the a crash test is currently running. + bool IsCrashTestInProgress(); + CountCrashFunction count_crash_function_; IsFeedbackAllowedFunction is_feedback_allowed_function_; std::string extra_metadata_;
diff --git a/user_collector.cc b/user_collector.cc index bfaaddf..c166e12 100644 --- a/user_collector.cc +++ b/user_collector.cc
@@ -467,6 +467,13 @@ LOG(WARNING) << "Received crash notification for " << exec << "[" << pid << "] sig " << signal << " (" << handling_string << ")"; + // For developer builds, we always want to keep the crash reports unless + // we're testing the crash facilities themselves. + if (file_util::PathExists(FilePath(kLeaveCoreFile)) && + !IsCrashTestInProgress()) { + feedback = true; + } + if (feedback) { count_crash_function_();