mirror of
https://github.com/openai/codex.git
synced 2026-08-23 13:09:46 +00:00
[docs] Revert extra changes from PR 17848 (#18003)
## Summary 1. Revert https://github.com/openai/codex/pull/17848 so the Bazel and `BUILD` file changes leave `main`. 2. Prepare for a narrower follow up that restores only `SECURITY.md`. ## Validation 1. Reviewed the revert diff against `main`. 2. Ran a clean diff check before push.
This commit is contained in:
54
defs.bzl
54
defs.bzl
@@ -137,13 +137,10 @@ def codex_rust_crate(
|
||||
rustc_env = {},
|
||||
deps_extra = [],
|
||||
integration_compile_data_extra = [],
|
||||
integration_test_tags_extra_by_stem = {},
|
||||
integration_test_flaky_by_stem = {},
|
||||
integration_test_args = [],
|
||||
integration_test_timeout = None,
|
||||
test_data_extra = [],
|
||||
test_tags = [],
|
||||
unit_test_args = [],
|
||||
unit_test_timeout = None,
|
||||
extra_binaries = []):
|
||||
"""Defines a Rust crate with library, binaries, and tests wired for Bazel + Cargo parity.
|
||||
@@ -173,9 +170,6 @@ def codex_rust_crate(
|
||||
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_test_flaky_by_stem: Mapping from `tests/*.rs` stem to exact
|
||||
Rust test names that should be split into dedicated flaky targets
|
||||
and skipped from the main integration test target.
|
||||
integration_test_args: Optional args for integration test binaries.
|
||||
integration_test_timeout: Optional Bazel timeout for integration test
|
||||
targets generated from `tests/*.rs`.
|
||||
@@ -276,8 +270,6 @@ def codex_rust_crate(
|
||||
unit_test_kwargs = {}
|
||||
if unit_test_timeout:
|
||||
unit_test_kwargs["timeout"] = unit_test_timeout
|
||||
if unit_test_args:
|
||||
unit_test_kwargs["args"] = unit_test_args
|
||||
|
||||
workspace_root_test(
|
||||
name = name + "-unit-tests",
|
||||
@@ -313,9 +305,11 @@ def codex_rust_crate(
|
||||
binary = Label(binary_label).name
|
||||
cargo_env["CARGO_BIN_EXE_" + binary] = "$(rlocationpath %s)" % binary_label
|
||||
|
||||
integration_test_base_kwargs = {}
|
||||
integration_test_kwargs = {}
|
||||
if integration_test_args:
|
||||
integration_test_kwargs["args"] = integration_test_args
|
||||
if integration_test_timeout:
|
||||
integration_test_base_kwargs["timeout"] = integration_test_timeout
|
||||
integration_test_kwargs["timeout"] = integration_test_timeout
|
||||
|
||||
for test in native.glob(["tests/*.rs"], allow_empty = True):
|
||||
test_file_stem = test.removeprefix("tests/").removesuffix(".rs")
|
||||
@@ -323,18 +317,6 @@ def codex_rust_crate(
|
||||
test_name = name + "-" + test_file_stem.replace("/", "-")
|
||||
if not test_name.endswith("-test"):
|
||||
test_name += "-test"
|
||||
extra_test_tags = integration_test_tags_extra_by_stem.get(test_file_stem, [])
|
||||
flaky_tests = integration_test_flaky_by_stem.get(test_file_stem, [])
|
||||
stem_integration_test_args = [] + integration_test_args
|
||||
for flaky_test in flaky_tests:
|
||||
stem_integration_test_args += [
|
||||
"--skip",
|
||||
flaky_test,
|
||||
]
|
||||
|
||||
integration_test_kwargs = dict(integration_test_base_kwargs)
|
||||
if stem_integration_test_args:
|
||||
integration_test_kwargs["args"] = stem_integration_test_args
|
||||
|
||||
rust_test(
|
||||
name = test_name,
|
||||
@@ -356,32 +338,6 @@ def codex_rust_crate(
|
||||
# `INSTA_WORKSPACE_ROOT="codex-rs"` is tuned for unit tests that
|
||||
# execute from the repo root and can misplace integration snapshots.
|
||||
env = cargo_env,
|
||||
tags = test_tags + extra_test_tags,
|
||||
tags = test_tags,
|
||||
**integration_test_kwargs
|
||||
)
|
||||
|
||||
for flaky_test in flaky_tests:
|
||||
flaky_test_suffix = flaky_test.replace("::", "-").replace("/", "-").replace("_", "-")
|
||||
flaky_test_kwargs = dict(integration_test_base_kwargs)
|
||||
flaky_test_kwargs["args"] = [
|
||||
"--exact",
|
||||
flaky_test,
|
||||
]
|
||||
|
||||
rust_test(
|
||||
name = test_name.removesuffix("-test") + "-flaky-" + flaky_test_suffix + "-test",
|
||||
crate_name = test_crate_name + "_flaky_" + flaky_test.replace("::", "_").replace("/", "_").replace("-", "_"),
|
||||
crate_root = test,
|
||||
srcs = [test],
|
||||
data = native.glob(["tests/**"], allow_empty = True) + sanitized_binaries + test_data_extra,
|
||||
compile_data = native.glob(["tests/**"], allow_empty = True) + 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=",
|
||||
"--remap-path-prefix=codex-rs=",
|
||||
],
|
||||
rustc_env = rustc_env,
|
||||
env = cargo_env,
|
||||
tags = test_tags + extra_test_tags + ["flaky"],
|
||||
**flaky_test_kwargs
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user