Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eefd827b authored by Jiakai Zhang's avatar Jiakai Zhang
Browse files

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
parent 7ad87a83
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -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);
        }