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

Commit f34532e5 authored by Mathieu Chartier's avatar Mathieu Chartier
Browse files

Add test for system server method sampling

Verify that the package manager constructor is in the profile.

Bug: 139883463
Test: atest BootImageProfileTest
Change-Id: I53350be972771c246c95f623eeb1289c59c9ba84
parent 8fa64738
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -106,13 +106,18 @@ public class BootImageProfileTest implements IDeviceTest {
        // Test the profile contents contain common methods for core-oj that would normally be AOT
        // Test the profile contents contain common methods for core-oj that would normally be AOT
        // compiled.
        // compiled.
        res = mTestDevice.executeShellCommand("profman --dump-classes-and-methods --profile-file="
        res = mTestDevice.executeShellCommand("profman --dump-classes-and-methods --profile-file="
                + SYSTEM_SERVER_PROFILE + " --apk=/apex/com.android.art/javalib/core-oj.jar");
                + SYSTEM_SERVER_PROFILE + " --apk=/apex/com.android.art/javalib/core-oj.jar"
                + " --apk=/system/framework/services.jar");
        boolean sawObjectInit = false;
        boolean sawObjectInit = false;
        boolean sawPmInit = false;
        for (String line : res.split("\n")) {
        for (String line : res.split("\n")) {
            if (line.contains("Ljava/lang/Object;-><init>()V")) {
            if (line.contains("Ljava/lang/Object;-><init>()V")) {
                sawObjectInit = true;
                sawObjectInit = true;
            } else if (line.contains("Lcom/android/server/pm/PackageManagerService;-><init>")) {
                sawPmInit = true;
            }
            }
        }
        }
        assertTrue("Did not see Object.<init> in " + res, sawObjectInit);
        assertTrue("Did not see Object.<init> in " + res, sawObjectInit);
        assertTrue("Did not see PackageManagerService.<init> in " + res, sawPmInit);
    }
    }
}
}