summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2020-02-24 23:39:42 -0800
committer Mathieu Chartier <mathieuc@google.com> 2020-03-06 12:21:11 -0800
commita37afa406721c44de4c0ca8c7afcc44d780ae5d4 (patch)
treeb7afbd895f7aa55c9b33fd979463bfb6c6085c1c
parent44e771cf3b83ed2ab1c2993c741c284c7ffbf6bf (diff)
Use shell commands instead of ITestDevice for BootImageProfile test
For some reason, ITestDevice property getting and setting is flaky on GCE. This causes frequent test failures. Test: tested on cuddlefish device Bug: 149802360 (cherry-picked from commit 94d9a21ccb34ab2567ef173e460350220c8ac658) Merged-In: Iba48c173bdea2d55d8f2aa7f0fa382628582fe1c Change-Id: Iba48c173bdea2d55d8f2aa7f0fa382628582fe1c
-rw-r--r--tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java34
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
index ea6b527b5042..34e6a4b42ac8 100644
--- a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
+++ b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
@@ -47,7 +47,7 @@ public class BootImageProfileTest implements IDeviceTest {
return mTestDevice.getProperty("persist.device_config.runtime_native_boot."
+ property);
} else {
- return mTestDevice.getProperty("dalvik.vm." + property);
+ return mTestDevice.executeShellCommand("getprop dalvik.vm." + property).trim();
}
}
@@ -66,9 +66,9 @@ public class BootImageProfileTest implements IDeviceTest {
*/
public void validateProperties() throws Exception {
String res = getProperty("profilebootclasspath");
- assertTrue("profile boot class path not enabled", res != null && res.equals("true"));
+ assertTrue("profile boot class path not enabled: " + res, "true".equals(res));
res = getProperty("profilesystemserver");
- assertTrue("profile system server not enabled", res != null && res.equals("true"));
+ assertTrue("profile system server not enabled: " + res, "true".equals(res));
}
private boolean forceSaveProfile(String pkg) throws Exception {
@@ -88,20 +88,20 @@ public class BootImageProfileTest implements IDeviceTest {
String res;
// Set properties and wait for them to be readable.
for (int i = 1; i <= numIterations; ++i) {
- res = getProperty("profilebootclasspath");
- boolean profileBootClassPath = res != null && res.equals("true");
- res = getProperty("profilesystemserver");
- boolean profileSystemServer = res != null && res.equals("true");
+ String pbcp = getProperty("profilebootclasspath");
+ boolean profileBootClassPath = "true".equals(pbcp);
+ String pss = getProperty("profilesystemserver");
+ boolean profileSystemServer = "true".equals(pss);
if (profileBootClassPath && profileSystemServer) {
break;
}
if (i == numIterations) {
- assertTrue("profile system server not enabled", profileSystemServer);
- assertTrue("profile boot class path not enabled", profileSystemServer);
+ assertTrue("profile system server not enabled: " + pss, profileSystemServer);
+ assertTrue("profile boot class path not enabled: " + pbcp, profileBootClassPath);
}
- res = setProperty("profilebootclasspath", "true");
- res = setProperty("profilesystemserver", "true");
+ setProperty("profilebootclasspath", "true");
+ setProperty("profilesystemserver", "true");
Thread.sleep(1000);
}
@@ -111,16 +111,16 @@ public class BootImageProfileTest implements IDeviceTest {
res = mTestDevice.executeShellCommand("start");
assertTrue("start shell: " + res, res.length() == 0);
for (int i = 1; i <= numIterations; ++i) {
- res = getProperty("profilebootclasspath");
- boolean profileBootClassPath = res != null && res.equals("true");
- res = getProperty("profilesystemserver");
- boolean profileSystemServer = res != null && res.equals("true");
+ String pbcp = getProperty("profilebootclasspath");
+ boolean profileBootClassPath = "true".equals(pbcp);
+ String pss = getProperty("profilesystemserver");
+ boolean profileSystemServer = "true".equals(pss);
if (profileBootClassPath && profileSystemServer) {
break;
}
if (i == numIterations) {
- assertTrue("profile system server not enabled", profileSystemServer);
- assertTrue("profile boot class path not enabled", profileSystemServer);
+ assertTrue("profile system server not enabled: " + pss, profileSystemServer);
+ assertTrue("profile boot class path not enabled: " + pbcp, profileBootClassPath);
}
Thread.sleep(1000);
}