summaryrefslogtreecommitdiff
path: root/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-02-12 00:54:01 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-02-12 00:54:01 +0000
commit89580dc2edd934f02e55691ddb8f0de93bb7f873 (patch)
tree5a6cc35109c53a9bf8ff9f2db19f5957e4f89643 /tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
parent0b49886dca66d48c4fdf60fdb4beb2c7b51d10ea (diff)
parent68d208e6fa6bdf666951685bdd7e706741441377 (diff)
Merge "Set boot image profile properties in a loop for BootImageProfileTest" am: 33905aa38d am: c0800cfc20 am: 68d208e6fa
Change-Id: I39a6773363e49b6517cca4761b0221b5ccc3618d
Diffstat (limited to 'tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java')
-rw-r--r--tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java34
1 files changed, 30 insertions, 4 deletions
diff --git a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
index 10f3e54a5f96..1c8b6be49547 100644
--- a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
+++ b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
@@ -42,10 +42,9 @@ public class BootImageProfileTest implements IDeviceTest {
}
/**
- * Test that the boot image profile properties are set.
+ * Validate that the boot image profile properties are set.
*/
- @Test
- public void testProperties() throws Exception {
+ public void validateProperties() throws Exception {
String res = mTestDevice.getProperty(
"persist.device_config.runtime_native_boot.profilebootclasspath");
assertTrue("profile boot class path not enabled", res != null && res.equals("true"));
@@ -67,13 +66,37 @@ public class BootImageProfileTest implements IDeviceTest {
@Test
public void testSystemServerProfile() throws Exception {
+ final int numIterations = 20;
+ for (int i = 1; i <= numIterations; ++i) {
+ String res;
+ res = mTestDevice.getProperty(
+ "persist.device_config.runtime_native_boot.profilebootclasspath");
+ boolean profileBootClassPath = res != null && res.equals("true");
+ res = mTestDevice.getProperty(
+ "persist.device_config.runtime_native_boot.profilesystemserver");
+ boolean profileSystemServer = res != null && res.equals("true");
+ if (profileBootClassPath && profileSystemServer) {
+ break;
+ }
+ if (i == numIterations) {
+ assertTrue("profile system server not enabled", profileSystemServer);
+ assertTrue("profile boot class path not enabled", profileSystemServer);
+ }
+
+ res = mTestDevice.executeShellCommand(
+ "device_config put runtime_native_boot profilebootclasspath true");
+ res = mTestDevice.executeShellCommand(
+ "device_config put runtime_native_boot profilesystemserver true");
+ res = mTestDevice.executeShellCommand("stop");
+ res = mTestDevice.executeShellCommand("start");
+ Thread.sleep(5000);
+ }
// Trunacte the profile before force it to be saved to prevent previous profiles
// causing the test to pass.
String res;
res = mTestDevice.executeShellCommand("truncate -s 0 " + SYSTEM_SERVER_PROFILE).trim();
assertTrue(res, res.length() == 0);
// Wait up to 20 seconds for the profile to be saved.
- final int numIterations = 20;
for (int i = 1; i <= numIterations; ++i) {
// Force save the profile since we truncated it.
if (forceSaveProfile("system_server")) {
@@ -89,6 +112,9 @@ public class BootImageProfileTest implements IDeviceTest {
// In case the profile is partially saved, wait an extra second.
Thread.sleep(1000);
+ // Validate that properties are still set.
+ validateProperties();
+
// Validate that the profile is non empty.
res = mTestDevice.executeShellCommand("profman --dump-only --profile-file="
+ SYSTEM_SERVER_PROFILE);