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

Commit 89320ec0 authored by Jiakai Zhang's avatar Jiakai Zhang Committed by Gerrit Code Review
Browse files

Merge "Disable JIT in BootImageProfileTest."

parents 7ad87a83 eefd827b
Loading
Loading
Loading
Loading
+14 −3
Original line number Original line Diff line number Diff line
@@ -31,6 +31,8 @@ public class BootImageProfileTest implements IDeviceTest {
    private static final String SYSTEM_SERVER_PROFILE =
    private static final String SYSTEM_SERVER_PROFILE =
            "/data/misc/profiles/cur/0/android/primary.prof";
            "/data/misc/profiles/cur/0/android/primary.prof";
    private static final boolean USE_PHENOTYPE = false;
    private static final boolean USE_PHENOTYPE = false;
    private static final String DALVIK_VM_EXTRA_OPTS =
            "-Xusejit:false -Xint -Xjitsaveprofilinginfo";


    @Override
    @Override
    public void setDevice(ITestDevice testDevice) {
    public void setDevice(ITestDevice testDevice) {
@@ -54,10 +56,10 @@ public class BootImageProfileTest implements IDeviceTest {
    private String setProperty(String property, String value) throws Exception {
    private String setProperty(String property, String value) throws Exception {
        if (USE_PHENOTYPE) {
        if (USE_PHENOTYPE) {
            return mTestDevice.executeShellCommand(
            return mTestDevice.executeShellCommand(
                "device_config put runtime_native_boot " + property + " " + value);
                String.format("device_config put runtime_native_boot %s '%s'", property, value));
        } else {
        } else {
            return mTestDevice.executeShellCommand(
            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));
        assertTrue("profile boot class path not enabled: " + res, "true".equals(res));
        res = getProperty("profilesystemserver");
        res = getProperty("profilesystemserver");
        assertTrue("profile system server not enabled: " + res, "true".equals(res));
        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 {
    private boolean forceSaveProfile(String pkg) throws Exception {
@@ -91,16 +95,20 @@ public class BootImageProfileTest implements IDeviceTest {
            boolean profileBootClassPath = "true".equals(pbcp);
            boolean profileBootClassPath = "true".equals(pbcp);
            String pss = getProperty("profilesystemserver");
            String pss = getProperty("profilesystemserver");
            boolean profileSystemServer = "true".equals(pss);
            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;
                break;
            }
            }
            if (i == numIterations) {
            if (i == numIterations) {
                assertTrue("profile system server not enabled: " + pss, profileSystemServer);
                assertTrue("profile system server not enabled: " + pss, profileSystemServer);
                assertTrue("profile boot class path not enabled: " + pbcp, profileBootClassPath);
                assertTrue("profile boot class path not enabled: " + pbcp, profileBootClassPath);
                assertTrue("extra options not set: " + extraOpts, extraOptsOk);
            }
            }


            setProperty("profilebootclasspath", "true");
            setProperty("profilebootclasspath", "true");
            setProperty("profilesystemserver", "true");
            setProperty("profilesystemserver", "true");
            setProperty("extra-opts", DALVIK_VM_EXTRA_OPTS);
            Thread.sleep(1000);
            Thread.sleep(1000);
        }
        }


@@ -114,12 +122,15 @@ public class BootImageProfileTest implements IDeviceTest {
            boolean profileBootClassPath = "true".equals(pbcp);
            boolean profileBootClassPath = "true".equals(pbcp);
            String pss = getProperty("profilesystemserver");
            String pss = getProperty("profilesystemserver");
            boolean profileSystemServer = "true".equals(pss);
            boolean profileSystemServer = "true".equals(pss);
            String extraOpts = getProperty("extra-opts");
            boolean extraOptsOk = DALVIK_VM_EXTRA_OPTS.equals(extraOpts);
            if (profileBootClassPath && profileSystemServer) {
            if (profileBootClassPath && profileSystemServer) {
                break;
                break;
            }
            }
            if (i == numIterations) {
            if (i == numIterations) {
                assertTrue("profile system server not enabled: " + pss, profileSystemServer);
                assertTrue("profile system server not enabled: " + pss, profileSystemServer);
                assertTrue("profile boot class path not enabled: " + pbcp, profileBootClassPath);
                assertTrue("profile boot class path not enabled: " + pbcp, profileBootClassPath);
                assertTrue("extra options not set: " + extraOpts, extraOptsOk);
            }
            }
            Thread.sleep(1000);
            Thread.sleep(1000);
        }
        }