Files
codex/codex-rs/tui/BUILD.bazel
T
Dmitriy Kovalenko 17b00277cc Make Bazel Rust tests portable across Linux environments (#63773)
## Why

Some test fixtures depend on `python3` being on the host's `PATH` or
on reading Rust's process arguments from a constructor. Bazel workers
need a declared Python runtime, and musl does not provide those
arguments to constructors.

## What changed

- Put Bazel's Python 3.12 runtime on `PATH` for Linux test suites that
  invoke `python3`, including their Wine launchers.
- Use standalone helper binaries for exec-server and sandbox fixtures on
  musl, and read `/proc/self/cmdline` for the MCP hook fixture.
- Add launcher options for test execution tags and for routing selected
  Linux cases to a local companion target that shares the test binary.
- Adjust test fixtures for platform differences in file creation
  timestamps and shell script execution. Keep cloud-config error tests
  pointed at their mock server after startup falls back to defaults.

## Testing

Exercise marketplace upgrade negotiation at Git 2.20 and check whether
the installed Git supports limiting the refs advertised by the clone.

GitOrigin-RevId: 3a83cde954d52ca29d346d67488c9a25c0790614
2026-11-24 23:57:49 +00:00

41 lines
1.3 KiB
Python

load("//:defs.bzl", "MACOS_WEBRTC_RUSTC_LINK_FLAGS", "codex_rust_crate")
codex_rust_crate(
name = "tui",
binaries_with_build_commit = ["codex-tui"],
compile_data = glob([
"assets/**",
]),
crate_name = "codex_tui",
extra_binaries = [
"//codex-rs/bwrap:bwrap",
"//codex-rs/cli:codex",
"//codex-rs/linux-sandbox:codex-linux-sandbox",
"//codex-rs/rmcp-client:test_stdio_server",
],
integration_compile_data_extra = ["src/test_backend.rs"],
linux_python_tests = ["tui-all-test"],
rustc_flags_extra = MACOS_WEBRTC_RUSTC_LINK_FLAGS,
test_data_extra = glob([
"src/**/*.rs",
"src/**/snapshots/**",
"tests/fixtures/**",
]),
test_shard_counts = {
"tui-unit-tests": 8,
},
# The startup symlink test applies its own Seatbelt policy, which cannot be nested.
test_tags = ["no-sandbox"],
# Large async test futures can overflow the default libtest stack.
unit_test_env = {"RUST_MIN_STACK": "25165824"}, # 24 MiB
unit_test_srcs = glob([
"src/**/*_test_support.rs",
"src/**/*_tests.rs",
"src/**/*_tests/**/*.rs",
"src/**/test_fixtures.rs",
"src/**/test_support.rs",
"src/**/tests.rs",
"src/**/tests/**/*.rs",
]) + ["src/test_backend.rs"],
)