summaryrefslogtreecommitdiff
path: root/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
diff options
context:
space:
mode:
authorAndroid Build Merger (Role) <noreply-android-build-merger@google.com>2019-09-25 16:49:48 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-09-25 16:49:48 +0000
commitdf535a3d9e89fbde01ea2f804097e89fb5ee3029 (patch)
tree2753c67603a6bdb08fef8d8ab11163800e5c74e4 /tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
parentc0284741913f39d4b1a50edef7f7fcc0e4abeb13 (diff)
parent2fb7499ed0a94eb80ea7d0f3aded2b2f9acae174 (diff)
Merge "Merge "Wait for the profile to not be empty in BootImageProfileTest" am: 37f8bfb2c1 am: fdc8257eae am: a722ba3cb9 am: 5c2bd6ca18"
Diffstat (limited to 'tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java')
-rw-r--r--tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
index 17986a3c9d61..730b210f1529 100644
--- a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
+++ b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
@@ -66,10 +66,18 @@ public class BootImageProfileTest implements IDeviceTest {
String res;
res = mTestDevice.executeShellCommand("truncate -s 0 " + SYSTEM_SERVER_PROFILE).trim();
assertTrue(res, res.length() == 0);
- // Force save profiles in case the system just started.
+ // Wait up to 20 seconds for the profile to be saved.
+ for (int i = 0; i < 20; ++i) {
+ // Force save the profile since we truncated it.
+ forceSaveProfile("system_server");
+ String s = mTestDevice.executeShellCommand("wc -c <" + SYSTEM_SERVER_PROFILE).trim();
+ if (!"0".equals(s)) {
+ break;
+ }
+ Thread.sleep(1000);
+ }
+ // In case the profile is partially saved, wait an extra second.
Thread.sleep(1000);
- forceSaveProfile("system_server");
- Thread.sleep(2000);
// Validate that the profile is non empty.
res = mTestDevice.executeShellCommand("profman --dump-only --profile-file="
+ SYSTEM_SERVER_PROFILE);