crash_reporter: Remove udev collector from Android build

Currently one of the udev collector tests is failing due to the lack
of gzip on the device.  Since we don't have gzip nor udev in Android builds,
remove the udev collector (and tests) from Android builds.

See http://r.android.com/184708 for discussion on removing the udev
collector completely from the source.

Bug: 25779348
Test: `/data/nativetest/crash_reporter_tests/crash_reporter_tests` passes

Change-Id: I883359ac8219f2e1fa6a78927433dbc0be295fe7
This commit is contained in:
Steve Fung 2016-01-04 14:26:15 -08:00
parent 946d8152b2
commit c490e0fe98
2 changed files with 15 additions and 3 deletions

View file

@ -19,7 +19,6 @@ crash_reporter_cpp_extension := .cc
crash_reporter_src := crash_collector.cc \
kernel_collector.cc \
kernel_warning_collector.cc \
udev_collector.cc \
unclean_shutdown_collector.cc \
user_collector.cc
@ -29,7 +28,6 @@ crash_reporter_test_src := crash_collector_test.cc \
crash_reporter_logs_test.cc \
kernel_collector_test.cc \
testrunner.cc \
udev_collector_test.cc \
unclean_shutdown_collector_test.cc \
user_collector_test.cc

View file

@ -35,10 +35,13 @@
#include "kernel_collector.h"
#include "kernel_warning_collector.h"
#include "udev_collector.h"
#include "unclean_shutdown_collector.h"
#include "user_collector.h"
#if !defined(__ANDROID__)
#include "udev_collector.h"
#endif
static const char kCrashCounterHistogram[] = "Logging.CrashCounter";
static const char kKernelCrashDetected[] = "/var/run/kernel-crash-detected";
static const char kUncleanShutdownDetected[] =
@ -176,6 +179,7 @@ static int HandleUserCrash(UserCollector *user_collector,
return 0;
}
#if !defined(__ANDROID__)
static int HandleUdevCrash(UdevCollector *udev_collector,
const std::string& udev_event) {
// Handle a crash indicated by a udev event.
@ -189,6 +193,7 @@ static int HandleUdevCrash(UdevCollector *udev_collector,
return 1;
return 0;
}
#endif
static int HandleKernelWarning(KernelWarningCollector
*kernel_warning_collector) {
@ -249,7 +254,11 @@ int main(int argc, char *argv[]) {
DEFINE_bool(crash_test, false, "Crash test");
DEFINE_string(user, "", "User crash info (pid:signal:exec_name)");
DEFINE_bool(unclean_check, true, "Check for unclean shutdown");
#if !defined(__ANDROID__)
DEFINE_string(udev, "", "Udev event description (type:device:subsystem)");
#endif
DEFINE_bool(kernel_warning, false, "Report collected kernel warning");
DEFINE_string(pid, "", "PID of crashing process");
DEFINE_string(uid, "", "UID of crashing process");
@ -279,8 +288,11 @@ int main(int argc, char *argv[]) {
UncleanShutdownCollector unclean_shutdown_collector;
unclean_shutdown_collector.Initialize(CountUncleanShutdown,
IsFeedbackAllowed);
#if !defined(__ANDROID__)
UdevCollector udev_collector;
udev_collector.Initialize(CountUdevCrash, IsFeedbackAllowed);
#endif
KernelWarningCollector kernel_warning_collector;
kernel_warning_collector.Initialize(CountUdevCrash, IsFeedbackAllowed);
@ -304,9 +316,11 @@ int main(int argc, char *argv[]) {
FLAGS_generate_kernel_signature);
}
#if !defined(__ANDROID__)
if (!FLAGS_udev.empty()) {
return HandleUdevCrash(&udev_collector, FLAGS_udev);
}
#endif
if (FLAGS_kernel_warning) {
return HandleKernelWarning(&kernel_warning_collector);