Fixes presubmit test flaky in dumpstate
The test assert that file size of primary.prof in the
`FS/data/misc/profiles/cur/0/com.android.phone/` should
be greater than 0. This behavior depends on art module,
and it's not always true. Updates the test to assert
the file should exist.
Bug: 178561542
Test: atest dumpstate_smoke_test
Change-Id: I1038c6c10c320cd98fa97f0890fff7f64e29e731
diff --git a/cmds/dumpstate/tests/dumpstate_smoke_test.cpp b/cmds/dumpstate/tests/dumpstate_smoke_test.cpp
index fe6a34a..a4092f5 100644
--- a/cmds/dumpstate/tests/dumpstate_smoke_test.cpp
+++ b/cmds/dumpstate/tests/dumpstate_smoke_test.cpp
@@ -310,8 +310,12 @@
// FS/proc/*/mountinfo size > 0
FileExists("FS/proc/1/mountinfo", 0U, 100000U);
- // FS/data/misc/profiles/cur/0/*/primary.prof size > 0
- FileExists("FS/data/misc/profiles/cur/0/com.android.phone/primary.prof", 0U, 100000U);
+ // FS/data/misc/profiles/cur/0/*/primary.prof should exist. Also, since dumpstate only adds
+ // profiles to the zip in the non-user build, a build checking is necessary here.
+ if (!PropertiesHelper::IsUserBuild()) {
+ ZipEntry entry;
+ GetEntry(handle, "FS/data/misc/profiles/cur/0/com.android.phone/primary.prof", &entry);
+ }
}
/**