Merge "Split userdebug only tests from MicrodroidHostTestCases" into main
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 323b827..3bc7aba 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -12,6 +12,9 @@
"name": "MicrodroidTestApp"
},
{
+ "name": "CustomPvmfwHostTestCases"
+ },
+ {
"name": "art_standalone_dexpreopt_tests"
},
{
diff --git a/tests/hostside/Android.bp b/tests/hostside/Android.bp
index 8478f98..6301a57 100644
--- a/tests/hostside/Android.bp
+++ b/tests/hostside/Android.bp
@@ -2,26 +2,6 @@
default_applicable_licenses: ["Android-Apache-2.0"],
}
-genrule_defaults {
- name: "test_avf_dts_to_dtb",
- tools: ["dtc"],
- cmd: "$(location dtc) -I dts -O dtb $(in) -o $(out)",
-}
-
-genrule {
- name: "test_avf_debug_policy_with_adb",
- defaults: ["test_avf_dts_to_dtb"],
- srcs: ["assets/avf_debug_policy_with_adb.dts"],
- out: ["avf_debug_policy_with_adb.dtbo"],
-}
-
-genrule {
- name: "test_avf_debug_policy_without_adb",
- defaults: ["test_avf_dts_to_dtb"],
- srcs: ["assets/avf_debug_policy_without_adb.dts"],
- out: ["avf_debug_policy_without_adb.dtbo"],
-}
-
java_test_host {
name: "MicrodroidHostTestCases",
srcs: ["java/**/*.java"],
@@ -38,7 +18,6 @@
"compatibility-host-util",
"cts-statsd-atom-host-test-utils",
"microdroid_payload_metadata",
- "MicrodroidTestPreparer", // Workaround for sandboxed test environment to install this
],
per_testcase_directory: true,
data: [
@@ -46,10 +25,6 @@
":microdroid_general_sepolicy.conf",
":test.com.android.virt.pem",
":test2.com.android.virt.pem",
- ":pvmfw_test",
- ":test_avf_debug_policy_with_adb",
- ":test_avf_debug_policy_without_adb",
- "assets/bcc.dat",
],
data_native_bins: [
"sepolicy-analyze",
@@ -76,5 +51,4 @@
"libsparse",
"libz",
],
- required: ["MicrodroidTestPreparer"],
}
diff --git a/tests/pvmfw/Android.bp b/tests/pvmfw/Android.bp
new file mode 100644
index 0000000..61667f3
--- /dev/null
+++ b/tests/pvmfw/Android.bp
@@ -0,0 +1,46 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+genrule_defaults {
+ name: "test_avf_dts_to_dtb",
+ tools: ["dtc"],
+ cmd: "$(location dtc) -I dts -O dtb $(in) -o $(out)",
+}
+
+genrule {
+ name: "test_avf_debug_policy_with_adb",
+ defaults: ["test_avf_dts_to_dtb"],
+ srcs: ["assets/avf_debug_policy_with_adb.dts"],
+ out: ["avf_debug_policy_with_adb.dtbo"],
+}
+
+genrule {
+ name: "test_avf_debug_policy_without_adb",
+ defaults: ["test_avf_dts_to_dtb"],
+ srcs: ["assets/avf_debug_policy_without_adb.dts"],
+ out: ["avf_debug_policy_without_adb.dtbo"],
+}
+
+java_test_host {
+ name: "CustomPvmfwHostTestCases",
+ srcs: ["java/**/*.java"],
+ test_suites: ["general-tests"],
+ libs: [
+ "androidx.annotation_annotation",
+ "tradefed",
+ ],
+ static_libs: [
+ "MicrodroidHostTestHelper",
+ "PvmfwHostTestHelper",
+ "compatibility-host-util",
+ ],
+ per_testcase_directory: true,
+ data: [
+ ":MicrodroidTestApp",
+ ":pvmfw_test",
+ ":test_avf_debug_policy_with_adb",
+ ":test_avf_debug_policy_without_adb",
+ "assets/bcc.dat",
+ ],
+}
diff --git a/tests/pvmfw/AndroidTest.xml b/tests/pvmfw/AndroidTest.xml
new file mode 100644
index 0000000..6ff7b6f
--- /dev/null
+++ b/tests/pvmfw/AndroidTest.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Host driven tests for pvmfw with customization">
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
+ <option name="force-root" value="true"/>
+ </target_preparer>
+
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CustomPvmfwHostTestCases.jar" />
+ </test>
+</configuration>
diff --git a/tests/hostside/assets/avf_debug_policy_with_adb.dts b/tests/pvmfw/assets/avf_debug_policy_with_adb.dts
similarity index 100%
rename from tests/hostside/assets/avf_debug_policy_with_adb.dts
rename to tests/pvmfw/assets/avf_debug_policy_with_adb.dts
diff --git a/tests/hostside/assets/avf_debug_policy_without_adb.dts b/tests/pvmfw/assets/avf_debug_policy_without_adb.dts
similarity index 100%
rename from tests/hostside/assets/avf_debug_policy_without_adb.dts
rename to tests/pvmfw/assets/avf_debug_policy_without_adb.dts
diff --git a/tests/hostside/assets/bcc.dat b/tests/pvmfw/assets/bcc.dat
similarity index 100%
rename from tests/hostside/assets/bcc.dat
rename to tests/pvmfw/assets/bcc.dat
Binary files differ
diff --git a/tests/pvmfw/helper/Android.bp b/tests/pvmfw/helper/Android.bp
new file mode 100644
index 0000000..1b96842
--- /dev/null
+++ b/tests/pvmfw/helper/Android.bp
@@ -0,0 +1,9 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+java_library_host {
+ name: "PvmfwHostTestHelper",
+ srcs: ["java/**/*.java"],
+ libs: ["androidx.annotation_annotation"],
+}
diff --git a/tests/hostside/helper/java/com/android/microdroid/test/host/Pvmfw.java b/tests/pvmfw/helper/java/com/android/pvmfw/test/host/Pvmfw.java
similarity index 98%
rename from tests/hostside/helper/java/com/android/microdroid/test/host/Pvmfw.java
rename to tests/pvmfw/helper/java/com/android/pvmfw/test/host/Pvmfw.java
index d752108..b0c1207 100644
--- a/tests/hostside/helper/java/com/android/microdroid/test/host/Pvmfw.java
+++ b/tests/pvmfw/helper/java/com/android/pvmfw/test/host/Pvmfw.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.microdroid.test.host;
+package com.android.pvmfw.test.host;
import static java.nio.ByteOrder.LITTLE_ENDIAN;
diff --git a/tests/hostside/java/com/android/microdroid/test/DebugPolicyHostTests.java b/tests/pvmfw/java/com/android/pvmfw/test/DebugPolicyHostTests.java
similarity index 96%
rename from tests/hostside/java/com/android/microdroid/test/DebugPolicyHostTests.java
rename to tests/pvmfw/java/com/android/pvmfw/test/DebugPolicyHostTests.java
index ffeae09..410e6e0 100644
--- a/tests/hostside/java/com/android/microdroid/test/DebugPolicyHostTests.java
+++ b/tests/pvmfw/java/com/android/pvmfw/test/DebugPolicyHostTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.microdroid.test;
+package com.android.pvmfw.test;
import static com.android.tradefed.device.TestDevice.MicrodroidBuilder;
@@ -22,7 +22,6 @@
import static com.google.common.truth.Truth.assertWithMessage;
import static org.junit.Assume.assumeTrue;
-import static org.junit.Assume.assumeFalse;
import static org.junit.Assert.assertThrows;
import androidx.annotation.NonNull;
@@ -30,7 +29,7 @@
import com.android.microdroid.test.host.CommandRunner;
import com.android.microdroid.test.host.MicrodroidHostTestCaseBase;
-import com.android.microdroid.test.host.Pvmfw;
+import com.android.pvmfw.test.host.Pvmfw;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.DeviceRuntimeException;
import com.android.tradefed.device.ITestDevice;
@@ -113,9 +112,6 @@
assumeTrue(
"Skip if protected VMs are not supported",
mAndroidDevice.supportsMicrodroid(/* protectedVm= */ true));
- assumeFalse("Test requires setprop for using custom pvmfw and adb root", isUserBuild());
-
- assumeTrue("Skip if adb root fails", mAndroidDevice.enableAdbRoot());
// tradefed copies the test artfacts under /tmp when running tests,
// so we should *find* the artifacts with the file name.
@@ -156,8 +152,6 @@
FileUtil.deleteFile(mCustomPvmfwBinFileOnHost);
cleanUpVirtualizationTestSetup(mAndroidDevice);
-
- mAndroidDevice.disableAdbRoot();
}
@Test
diff --git a/tests/hostside/java/com/android/microdroid/test/PvmfwImgTest.java b/tests/pvmfw/java/com/android/pvmfw/test/PvmfwImgTest.java
similarity index 95%
rename from tests/hostside/java/com/android/microdroid/test/PvmfwImgTest.java
rename to tests/pvmfw/java/com/android/pvmfw/test/PvmfwImgTest.java
index fa5ef1e..95c1c4e 100644
--- a/tests/hostside/java/com/android/microdroid/test/PvmfwImgTest.java
+++ b/tests/pvmfw/java/com/android/pvmfw/test/PvmfwImgTest.java
@@ -14,21 +14,20 @@
* limitations under the License.
*/
-package com.android.microdroid.test;
+package com.android.pvmfw.test;
import static com.android.tradefed.device.TestDevice.MicrodroidBuilder;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assume.assumeTrue;
-import static org.junit.Assume.assumeFalse;
import static org.junit.Assert.assertThrows;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.microdroid.test.host.MicrodroidHostTestCaseBase;
-import com.android.microdroid.test.host.Pvmfw;
+import com.android.pvmfw.test.host.Pvmfw;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.DeviceRuntimeException;
import com.android.tradefed.device.ITestDevice;
@@ -79,9 +78,6 @@
assumeTrue(
"Skip if protected VMs are not supported",
mAndroidDevice.supportsMicrodroid(/* protectedVm= */ true));
- assumeFalse("Test requires setprop for using custom pvmfw and adb root", isUserBuild());
-
- assumeTrue("Skip if adb root fails", mAndroidDevice.enableAdbRoot());
// tradefed copies the test artfacts under /tmp when running tests,
// so we should *find* the artifacts with the file name.
@@ -119,8 +115,6 @@
FileUtil.deleteFile(mCustomPvmfwBinFileOnHost);
cleanUpVirtualizationTestSetup(mAndroidDevice);
-
- mAndroidDevice.disableAdbRoot();
}
@Test
diff --git a/tests/hostside/tools/Android.bp b/tests/pvmfw/tools/Android.bp
similarity index 79%
rename from tests/hostside/tools/Android.bp
rename to tests/pvmfw/tools/Android.bp
index f3cc275..7bd3ef5 100644
--- a/tests/hostside/tools/Android.bp
+++ b/tests/pvmfw/tools/Android.bp
@@ -6,5 +6,5 @@
name: "pvmfw-tool",
manifest: "pvmfw-tool-manifest.txt",
srcs: ["PvmfwTool.java"],
- static_libs: ["MicrodroidHostTestHelper"],
+ static_libs: ["PvmfwHostTestHelper"],
}
diff --git a/tests/hostside/tools/PvmfwTool.java b/tests/pvmfw/tools/PvmfwTool.java
similarity index 95%
rename from tests/hostside/tools/PvmfwTool.java
rename to tests/pvmfw/tools/PvmfwTool.java
index 18dd6d7..e4b6020 100644
--- a/tests/hostside/tools/PvmfwTool.java
+++ b/tests/pvmfw/tools/PvmfwTool.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.microdroid;
+package com.android.pvmfw;
-import com.android.microdroid.test.host.Pvmfw;
+import com.android.pvmfw.test.host.Pvmfw;
import java.io.File;
import java.io.IOException;
diff --git a/tests/hostside/tools/pvmfw-tool-manifest.txt b/tests/pvmfw/tools/pvmfw-tool-manifest.txt
similarity index 100%
rename from tests/hostside/tools/pvmfw-tool-manifest.txt
rename to tests/pvmfw/tools/pvmfw-tool-manifest.txt