From 69ff43531b03b97efb031e26f812a6c1daa7b5ec Mon Sep 17 00:00:00 2001 From: Octavian Purdila Date: Mon, 4 Mar 2024 14:11:33 -0800 Subject: mcu: substitute ${bin} config entries to Android host binary path The Android host binary path is not added automatically to the the PATH environment variable) in all environments, specifically when running in Android CI. This CL adds support for substituting the ${bin} keyword from the start command string to the current Android host binary path. Bug: 318734012 Change-Id: Ie656b9386ec7ef04014c2613e02dc7331315f4b1 --- host/commands/run_cvd/launch/mcu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/host/commands/run_cvd/launch/mcu.cpp b/host/commands/run_cvd/launch/mcu.cpp index 96e426e7d..8076abebd 100644 --- a/host/commands/run_cvd/launch/mcu.cpp +++ b/host/commands/run_cvd/launch/mcu.cpp @@ -62,12 +62,14 @@ class Mcu : public vm_manager::VmmDependencyCommand { CF_EXPECT(start.type() == Json::arrayValue, "mcu: config: start-cmd: array expected"); CF_EXPECT(start.size() > 0, "mcu: config: empty start-cmd"); - Command command(start[0].asString()); + Command command(android::base::StringReplace(start[0].asString(), "${bin}", + HostBinaryPath(""), true)); - std::string wdir = "${wdir}"; for (unsigned int i = 1; i < start.size(); i++) { auto param = start[i].asString(); param = android::base::StringReplace(param, "${wdir}", mcu_dir_, true); + param = android::base::StringReplace(param, "${bin}", HostBinaryPath(""), + true); command.AddParameter(param); } -- cgit v1.2.3