summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Victor Hsieh <victorhsieh@google.com> 2023-06-26 22:25:00 -0700
committer Victor Hsieh <victorhsieh@google.com> 2023-06-28 02:41:52 +0000
commit5a1d0cc3454094a930978bcac1281aafc71475d3 (patch)
tree7194f76559abed7f7b682602017e6eabffc9912e
parent37ccbe7384aafb930c7f4cecf45992062f0adae5 (diff)
Deduplicate test expectation data in a different way
The test collects expected APEX package names from listing /apex by a shell command. The shell command also tries to remove the noise (normally an APEX has two entires, see below). $ ls -d /apex/*/ /apex/com.android.adbd/ /apex/com.android.adbd@340815002/ ... /apex/com.google.mainline.primary.libs@340716000/ /apex/sharedlibs/ The test used to deduplicate by filtering out '@'. But apparently an (DLCA) APEX only has one entry with '@'. With this change, the shell command removes '@\d+' then deduplicate the strings. Bug: 288551133 Test: BinaryTransparencyHostTest#testCollectAllApexInfo Change-Id: I4bc3e8226dd7790aa276ac5dfad7371c60046384
-rw-r--r--tests/BinaryTransparencyHostTest/src/android/transparency/test/BinaryTransparencyHostTest.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/BinaryTransparencyHostTest/src/android/transparency/test/BinaryTransparencyHostTest.java b/tests/BinaryTransparencyHostTest/src/android/transparency/test/BinaryTransparencyHostTest.java
index db369756c50e..346622f0f467 100644
--- a/tests/BinaryTransparencyHostTest/src/android/transparency/test/BinaryTransparencyHostTest.java
+++ b/tests/BinaryTransparencyHostTest/src/android/transparency/test/BinaryTransparencyHostTest.java
@@ -61,8 +61,11 @@ public final class BinaryTransparencyHostTest extends BaseHostJUnit4Test {
options.setTestMethodName("testCollectAllApexInfo");
// Collect APEX package names from /apex, then pass them as expectation to be verified.
+ // The package names are collected from the find name with deduplication (NB: we used to
+ // deduplicate by dropping directory names with '@', but there's a DCLA case where it only
+ // has one directory with '@'. So we have to keep it and deduplicate the current way).
CommandResult result = getDevice().executeShellV2Command(
- "ls -d /apex/*/ |grep -v @ |grep -v /apex/sharedlibs |cut -d/ -f3");
+ "ls -d /apex/*/ |grep -v /apex/sharedlibs |cut -d/ -f3 |cut -d@ -f1 |sort |uniq");
assertTrue(result.getStatus() == CommandStatus.SUCCESS);
String[] packageNames = result.getStdout().split("\n");
for (var i = 0; i < packageNames.length; i++) {