Test generated keys are valid
After compilation has run the generated CompOS public/private key pair
should be valid, as decided by compos_verify_key, since that is what
odsign uses.
In passing: change a couple of checks from assume to assert.
Bug: 213891964
Test: atest ComposTestCase
Change-Id: Id91d869b4ed15a8d6e2720d7e79bab874b3eb714
diff --git a/compos/tests/java/android/compos/test/ComposTestCase.java b/compos/tests/java/android/compos/test/ComposTestCase.java
index ff3baa2..1213ada 100644
--- a/compos/tests/java/android/compos/test/ComposTestCase.java
+++ b/compos/tests/java/android/compos/test/ComposTestCase.java
@@ -38,6 +38,8 @@
// Binaries used in test. (These paths are valid both in host and Microdroid.)
private static final String ODREFRESH_BIN = "/apex/com.android.art/bin/odrefresh";
private static final String COMPOSD_CMD_BIN = "/apex/com.android.compos/bin/composd_cmd";
+ private static final String COMPOS_VERIFY_KEY_BIN =
+ "/apex/com.android.compos/bin/compos_verify_key";
/** Output directory of odrefresh */
private static final String TEST_ARTIFACTS_DIR = "test-artifacts";
@@ -148,8 +150,11 @@
assertThat(actualChecksumSnapshot).isEqualTo(expectedChecksumSnapshot);
// Expect extra files generated by CompOS exist.
- android.assumeSuccess("test -f " + ODREFRESH_OUTPUT_DIR + "/compos.info");
- android.assumeSuccess("test -f " + ODREFRESH_OUTPUT_DIR + "/compos.info.signature");
+ android.run("test -f " + ODREFRESH_OUTPUT_DIR + "/compos.info");
+ android.run("test -f " + ODREFRESH_OUTPUT_DIR + "/compos.info.signature");
+
+ // Expect the CompOS public key & key blob to be valid
+ android.run(COMPOS_VERIFY_KEY_BIN + " --debug --instance test");
}
private CommandResult runOdrefresh(CommandRunner android, String command) throws Exception {