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
parent d007b0852a
commit 1fe89de576
28 changed files with 789 additions and 157 deletions

View File

@@ -2,5 +2,4 @@ package(default_visibility = ["//visibility:public"])
exports_files([
"foreign_platform_binary.bzl",
"wine.bzl",
])

View File

@@ -1,8 +1,13 @@
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library")
load("//bazel/rules/testing:wine.bzl", "wine_rust_test")
load(":wine.bzl", "wine_rust_test")
package(default_visibility = ["//visibility:public"])
exports_files([
"wine.bzl",
"wine_runtime.bzl",
])
rust_library(
name = "wine_test_support",
testonly = True,

View File

@@ -2,15 +2,8 @@
load("@rules_rust//rust:defs.bzl", "rust_test")
load("//:defs.bzl", "WINDOWS_GNULLVM_RUSTC_LINK_FLAGS")
load(":foreign_platform_binary.bzl", "foreign_platform_binary")
_WINE_RUNTIME_BINARIES = {
"pwsh": "@powershell_windows_x86_64//:pwsh",
"pwsh-runtime-marker": "@powershell_windows_x86_64//:runtime_marker",
"wine": "@wine_linux_x86_64//:wine",
"wine-runtime-marker": "@wine_linux_x86_64//:runtime_marker",
"wineserver": "@wine_linux_x86_64//:wineserver",
}
load("//bazel/rules/testing:foreign_platform_binary.bzl", "foreign_platform_binary")
load(":wine_runtime.bzl", "WINE_TEST_TARGET_COMPATIBLE_WITH", "wine_test_runtime")
def wine_rust_test(
name,
@@ -46,20 +39,10 @@ def wine_rust_test(
target_compatible_with: Additional compatibility constraints.
**kwargs: Remaining attributes forwarded to `rust_test`.
"""
binaries = dict(_WINE_RUNTIME_BINARIES)
runtime_data = [
"@powershell_windows_x86_64//:runtime",
"@wine_linux_x86_64//:runtime",
]
for binary_name in sorted(host_binaries.keys()):
if binary_name in binaries:
fail("host test binary name collides with test runtime: {}".format(binary_name))
binaries[binary_name] = host_binaries[binary_name]
binaries = dict(host_binaries)
for index, binary_name in enumerate(sorted(windows_binaries.keys())):
if binary_name in binaries:
fail("Windows test binary name collides with existing binary: {}".format(binary_name))
fail("Windows test binary name collides with host binary: {}".format(binary_name))
transitioned_binary = name + "-windows-binary-" + str(index)
foreign_platform_binary(
name = transitioned_binary,
@@ -76,17 +59,11 @@ def wine_rust_test(
)
binaries[binary_name] = ":" + transitioned_binary
runtime = wine_test_runtime(binaries)
rust_test(
name = name,
data = data + runtime_data + [binary for binary in binaries.values()],
env = {
"CARGO_BIN_EXE_{}".format(binary_name): "$(rlocationpath {})".format(binary)
for binary_name, binary in binaries.items()
},
target_compatible_with = target_compatible_with + [
"@llvm//constraints/libc:gnu.2.28",
"@platforms//cpu:x86_64",
"@platforms//os:linux",
],
data = data + runtime.data,
env = runtime.env,
target_compatible_with = target_compatible_with + WINE_TEST_TARGET_COMPATIBLE_WITH,
**kwargs
)

View File

@@ -0,0 +1,40 @@
"""Runfiles shared by tests that execute Windows binaries through Wine."""
_WINE_RUNTIME_BINARIES = {
"pwsh": "@powershell_windows_x86_64//:pwsh",
"pwsh-runtime-marker": "@powershell_windows_x86_64//:runtime_marker",
"wine": "@wine_linux_x86_64//:wine",
"wine-runtime-marker": "@wine_linux_x86_64//:runtime_marker",
"wineserver": "@wine_linux_x86_64//:wineserver",
}
_WINE_RUNTIME_DATA = [
"@powershell_windows_x86_64//:runtime",
"@wine_linux_x86_64//:runtime",
]
WINE_TEST_TARGET_COMPATIBLE_WITH = [
"@llvm//constraints/libc:gnu.2.28",
"@platforms//cpu:x86_64",
"@platforms//os:linux",
]
def wine_test_runtime(test_binaries = {}):
"""Returns data and environment mappings for a Wine-backed test."""
binaries = dict(_WINE_RUNTIME_BINARIES)
for binary_name in sorted(test_binaries.keys()):
if binary_name in binaries:
fail("test binary name collides with Wine runtime: {}".format(binary_name))
binaries[binary_name] = test_binaries[binary_name]
return struct(
data = _WINE_RUNTIME_DATA + [binary for binary in binaries.values()],
env = {
"CARGO_BIN_EXE_{}".format(binary_name): "$(rlocationpath {})".format(binary)
for binary_name, binary in binaries.items()
},
runfile_env = {
binary_label: "CARGO_BIN_EXE_" + binary_name
for binary_name, binary_label in binaries.items()
},
)