Annotate our CTS tests using CddTests annotation.

Bug: 210201715
Test: N/A
Change-Id: I0895f45004dc69774d83d94b37facc66fe834d74
This commit is contained in:
Jiyong Park 2022-07-11 16:09:19 +09:00
parent 784741cfb6
commit 5517b101f9
4 changed files with 67 additions and 0 deletions

View File

@ -14,6 +14,7 @@ java_test_host {
], ],
static_libs: [ static_libs: [
"MicrodroidHostTestHelper", "MicrodroidHostTestHelper",
"compatibility-host-util",
], ],
per_testcase_directory: true, per_testcase_directory: true,
data: [ data: [

View File

@ -31,6 +31,7 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue; import static org.junit.Assume.assumeTrue;
import com.android.compatibility.common.util.CddTest;
import com.android.tradefed.device.DeviceNotAvailableException; import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.result.TestDescription; import com.android.tradefed.result.TestDescription;
import com.android.tradefed.result.TestResult; import com.android.tradefed.result.TestResult;
@ -99,6 +100,11 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-1-2",
"9.17/C-1-4"
})
public void testCreateVmRequiresPermission() throws Exception { public void testCreateVmRequiresPermission() throws Exception {
// Revoke the MANAGE_VIRTUAL_MACHINE permission for the test app // Revoke the MANAGE_VIRTUAL_MACHINE permission for the test app
CommandRunner android = new CommandRunner(getDevice()); CommandRunner android = new CommandRunner(getDevice());
@ -281,6 +287,11 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-2-1",
"9.17/C-2-2",
"9.17/C-2-6"
})
public void testBootFailsWhenProtectedVmStartsWithImagesSignedWithDifferentKey() public void testBootFailsWhenProtectedVmStartsWithImagesSignedWithDifferentKey()
throws Exception { throws Exception {
assumeTrue(isProtectedVmSupported()); assumeTrue(isProtectedVmSupported());
@ -296,6 +307,10 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-2-2",
"9.17/C-2-6"
})
public void testBootSucceedsWhenNonProtectedVmStartsWithImagesSignedWithDifferentKey() public void testBootSucceedsWhenNonProtectedVmStartsWithImagesSignedWithDifferentKey()
throws Exception { throws Exception {
File key = findTestFile("test.com.android.virt.pem"); File key = findTestFile("test.com.android.virt.pem");
@ -311,6 +326,10 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-2-2",
"9.17/C-2-6"
})
public void testBootFailsWhenBootloaderAndVbMetaAreSignedWithDifferentKeys() public void testBootFailsWhenBootloaderAndVbMetaAreSignedWithDifferentKeys()
throws Exception { throws Exception {
// Sign everything with key1 except vbmeta // Sign everything with key1 except vbmeta
@ -331,6 +350,10 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-2-2",
"9.17/C-2-6"
})
public void testBootSucceedsWhenBootloaderAndVbmetaHaveSameSigningKeys() public void testBootSucceedsWhenBootloaderAndVbmetaHaveSameSigningKeys()
throws Exception { throws Exception {
// Sign everything with key1 except bootloader and vbmeta // Sign everything with key1 except bootloader and vbmeta
@ -392,6 +415,11 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-1-2",
"9.17/C/1-3"
})
public void testMicrodroidBoots() throws Exception { public void testMicrodroidBoots() throws Exception {
final String configPath = "assets/vm_config.json"; // path inside the APK final String configPath = "assets/vm_config.json"; // path inside the APK
final String cid = final String cid =

View File

@ -17,6 +17,7 @@ android_test {
"cbor-java", "cbor-java",
"com.android.microdroid.testservice-java", "com.android.microdroid.testservice-java",
"truth-prebuilt", "truth-prebuilt",
"compatibility-common-util-devicesidelib",
], ],
libs: ["android.system.virtualmachine"], libs: ["android.system.virtualmachine"],
jni_libs: ["MicrodroidTestNativeLib"], jni_libs: ["MicrodroidTestNativeLib"],

View File

@ -30,6 +30,7 @@ import android.system.virtualmachine.VirtualMachineConfig.DebugLevel;
import android.system.virtualmachine.VirtualMachineException; import android.system.virtualmachine.VirtualMachineException;
import android.util.Log; import android.util.Log;
import com.android.compatibility.common.util.CddTest;
import com.android.microdroid.testservice.ITestService; import com.android.microdroid.testservice.ITestService;
import org.junit.Before; import org.junit.Before;
@ -80,6 +81,10 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
private static final int MIN_MEM_X86_64 = 196; private static final int MIN_MEM_X86_64 = 196;
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-1"
})
public void connectToVmService() throws VirtualMachineException, InterruptedException { public void connectToVmService() throws VirtualMachineException, InterruptedException {
assume() assume()
.withMessage("SKip on 5.4 kernel. b/218303240") .withMessage("SKip on 5.4 kernel. b/218303240")
@ -177,6 +182,10 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void changingDebugLevelInvalidatesVmIdentity() public void changingDebugLevelInvalidatesVmIdentity()
throws VirtualMachineException, InterruptedException, IOException { throws VirtualMachineException, InterruptedException, IOException {
assume() assume()
@ -252,6 +261,10 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void instancesOfSameVmHaveDifferentCdis() public void instancesOfSameVmHaveDifferentCdis()
throws VirtualMachineException, InterruptedException { throws VirtualMachineException, InterruptedException {
assume() assume()
@ -276,6 +289,10 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void sameInstanceKeepsSameCdis() public void sameInstanceKeepsSameCdis()
throws VirtualMachineException, InterruptedException { throws VirtualMachineException, InterruptedException {
assume() assume()
@ -297,6 +314,10 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void bccIsSuperficiallyWellFormed() public void bccIsSuperficiallyWellFormed()
throws VirtualMachineException, InterruptedException, CborException { throws VirtualMachineException, InterruptedException, CborException {
assume() assume()
@ -417,12 +438,20 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void bootFailsWhenMicrodroidDataIsCompromised() public void bootFailsWhenMicrodroidDataIsCompromised()
throws VirtualMachineException, InterruptedException, IOException { throws VirtualMachineException, InterruptedException, IOException {
assertThatBootFailsAfterCompromisingPartition(MICRODROID_PARTITION_UUID); assertThatBootFailsAfterCompromisingPartition(MICRODROID_PARTITION_UUID);
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void bootFailsWhenUBootAvbDataIsCompromised() public void bootFailsWhenUBootAvbDataIsCompromised()
throws VirtualMachineException, InterruptedException, IOException { throws VirtualMachineException, InterruptedException, IOException {
if (mProtectedVm) { if (mProtectedVm) {
@ -434,6 +463,10 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void bootFailsWhenUBootEnvDataIsCompromised() public void bootFailsWhenUBootEnvDataIsCompromised()
throws VirtualMachineException, InterruptedException, IOException { throws VirtualMachineException, InterruptedException, IOException {
if (mProtectedVm) { if (mProtectedVm) {
@ -445,6 +478,10 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
} }
@Test @Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void bootFailsWhenPvmFwDataIsCompromised() public void bootFailsWhenPvmFwDataIsCompromised()
throws VirtualMachineException, InterruptedException, IOException { throws VirtualMachineException, InterruptedException, IOException {
if (mProtectedVm) { if (mProtectedVm) {