Add --mem option to the vm tool
The option is used to override the memoryMib value of the vm config. The
Microdroid tests are modified to use the minimum amount of memory so
that we keep track of the memory requirement.
Bug: 199703022
Bug: 194961381
Test: atest MicrodroidHostTestCases
Change-Id: Id71c756f689e8da50ea19235264cd788ea4c5f70
diff --git a/vm/src/main.rs b/vm/src/main.rs
index fe47d2c..062773b 100644
--- a/vm/src/main.rs
+++ b/vm/src/main.rs
@@ -62,6 +62,11 @@
/// Whether to run VM in debug mode.
#[structopt(short, long)]
debug: bool,
+
+ /// Memory size (in MiB) of the VM. If unspecified, defaults to the value of `memory_mib`
+ /// in the VM config file.
+ #[structopt(short, long)]
+ mem: Option<u32>,
},
/// Run a virtual machine
Run {
@@ -118,7 +123,7 @@
.context("Failed to find VirtualizationService")?;
match opt {
- Opt::RunApp { apk, idsig, instance, config_path, daemonize, log, debug } => {
+ Opt::RunApp { apk, idsig, instance, config_path, daemonize, log, debug, mem } => {
command_run_app(
service,
&apk,
@@ -128,10 +133,11 @@
daemonize,
log.as_deref(),
debug,
+ mem,
)
}
Opt::Run { config, daemonize, log } => {
- command_run(service, &config, daemonize, log.as_deref())
+ command_run(service, &config, daemonize, log.as_deref(), /* mem */ None)
}
Opt::Stop { cid } => command_stop(service, cid),
Opt::List => command_list(service),