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: [
"MicrodroidHostTestHelper",
"compatibility-host-util",
],
per_testcase_directory: true,
data: [

View File

@ -31,6 +31,7 @@ import static org.junit.Assert.assertTrue;
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 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
}
@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 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
}
@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 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
}
@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 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
}
@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 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
}
@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 @@ public class MicrodroidTestCase extends MicrodroidHostTestCaseBase {
}
@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 =

View File

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

View File

@ -30,6 +30,7 @@ import android.system.virtualmachine.VirtualMachineConfig.DebugLevel;
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 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
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 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
}
@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 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
}
@Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void instancesOfSameVmHaveDifferentCdis()
throws VirtualMachineException, InterruptedException {
assume()
@ -276,6 +289,10 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
}
@Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void sameInstanceKeepsSameCdis()
throws VirtualMachineException, InterruptedException {
assume()
@ -297,6 +314,10 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
}
@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 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
}
@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 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
}
@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 @@ public class MicrodroidTests extends MicrodroidDeviceTestBase {
}
@Test
@CddTest(requirements = {
"9.17/C-1-1",
"9.17/C-2-7"
})
public void bootFailsWhenPvmFwDataIsCompromised()
throws VirtualMachineException, InterruptedException, IOException {
if (mProtectedVm) {