Start VirtualizationService on demand.
Bug: 183582651 Test: atest VirtualizationTestCases Change-Id: If6cec89206492cf9818a586d9439ebdb62f27342
This commit is contained in:
parent
17de24fda9
commit
f145380f01
|
@ -16,4 +16,6 @@ service virtualizationservice /apex/com.android.virt/bin/virtualizationservice
|
|||
class main
|
||||
user virtualizationservice
|
||||
group virtualizationservice
|
||||
interface aidl android.system.virtualizationservice
|
||||
disabled
|
||||
oneshot
|
||||
|
|
|
@ -38,17 +38,6 @@
|
|||
<option name="push-file" key="virt_test_initramfs.img" value="/data/local/tmp/virt-test/initramfs" />
|
||||
</target_preparer>
|
||||
|
||||
<!-- Root currently needed to run CrosVM.
|
||||
TODO: Give sufficient permissions to the adb shell user (b/171240450). -->
|
||||
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
|
||||
|
||||
<!-- Run VirtualizationService for the duration of the test.
|
||||
TODO: Run VirtualizationService as a system service. -->
|
||||
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
|
||||
<option name="throw-if-cmd-fail" value="true" />
|
||||
<option name="run-command" value="start virtualizationservice" />
|
||||
</target_preparer>
|
||||
|
||||
<test class="com.android.tradefed.testtype.GTest" >
|
||||
<option name="native-test-device-path" value="/data/local/tmp/virt-test" />
|
||||
<option name="module-name" value="VirtualizationTestCases" />
|
||||
|
|
|
@ -19,10 +19,9 @@
|
|||
namespace virt {
|
||||
|
||||
void VirtualizationTest::SetUp() {
|
||||
status_t err =
|
||||
getService<IVirtualizationService>(String16("android.system.virtualizationservice"),
|
||||
&mVirtualizationService);
|
||||
ASSERT_EQ(err, 0);
|
||||
mVirtualizationService = waitForService<IVirtualizationService>(
|
||||
String16("android.system.virtualizationservice"));
|
||||
ASSERT_NE(mVirtualizationService, nullptr);
|
||||
}
|
||||
|
||||
} // namespace virt
|
||||
|
|
|
@ -19,7 +19,7 @@ mod run;
|
|||
mod sync;
|
||||
|
||||
use android_system_virtualizationservice::aidl::android::system::virtualizationservice::IVirtualizationService::IVirtualizationService;
|
||||
use android_system_virtualizationservice::binder::{get_interface, ProcessState, Strong};
|
||||
use android_system_virtualizationservice::binder::{wait_for_interface, ProcessState, Strong};
|
||||
use anyhow::{Context, Error};
|
||||
use run::command_run;
|
||||
use std::path::PathBuf;
|
||||
|
@ -58,7 +58,7 @@ fn main() -> Result<(), Error> {
|
|||
// We need to start the thread pool for Binder to work properly, especially link_to_death.
|
||||
ProcessState::start_thread_pool();
|
||||
|
||||
let service = get_interface(VIRTUALIZATION_SERVICE_BINDER_SERVICE_IDENTIFIER)
|
||||
let service = wait_for_interface(VIRTUALIZATION_SERVICE_BINDER_SERVICE_IDENTIFIER)
|
||||
.context("Failed to find VirtualizationService")?;
|
||||
|
||||
match opt {
|
||||
|
|
Loading…
Reference in New Issue