summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2021-07-29 06:03:34 +0000
committer Jiakai Zhang <jiakaiz@google.com> 2021-08-09 02:20:09 +0000
commiteefd827ba852de252930d475259a7b2810f016ad (patch)
tree749d058b229f1828b6465bbef5eb19df45b76633
parent7ad87a83da694af0a424ae7d3d49a14515482805 (diff)
Disable JIT in BootImageProfileTest.
When JIT is enabled, it is possible that some methods are inlined and therefore not captured in the profile. Test: atest BootImageProfileTest Bug: 194975422 Change-Id: I6fc99cb596646e365f50cfb8484f792039d8b222
-rw-r--r--tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
index 4ecca2dc4c39..cf5658644a61 100644
--- a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
+++ b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
@@ -31,6 +31,8 @@ public class BootImageProfileTest implements IDeviceTest {
private static final String SYSTEM_SERVER_PROFILE =
"/data/misc/profiles/cur/0/android/primary.prof";
private static final boolean USE_PHENOTYPE = false;
+ private static final String DALVIK_VM_EXTRA_OPTS =
+ "-Xusejit:false -Xint -Xjitsaveprofilinginfo";
@Override
public void setDevice(ITestDevice testDevice) {
@@ -54,10 +56,10 @@ public class BootImageProfileTest implements IDeviceTest {
private String setProperty(String property, String value) throws Exception {
if (USE_PHENOTYPE) {
return mTestDevice.executeShellCommand(
- "device_config put runtime_native_boot " + property + " " + value);
+ String.format("device_config put runtime_native_boot %s '%s'", property, value));
} else {
return mTestDevice.executeShellCommand(
- "setprop dalvik.vm." + property + " " + value);
+ String.format("setprop dalvik.vm.%s '%s'", property, value));
}
}
@@ -69,6 +71,8 @@ public class BootImageProfileTest implements IDeviceTest {
assertTrue("profile boot class path not enabled: " + res, "true".equals(res));
res = getProperty("profilesystemserver");
assertTrue("profile system server not enabled: " + res, "true".equals(res));
+ res = getProperty("extra-opts");
+ assertTrue("extra options not set: " + res, DALVIK_VM_EXTRA_OPTS.equals(res));
}
private boolean forceSaveProfile(String pkg) throws Exception {
@@ -91,16 +95,20 @@ public class BootImageProfileTest implements IDeviceTest {
boolean profileBootClassPath = "true".equals(pbcp);
String pss = getProperty("profilesystemserver");
boolean profileSystemServer = "true".equals(pss);
- if (profileBootClassPath && profileSystemServer) {
+ String extraOpts = getProperty("extra-opts");
+ boolean extraOptsOk = DALVIK_VM_EXTRA_OPTS.equals(extraOpts);
+ if (profileBootClassPath && profileSystemServer && extraOptsOk) {
break;
}
if (i == numIterations) {
assertTrue("profile system server not enabled: " + pss, profileSystemServer);
assertTrue("profile boot class path not enabled: " + pbcp, profileBootClassPath);
+ assertTrue("extra options not set: " + extraOpts, extraOptsOk);
}
setProperty("profilebootclasspath", "true");
setProperty("profilesystemserver", "true");
+ setProperty("extra-opts", DALVIK_VM_EXTRA_OPTS);
Thread.sleep(1000);
}
@@ -114,12 +122,15 @@ public class BootImageProfileTest implements IDeviceTest {
boolean profileBootClassPath = "true".equals(pbcp);
String pss = getProperty("profilesystemserver");
boolean profileSystemServer = "true".equals(pss);
+ String extraOpts = getProperty("extra-opts");
+ boolean extraOptsOk = DALVIK_VM_EXTRA_OPTS.equals(extraOpts);
if (profileBootClassPath && profileSystemServer) {
break;
}
if (i == numIterations) {
assertTrue("profile system server not enabled: " + pss, profileSystemServer);
assertTrue("profile boot class path not enabled: " + pbcp, profileBootClassPath);
+ assertTrue("extra options not set: " + extraOpts, extraOptsOk);
}
Thread.sleep(1000);
}