Files
codex/codex-rs/voice-host/tests/common/mod.rs
T
Felipe Coury ac91c14443 Make native startup libraries available to Windows voice-host tests (#59082)
## What changed

Add a shared command builder for `codex-voice-host` integration tests. On Windows MSVC builds with Bazel runfiles available, locate the architecture-specific voice runtime and prepend its `bin` directory to the helper's `PATH`.

Use the builder for lifecycle helper launches and build-identity queries in the lifecycle, installed-client, and packaged-runtime tests.

GitOrigin-RevId: c9fbd0769842eb4ee20742e126a9c4173dd7e128
2026-11-03 07:06:04 +00:00

32 lines
1.1 KiB
Rust

//! Launches the helper with its Bazel-provided native startup libraries available.
#[cfg(all(windows, target_env = "msvc"))]
use std::env;
#[cfg(all(windows, target_env = "msvc"))]
use anyhow::Context;
use anyhow::Result;
use codex_utils_cargo_bin::cargo_bin;
use tokio::process::Command;
pub(crate) fn voice_host_command() -> Result<Command> {
let command = Command::new(cargo_bin("codex-voice-host")?);
#[cfg(all(windows, target_env = "msvc"))]
let mut command = command;
#[cfg(all(windows, target_env = "msvc"))]
if codex_utils_cargo_bin::runfiles_available() {
let resource = format!(
"../../third_party/voice/native_link_windows_{}/runtime.json",
env::consts::ARCH
);
let runtime = codex_utils_cargo_bin::find_resource!(resource)?;
let runtime_bin = runtime.parent().context("voice runtime root")?.join("bin");
let path = env::join_paths(
std::iter::once(runtime_bin)
.chain(env::split_paths(&env::var_os("PATH").unwrap_or_default())),
)?;
command.env("PATH", path);
}
Ok(command)
}