Test that cache-info.xml omits irrelevant APEXes

Bug: 210473615
Test: atest OdrefreshHostTest#verifyCacheInfoOmitsIrrelevantApexes
Change-Id: I24bb33b73866582c735fbf86723a7ea72a044ee7
diff --git a/test/odsign/test-src/com/android/tests/odsign/OdrefreshHostTest.java b/test/odsign/test-src/com/android/tests/odsign/OdrefreshHostTest.java
index c176a0c..567c85d 100644
--- a/test/odsign/test-src/com/android/tests/odsign/OdrefreshHostTest.java
+++ b/test/odsign/test-src/com/android/tests/odsign/OdrefreshHostTest.java
@@ -16,6 +16,8 @@
 
 package com.android.tests.odsign;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -144,6 +146,20 @@
         assertFalse(getDevice().doesFileExist(unexpected));
     }
 
+    @Test
+    public void verifyCacheInfoOmitsIrrelevantApexes() throws Exception {
+        String cacheInfo = getDevice().pullFileContents(CACHE_INFO_FILE);
+
+        // cacheInfo should list all APEXes that have compilable JARs and
+        // none that do not.
+
+        // This should always contain classpath JARs, that's the reason it exists.
+        assertThat(cacheInfo).contains("name=\"com.android.sdkext\"");
+
+        // This should never contain classpath JARs, it's the native runtime.
+        assertThat(cacheInfo).doesNotContain("name=\"com.android.runtime\"");
+    }
+
     /**
      * Checks the input line by line and replaces all lines that match the regex with the given
      * replacement.