summaryrefslogtreecommitdiff
path: root/tests/AppLaunch
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2018-05-25 11:20:01 +0100
committerNicolas Geoffray <ngeoffray@google.com>2018-05-29 10:48:16 +0100
commit1a9156978f74b6169502532e49959e044917c36f (patch)
treefa794e6032b7d7373a21a45766606fb40ec222f4 /tests/AppLaunch
parent5cbad094828b5e563f8960c811f2f2f1f1329e1e (diff)
Escape "$" in script generated when simpleperf_app is true.
bug: 80265465 Test: adb shell "am instrument -e simpleperf_app true -e apps com.google.android.youtube^Youtube -e launch_directory /data/local/tmp -w com.android.tests.applaunch com.android.tests.applaunch/android.test.InstrumentationTestRunner" Change-Id: I6d0113019c019dac856bf613408d278713ca8585
Diffstat (limited to 'tests/AppLaunch')
-rw-r--r--tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
index 6ce66f0f4546..4a6fe49f2676 100644
--- a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
+++ b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
@@ -184,7 +184,8 @@ public class AppLaunch extends InstrumentationTestCase {
if (null != launchDirectory && !launchDirectory.isEmpty()) {
launchRootDir = new File(launchDirectory);
if (!launchRootDir.exists() && !launchRootDir.mkdirs()) {
- throw new IOException("Unable to create the destination directory");
+ throw new IOException("Unable to create the destination directory "
+ + launchRootDir + ". Try disabling selinux.");
}
}
@@ -192,7 +193,8 @@ public class AppLaunch extends InstrumentationTestCase {
File launchSubDir = new File(launchRootDir, LAUNCH_SUB_DIRECTORY);
if (!launchSubDir.exists() && !launchSubDir.mkdirs()) {
- throw new IOException("Unable to create the lauch file sub directory");
+ throw new IOException("Unable to create the lauch file sub directory "
+ + launchSubDir + ". Try disabling selinux.");
}
File file = new File(launchSubDir, LAUNCH_FILE);
FileOutputStream outputStream = new FileOutputStream(file);
@@ -769,6 +771,8 @@ public class AppLaunch extends InstrumentationTestCase {
BufferedWriter writer =
new BufferedWriter(new OutputStreamWriter(stream))) {
String cmd = String.format(SIMPLEPERF_APP_CMD, packageName, launchCmd);
+ // In the file, we need to escape any "$".
+ cmd = cmd.replace("$", "\\$");
writer.write(cmd);
}
launchCmd = launchFile.getAbsolutePath();