mirror of
https://github.com/openai/codex.git
synced 2026-10-29 19:08:43 +00:00
Avoid recompiling Bazel integration tests for runtime fixture changes (#57742)
## Why Runtime fixtures and snapshots should not invalidate integration-test compilation. ## What changed Limit integration-test `compile_data` to Rust modules and explicitly declared embedded resources, while keeping all test files available as runtime data. Declare the embedded patch fixture in `exec` and PEM fixtures in `http-client` through `integration_compile_data_extra`. GitOrigin-RevId: 7d76809f9a7defdc40c90dc74d393e84e2c376b8
This commit is contained in:
@@ -3,6 +3,7 @@ load("//:defs.bzl", "codex_rust_crate")
|
||||
codex_rust_crate(
|
||||
name = "exec",
|
||||
crate_name = "codex_exec",
|
||||
integration_compile_data_extra = ["tests/fixtures/apply_patch_freeform_final.txt"],
|
||||
test_shard_counts = {
|
||||
"exec-all-test": 8,
|
||||
},
|
||||
|
||||
@@ -4,4 +4,5 @@ codex_rust_crate(
|
||||
name = "http-client",
|
||||
compile_data = glob(["tests/fixtures/**"]),
|
||||
crate_name = "codex_http_client",
|
||||
integration_compile_data_extra = glob(["tests/fixtures/*.pem"]),
|
||||
)
|
||||
|
||||
@@ -253,7 +253,8 @@ def codex_rust_crate(
|
||||
rustc_env_files: Generated compiler environment files for the library target.
|
||||
deps_extra: Extra normal deps beyond @crates resolution.
|
||||
Typically only needed when features add additional deps.
|
||||
integration_compile_data_extra: Extra compile_data for integration tests.
|
||||
integration_compile_data_extra: Additional compile-time inputs for integration
|
||||
tests, including resources embedded with include_str! or include_bytes!.
|
||||
integration_test_args: Optional args for integration test binaries.
|
||||
unit_test_args: Optional args for the unit test binary.
|
||||
binary_test_target_compatible_with: Platform constraints for binary unit tests.
|
||||
@@ -497,6 +498,10 @@ def codex_rust_crate(
|
||||
integration_test_cargo_env = cargo_env
|
||||
integration_test_cargo_env_runfiles = cargo_env_runfiles
|
||||
integration_test_files = native.glob(["tests/**"], allow_empty = True)
|
||||
|
||||
# Fixtures and snapshots are runtime data. Only Rust modules and explicitly
|
||||
# embedded resources should invalidate integration-test compilation.
|
||||
integration_compile_files = native.glob(["tests/**/*.rs"], allow_empty = True)
|
||||
integration_test_data_extra = [
|
||||
data
|
||||
for data in test_data_extra
|
||||
@@ -585,7 +590,7 @@ def codex_rust_crate(
|
||||
crate_root = test,
|
||||
srcs = [test],
|
||||
data = integration_test_files + integration_test_binaries + integration_test_data_extra,
|
||||
compile_data = integration_test_files + integration_compile_data_extra,
|
||||
compile_data = integration_compile_files + integration_compile_data_extra,
|
||||
deps = all_crate_deps(normal = True, normal_dev = True) + maybe_deps + deps_extra,
|
||||
# Bazel has emitted both `codex-rs/<crate>/...` and
|
||||
# `../codex-rs/<crate>/...` paths for `file!()`. Strip either
|
||||
@@ -626,7 +631,7 @@ def codex_rust_crate(
|
||||
crate_root = test,
|
||||
srcs = [test],
|
||||
data = integration_test_files + integration_test_binaries + integration_test_data_extra,
|
||||
compile_data = integration_test_files + integration_compile_data_extra,
|
||||
compile_data = integration_compile_files + integration_compile_data_extra,
|
||||
deps = all_crate_deps(normal = True, normal_dev = True) + maybe_deps + deps_extra,
|
||||
# Bazel has emitted both `codex-rs/<crate>/...` and
|
||||
# `../codex-rs/<crate>/...` paths for `file!()`. Strip either
|
||||
@@ -702,7 +707,7 @@ def codex_rust_crate(
|
||||
crate_root = test,
|
||||
srcs = [test],
|
||||
data = integration_test_files + integration_test_binaries + integration_test_data_extra,
|
||||
compile_data = integration_test_files + integration_compile_data_extra,
|
||||
compile_data = integration_compile_files + integration_compile_data_extra,
|
||||
deps = all_crate_deps(normal = True, normal_dev = True) + maybe_deps + deps_extra,
|
||||
rustc_flags = rustc_flags_extra + WINDOWS_RUSTC_LINK_FLAGS + [
|
||||
"--remap-path-prefix=../codex-rs=",
|
||||
|
||||
Reference in New Issue
Block a user