Add basic test that shares a VM from one app to another
This test consist of 2 apps:
* MicrodroidTestApp - test driver
* MicrodroidVmShareApp - helper app that exposes a service that
MicrodroidTestApp binds to.
The test orchestarted by MicrodroidTestApp consists of the following:
1. MicrodroidTestApp starts & stops a VM
2. MicrodroidTestApp creates a descriptor of that VM
3. MicrodroidTestApp binds to service in MicrodroidVmShareApp
4. MicrodroidTestApp sends the descriptor to MicrodroidVmShareApp
5. MicrodroidVmShareApp starts a VM from that descriptor, and connects
to the vsock service exposed by the VM.
6. MicrodroidVmShareApp shares a binder interface for MicrodroidTestApp
to interact with the service exposed by the MicrodroidVmShareApp VM.
7. MicrodroidTestApp uses that binder to assert on the VM.
This change adds the scaffolding and a basic test, more involved test
(e.g. with trusted storage) will be added in the follow up changes.
Bug: 259384440
Test: atest MicrodroidTestApp
Change-Id: I924c0fd9494010fd55fd9062206e8f3202e43b5b
diff --git a/tests/vmshareapp/aidl/Android.bp b/tests/vmshareapp/aidl/Android.bp
new file mode 100644
index 0000000..df4a4b4
--- /dev/null
+++ b/tests/vmshareapp/aidl/Android.bp
@@ -0,0 +1,15 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+// Unfortunatelly aidl_interface doesn't work well with .aidl files that depend on java-only
+// parcelables (e.g. Bundle, VirtualMachineDescriptor), hence this java_library.
+java_library {
+ name: "com.android.microdroid.test.vmshare_service-java",
+ srcs: ["com/**/*.aidl"],
+ sdk_version: "test_current",
+ static_libs: ["com.android.microdroid.testservice-java"],
+ aidl: {
+ include_dirs: ["packages/modules/Virtualization/tests/aidl/"],
+ },
+}
diff --git a/tests/vmshareapp/aidl/com/android/microdroid/test/vmshare/IVmShareTestService.aidl b/tests/vmshareapp/aidl/com/android/microdroid/test/vmshare/IVmShareTestService.aidl
new file mode 100644
index 0000000..fe6ca43
--- /dev/null
+++ b/tests/vmshareapp/aidl/com/android/microdroid/test/vmshare/IVmShareTestService.aidl
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+package com.android.microdroid.test.vmshare;
+
+import android.system.virtualmachine.VirtualMachineDescriptor;
+import com.android.microdroid.testservice.ITestService;
+
+/** {@hide} */
+interface IVmShareTestService {
+ ITestService startVm(in VirtualMachineDescriptor vmDesc);
+}