Annotate our CTS tests using CddTests annotation.

Bug: 210201715
Test: N/A
Change-Id: I0895f45004dc69774d83d94b37facc66fe834d74
diff --git a/tests/hostside/Android.bp b/tests/hostside/Android.bp
index 24288ee..26a9780 100644
--- a/tests/hostside/Android.bp
+++ b/tests/hostside/Android.bp
@@ -14,6 +14,7 @@
     ],
     static_libs: [
         "MicrodroidHostTestHelper",
+        "compatibility-host-util",
     ],
     per_testcase_directory: true,
     data: [
diff --git a/tests/hostside/java/com/android/microdroid/test/MicrodroidTestCase.java b/tests/hostside/java/com/android/microdroid/test/MicrodroidTestCase.java
index c4ea80a..6b8003c 100644
--- a/tests/hostside/java/com/android/microdroid/test/MicrodroidTestCase.java
+++ b/tests/hostside/java/com/android/microdroid/test/MicrodroidTestCase.java
@@ -31,6 +31,7 @@
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;
 
+import com.android.compatibility.common.util.CddTest;
 import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.result.TestDescription;
 import com.android.tradefed.result.TestResult;
@@ -99,6 +100,11 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-1-2",
+            "9.17/C-1-4"
+    })
     public void testCreateVmRequiresPermission() throws Exception {
         // Revoke the MANAGE_VIRTUAL_MACHINE permission for the test app
         CommandRunner android = new CommandRunner(getDevice());
@@ -281,6 +287,11 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-2-1",
+            "9.17/C-2-2",
+            "9.17/C-2-6"
+    })
     public void testBootFailsWhenProtectedVmStartsWithImagesSignedWithDifferentKey()
             throws Exception {
         assumeTrue(isProtectedVmSupported());
@@ -296,6 +307,10 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-2-2",
+            "9.17/C-2-6"
+    })
     public void testBootSucceedsWhenNonProtectedVmStartsWithImagesSignedWithDifferentKey()
             throws Exception {
         File key = findTestFile("test.com.android.virt.pem");
@@ -311,6 +326,10 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-2-2",
+            "9.17/C-2-6"
+    })
     public void testBootFailsWhenBootloaderAndVbMetaAreSignedWithDifferentKeys()
             throws Exception {
         // Sign everything with key1 except vbmeta
@@ -331,6 +350,10 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-2-2",
+            "9.17/C-2-6"
+    })
     public void testBootSucceedsWhenBootloaderAndVbmetaHaveSameSigningKeys()
             throws Exception {
         // Sign everything with key1 except bootloader and vbmeta
@@ -392,6 +415,11 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-1-2",
+            "9.17/C/1-3"
+    })
     public void testMicrodroidBoots() throws Exception {
         final String configPath = "assets/vm_config.json"; // path inside the APK
         final String cid =
diff --git a/tests/testapk/Android.bp b/tests/testapk/Android.bp
index d468d76..29a74ca 100644
--- a/tests/testapk/Android.bp
+++ b/tests/testapk/Android.bp
@@ -17,6 +17,7 @@
         "cbor-java",
         "com.android.microdroid.testservice-java",
         "truth-prebuilt",
+        "compatibility-common-util-devicesidelib",
     ],
     libs: ["android.system.virtualmachine"],
     jni_libs: ["MicrodroidTestNativeLib"],
diff --git a/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java b/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
index b429e4d..db2ca0f 100644
--- a/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
+++ b/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
@@ -30,6 +30,7 @@
 import android.system.virtualmachine.VirtualMachineException;
 import android.util.Log;
 
+import com.android.compatibility.common.util.CddTest;
 import com.android.microdroid.testservice.ITestService;
 
 import org.junit.Before;
@@ -80,6 +81,10 @@
     private static final int MIN_MEM_X86_64 = 196;
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-2-1"
+    })
     public void connectToVmService() throws VirtualMachineException, InterruptedException {
         assume()
             .withMessage("SKip on 5.4 kernel. b/218303240")
@@ -177,6 +182,10 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-2-7"
+    })
     public void changingDebugLevelInvalidatesVmIdentity()
             throws VirtualMachineException, InterruptedException, IOException {
         assume()
@@ -252,6 +261,10 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-2-7"
+    })
     public void instancesOfSameVmHaveDifferentCdis()
             throws VirtualMachineException, InterruptedException {
         assume()
@@ -276,6 +289,10 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-2-7"
+    })
     public void sameInstanceKeepsSameCdis()
             throws VirtualMachineException, InterruptedException {
         assume()
@@ -297,6 +314,10 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-2-7"
+    })
     public void bccIsSuperficiallyWellFormed()
             throws VirtualMachineException, InterruptedException, CborException {
         assume()
@@ -417,12 +438,20 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-2-7"
+    })
     public void bootFailsWhenMicrodroidDataIsCompromised()
             throws VirtualMachineException, InterruptedException, IOException {
         assertThatBootFailsAfterCompromisingPartition(MICRODROID_PARTITION_UUID);
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-2-7"
+    })
     public void bootFailsWhenUBootAvbDataIsCompromised()
             throws VirtualMachineException, InterruptedException, IOException {
         if (mProtectedVm) {
@@ -434,6 +463,10 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-2-7"
+    })
     public void bootFailsWhenUBootEnvDataIsCompromised()
             throws VirtualMachineException, InterruptedException, IOException {
         if (mProtectedVm) {
@@ -445,6 +478,10 @@
     }
 
     @Test
+    @CddTest(requirements = {
+            "9.17/C-1-1",
+            "9.17/C-2-7"
+    })
     public void bootFailsWhenPvmFwDataIsCompromised()
             throws VirtualMachineException, InterruptedException, IOException {
         if (mProtectedVm) {