bench: add codex help e2e macrobenchmark (#31295)

## Why

Bazel-backed end-to-end macrobenchmark plumbing needs a small,
deterministic first consumer that does not couple the shared
infrastructure to the remote-skill scenario.

## What

- add `codex_e2e_benchmark`, a small macro for Bazel-only Divan
benchmarks and runtime binary runfiles
- keep benchmark sources under `e2e_benches/` so Cargo does not
auto-discover them
- add a CLI example that resolves the real `codex` binary and measures
`codex --help`
- assert the spawned command succeeds

## Validation

- `bazel test --compilation_mode=fastbuild
--@rules_rust//rust/settings:extra_rustc_flag=-Cdebug-assertions=no
--@rules_rust//rust/settings:extra_exec_rustc_flag=-Cdebug-assertions=no
--cache_test_results=no --test_output=errors --test_arg=--test
//codex-rs/cli:codex-help-bench`

## Stack

1. [#31295 bench: add codex help e2e
macrobenchmark](https://github.com/openai/codex/pull/31295)
2. [#31428 bench: add e2e benchmark
entrypoints](https://github.com/openai/codex/pull/31428)
3. [#31429 ci: smoke Bazel e2e
benchmarks](https://github.com/openai/codex/pull/31429)
This commit is contained in:
Adam Perry @ OpenAI
2026-07-09 17:23:44 -07:00
committed by GitHub
parent b45fef0774
commit ff672e8e61
5 changed files with 98 additions and 0 deletions
+6
View File
@@ -1,5 +1,6 @@
load("//:defs.bzl", "MACOS_WEBRTC_RUSTC_LINK_FLAGS", "codex_rust_crate")
load("//bazel/platforms:release_binaries.bzl", "multiplatform_binaries")
load("//bazel/rules:e2e_benchmark.bzl", "codex_e2e_benchmark")
codex_rust_crate(
name = "cli",
@@ -13,3 +14,8 @@ codex_rust_crate(
multiplatform_binaries(
name = "codex",
)
codex_e2e_benchmark(
name = "codex-help",
binaries = [":codex"],
)
+5
View File
@@ -104,3 +104,8 @@ predicates = { workspace = true }
pretty_assertions = { workspace = true }
sqlx = { workspace = true }
wiremock = { workspace = true }
[package.metadata.cargo-shear]
# These Rust sources are intentionally Bazel-only macrobenchmarks rather than
# Cargo targets.
ignored-paths = ["e2e_benches/*.rs"]
+26
View File
@@ -0,0 +1,26 @@
#![allow(clippy::expect_used)]
use std::process::Command;
use divan::Bencher;
fn main() {
divan::main();
}
/// Exercises the Bazel-backed end-to-end benchmark path with a cheap,
/// deterministic Codex invocation. Richer scenarios can add separate
/// benchmark binaries without making the shared harness depend on them.
#[divan::bench(sample_count = 20, sample_size = 1)]
fn codex_help(bencher: Bencher) {
let codex = codex_utils_cargo_bin::cargo_bin("codex")
.expect("codex binary should be available through Bazel runfiles");
bencher.bench_local(move || {
let output = Command::new(&codex)
.arg("--help")
.output()
.expect("codex --help should run");
assert!(output.status.success(), "codex --help should succeed");
});
}