Run core integration tests against a Wine-backed Windows executor (#28401)

## Why

We want to exercise a linux app-server against a windows exec-server
without having to repeat every test case. This approach has slight
precedent in the remote docker test setup.

## What

Run the shared `codex-core` integration suite against Windows
exec-server behavior from Linux. This makes cross-OS path and shell
regressions visible while keeping unsupported cases owned by individual
tests.

- Add `local`, `docker`, and `wine-exec` test environment selection with
legacy Docker compatibility.
- Extend `codex_rust_crate` to generate a sharded Wine-exec variant
using a cross-built Windows server and pinned Bazel Wine/PowerShell
runtimes.
- Teach remote-aware helpers about Windows paths and track temporary
incompatibilities with source-local `skip_if_wine_exec!` calls and
follow-up reasons.
This commit is contained in:
Adam Perry @ OpenAI
2026-06-15 17:38:41 -07:00
committed by GitHub
Unverified
parent d007b0852a
commit 1fe89de576
28 changed files with 789 additions and 157 deletions
+16 -1
View File
@@ -16,6 +16,21 @@ rust_library(
],
)
rust_binary(
name = "wine-exec-test-runner",
testonly = True,
srcs = ["wine_remote_test_runner.rs"],
crate_name = "wine_exec_test_runner",
crate_root = "wine_remote_test_runner.rs",
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
":wine-exec-server-test-support",
"@crates//:anyhow",
"@crates//:tokio",
],
)
rust_binary(
name = "windows-exec-server",
testonly = True,
@@ -24,7 +39,7 @@ rust_binary(
crate_root = "windows_exec_server.rs",
tags = ["manual"],
target_compatible_with = ["@platforms//os:windows"],
visibility = ["//codex-rs/core/tests/remote_env_windows:__pkg__"],
visibility = ["//visibility:public"],
deps = [
"//codex-rs/exec-server",
"@crates//:tokio",
@@ -0,0 +1,62 @@
use std::ffi::OsStr;
use std::ffi::OsString;
use std::path::PathBuf;
use std::process::Stdio;
use anyhow::Context;
use anyhow::Result;
use tokio::process::Command;
use wine_exec_server_test_support::WineExecServer;
const TEST_BINARY_ENV_VAR: &str = "CODEX_WINE_EXEC_TEST_BINARY";
const TEST_ENVIRONMENT_ENV_VAR: &str = "CODEX_TEST_ENVIRONMENT";
const REMOTE_EXEC_SERVER_URL_ENV_VAR: &str = "CODEX_TEST_REMOTE_EXEC_SERVER_URL";
const LEGACY_REMOTE_ENV_ENV_VAR: &str = "CODEX_TEST_REMOTE_ENV";
const DOCKER_CONTAINER_ENV_VAR: &str = "CODEX_TEST_REMOTE_ENV_CONTAINER_NAME";
#[tokio::main(flavor = "multi_thread", worker_threads = 2)]
async fn main() -> Result<()> {
let test_binary = PathBuf::from(
std::env::var_os(TEST_BINARY_ENV_VAR)
.with_context(|| format!("{TEST_BINARY_ENV_VAR} must be set by the Bazel test rule"))?,
);
let forwarded_args = std::env::args_os().skip(1).collect::<Vec<_>>();
if is_terse_list_request(&forwarded_args) {
let status = Command::new(&test_binary)
.args(&forwarded_args)
.status()
.await
.context("list integration tests")?;
anyhow::ensure!(status.success(), "listing integration tests exited with {status}");
return Ok(());
}
WineExecServer
.scope(|exec_server_url| async move {
let mut command = Command::new(test_binary);
command
.env(TEST_ENVIRONMENT_ENV_VAR, "wine-exec")
.env(REMOTE_EXEC_SERVER_URL_ENV_VAR, exec_server_url)
.env_remove(LEGACY_REMOTE_ENV_ENV_VAR)
.env_remove(DOCKER_CONTAINER_ENV_VAR)
.args(forwarded_args)
.stdin(Stdio::null())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.kill_on_drop(true);
let status = command.status().await.context("run integration tests")?;
anyhow::ensure!(status.success(), "integration tests exited with {status}");
Ok(())
})
.await
}
fn is_terse_list_request(args: &[OsString]) -> bool {
args.iter().map(OsString::as_os_str).eq([
OsStr::new("--list"),
OsStr::new("--format"),
OsStr::new("terse"),
])
}