Support console input to VM
createVm accepts a new ParcelFileDescriptor which when set is used as
the console input in the VM. The `vm` tool sets this to stdin unless
explicitly specified via `--console-in`. This will be useful for
bringing up custom OSes.
Note that Java APIs for this is not added in this CL.
Bug: 263360203
Test: Start a vm using the `vm` tool. Type something. Then do `cat
/dev/console` in the VM. It shows the typed characters.
Change-Id: I5d0dfcc4852387ec50897a8dcae2935dd4a2dd9a
diff --git a/vmbase/example/tests/test.rs b/vmbase/example/tests/test.rs
index 085a620..3594523 100644
--- a/vmbase/example/tests/test.rs
+++ b/vmbase/example/tests/test.rs
@@ -106,8 +106,15 @@
});
let (handle, console) = android_log_fd()?;
let (mut log_reader, log_writer) = pipe()?;
- let vm = VmInstance::create(service.as_ref(), &config, Some(console), Some(log_writer), None)
- .context("Failed to create VM")?;
+ let vm = VmInstance::create(
+ service.as_ref(),
+ &config,
+ Some(console),
+ /* consoleIn */ None,
+ Some(log_writer),
+ None,
+ )
+ .context("Failed to create VM")?;
vm.start().context("Failed to start VM")?;
info!("Started example VM.");