libvmclient: Take VmCallback in VmInstance::start()
Taking VmCallback from VmInstance::new() has following issues:
- Hard to manage VmInstance and VmCallback together,
becaues VmInstance is available after Callback is instantiated.
- VmCallback is only called after being started.
Bug: 381195543
Test: T/H
Change-Id: I013dce6371156ed298a612582c392a54768c00d6
diff --git a/tests/backcompat_test/src/main.rs b/tests/backcompat_test/src/main.rs
index 4113881..a7fb074 100644
--- a/tests/backcompat_test/src/main.rs
+++ b/tests/backcompat_test/src/main.rs
@@ -117,10 +117,9 @@
/* consoleIn */ None,
None,
Some(dump_dt),
- None,
)
.context("Failed to create VM")?;
- vm.start().context("Failed to start VM")?;
+ vm.start(None).context("Failed to start VM")?;
info!("Started example VM.");
// Wait for VM to finish
diff --git a/tests/early_vm_test/src/main.rs b/tests/early_vm_test/src/main.rs
index a3c80ca..7d630f8 100644
--- a/tests/early_vm_test/src/main.rs
+++ b/tests/early_vm_test/src/main.rs
@@ -96,7 +96,6 @@
None, // console_out
None, // log
None, // dump_dt
- None, // callback
)
.context("Failed to create VM")?;
diff --git a/tests/vm_accessor/accessor/src/run.rs b/tests/vm_accessor/accessor/src/run.rs
index 6dcc507..5bdb8f1 100644
--- a/tests/vm_accessor/accessor/src/run.rs
+++ b/tests/vm_accessor/accessor/src/run.rs
@@ -129,10 +129,9 @@
None, /* console_in */
Some(android_log_fd()?), /* log */
None, /* dump_dt */
- Some(Box::new(Callback {})),
)
.context("Failed to create VM")?;
- vm.start().context("Failed to start VM")?;
+ vm.start(Some(Box::new(Callback {}))).context("Failed to start VM")?;
info!("started IAccessor VM with CID {}", vm.cid());
diff --git a/tests/vmbase_example/src/main.rs b/tests/vmbase_example/src/main.rs
index cbe90d8..d427164 100644
--- a/tests/vmbase_example/src/main.rs
+++ b/tests/vmbase_example/src/main.rs
@@ -115,10 +115,9 @@
/* consoleIn */ None,
Some(log_writer),
/* dump_dt */ None,
- None,
)
.context("Failed to create VM")?;
- vm.start().context("Failed to start VM")?;
+ vm.start(None).context("Failed to start VM")?;
info!("Started example VM.");
// Wait for VM to finish, and check that it shut down cleanly.