From 116b91c2c113a7c1d1e8a4e52d61eb5fc96963cf Mon Sep 17 00:00:00 2001 From: Victor Hsieh Date: Thu, 13 Feb 2020 09:28:59 -0800 Subject: Exclude all directories instead of only known ones The previous known directories seem to be removed in some case and breaks the test. Since the intention is to exclude directories and compare existing files, exclude all directories instead. Test: atest ApkVerityTest Bug: 149469433 Change-Id: Ib096062b5647920b90f7d9d5638226392a2df174 --- tests/ApkVerityTest/src/com/android/apkverity/ApkVerityTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/ApkVerityTest/src/com/android/apkverity/ApkVerityTest.java b/tests/ApkVerityTest/src/com/android/apkverity/ApkVerityTest.java index 20d0e9690e8e..ae20cae36839 100644 --- a/tests/ApkVerityTest/src/com/android/apkverity/ApkVerityTest.java +++ b/tests/ApkVerityTest/src/com/android/apkverity/ApkVerityTest.java @@ -430,10 +430,9 @@ public class ApkVerityTest extends BaseHostJUnit4Test { private void verifyInstalledFiles(String... filenames) throws DeviceNotAvailableException { String apkPath = getApkPath(TARGET_PACKAGE); String appDir = apkPath.substring(0, apkPath.lastIndexOf("/")); + // Exclude directories since we only care about files. HashSet actualFiles = new HashSet<>(Arrays.asList( - expectRemoteCommandToSucceed("ls " + appDir).split("\n"))); - assertTrue(actualFiles.remove("lib")); - assertTrue(actualFiles.remove("oat")); + expectRemoteCommandToSucceed("ls -p " + appDir + " | grep -v '/'").split("\n"))); HashSet expectedFiles = new HashSet<>(Arrays.asList(filenames)); assertEquals(expectedFiles, actualFiles); -- cgit v1.2.3-59-g8ed1b