aboutsummaryrefslogtreecommitdiff
path: root/src/com/android/tradefed/targetprep
diff options
context:
space:
mode:
authorGuang Zhu <guangzhu@google.com>2016-04-14 12:11:17 -0700
committerGuang Zhu <guangzhu@google.com>2016-04-14 18:18:01 -0700
commit501350e10bd9a1757f86891d5c8f73d3c17be9e8 (patch)
treeaf8e65b2cb39fc29310cb3205a9812258662b856 /src/com/android/tradefed/targetprep
parent518bc78bdb392f3a4713712acef64aa11e035978 (diff)
downloadtradefederation-501350e10bd9a1757f86891d5c8f73d3c17be9e8.tar.gz
fix crash collector
* add new param for binary name * properly set permission on binary after push * fix typo in logic Change-Id: I0a24510bd4a43362513cdacd8979deb6f38ebb42
Diffstat (limited to 'src/com/android/tradefed/targetprep')
-rw-r--r--src/com/android/tradefed/targetprep/CrashCollector.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/com/android/tradefed/targetprep/CrashCollector.java b/src/com/android/tradefed/targetprep/CrashCollector.java
index 3c17023e1..297b578a3 100644
--- a/src/com/android/tradefed/targetprep/CrashCollector.java
+++ b/src/com/android/tradefed/targetprep/CrashCollector.java
@@ -49,6 +49,10 @@ public class CrashCollector extends TestFilePushSetup
description = "Path to crashcollector binary in test artifact bundle.")
private String mCrashCollectorPath = "local/tmp/crashcollector";
+ @Option(name = "crash-collector-binary",
+ description = "The name of crashcollector binary in test artifact bundle.")
+ private String mCrashCollectorBinary = "crashcollector";
+
@Option(name = "disable", description = "If this preparer should be disabled.")
private boolean mDisable = false;
@@ -63,10 +67,11 @@ public class CrashCollector extends TestFilePushSetup
// first get pseudo API level to check for platform support
String codeName = device.getProperty("ro.build.version.codename").trim();
int apiLevel = device.getApiLevel();
- if ("!REL".equals(codeName)) {
+ if (!"REL".equals(codeName)) {
apiLevel++;
}
if (apiLevel < 24) {
+ CLog.i("API Level too low: %s.", apiLevel);
return true;
}
if (!(buildInfo instanceof IDeviceBuildInfo)) {
@@ -85,6 +90,7 @@ public class CrashCollector extends TestFilePushSetup
throws TargetSetupError, BuildError, DeviceNotAvailableException {
mDisable = shouldDisable(device, buildInfo);
if (mDisable) {
+ CLog.i("Crash collector disabled.");
return;
}
// clear all existing test file names, since we may receive that from the parameter defined
@@ -93,10 +99,12 @@ public class CrashCollector extends TestFilePushSetup
clearTestFileName();
addTestFileName(mCrashCollectorPath);
super.setUp(device, buildInfo);
+ String crashCollectorPath = String.format("/data/%s/%s",
+ mCrashCollectorPath, mCrashCollectorBinary);
+ device.executeShellCommand("chmod 755 " + crashCollectorPath);
mCrashReceiver = new LargeOutputReceiver("crash-collector",
device.getSerialNumber(), mMaxCrashLogSize);
- mCrashCollector = new BackgroundDeviceAction(
- "/data/local/tmp/crashcollector/crashcollector", "crash-collector",
+ mCrashCollector = new BackgroundDeviceAction(crashCollectorPath, "crash-collector",
device, mCrashReceiver, 0);
mCrashCollector.start();
}