When testing CompOS, write somewhere harmless
The motivation for this is mostly to allow us to run this on real
devices in teamfood without worrying that it will break things. It's
also preparation for extending composd to do more useful things as
well as running tests.
Modify ComposTestCase to always write to /test instead of
/dalvik-cache (both inside & outside the VM).
Improve the support for multiple instances in composd, rename the
force-compile method to make it clear it does test things, and make
sure it uses a test instance of composd (so odsign will ignore it).
Modify composd_cmd to take a parameter telling it what to do.
Plus some gratuitous tweaks / reformats.
Bug: 186126194
Bug: 200020887
Test: atest ComposTestCase
Test: adb shell apex/com.android.compos/bin/composd_cmd forced-compile-test
Change-Id: I7899fe6393b556e04d9e7f8a07671d96e72bb018
diff --git a/compos/composd_cmd/composd_cmd.rs b/compos/composd_cmd/composd_cmd.rs
index e4884e3..04398c0 100644
--- a/compos/composd_cmd/composd_cmd.rs
+++ b/compos/composd_cmd/composd_cmd.rs
@@ -23,12 +23,25 @@
use anyhow::{Context, Result};
fn main() -> Result<()> {
+ let app = clap::App::new("composd_cmd").arg(
+ clap::Arg::with_name("command")
+ .index(1)
+ .takes_value(true)
+ .required(true)
+ .possible_values(&["forced-compile-test"]),
+ );
+ let args = app.get_matches();
+ let command = args.value_of("command").unwrap();
+
ProcessState::start_thread_pool();
let service = wait_for_interface::<dyn IIsolatedCompilationService>("android.system.composd")
.context("Failed to connect to composd service")?;
- service.runForcedCompile().context("Compilation failed")?;
+ match command {
+ "forced-compile-test" => service.runForcedCompileForTest().context("Compilation failed")?,
+ _ => panic!("Unexpected command {}", command),
+ }
println!("All Ok!");