codex: address CI timeout warnings (#28598)

This commit is contained in:
Adam Perry
2026-06-22 18:34:27 +00:00
parent 9d34411aa8
commit 04ba36a8a8
5 changed files with 37 additions and 24 deletions
+1 -4
View File
@@ -17,11 +17,8 @@ codex_rust_crate(
# can cause us to exhaust our CI timeout if the shard happens to run
# long. Using a higher shard count for app-server-all-test should help
# mitigate this risk.
"app-server-all-test": 16,
"app-server-all-test": 32,
"app-server-unit-tests": 8,
},
test_sizes = {
"app-server-all-test-windows-cross": "medium",
},
test_tags = ["no-sandbox"],
)
+2 -5
View File
@@ -44,11 +44,8 @@ codex_rust_crate(
],
test_shard_counts = {
"core-all-test": 16,
"core-unit-tests": 8,
},
test_sizes = {
"core-all-test-windows-cross": "medium",
"core-unit-tests-windows-cross": "medium",
"core-all-test-windows-cross": 32,
"core-unit-tests": 16,
},
test_tags = ["no-sandbox"],
)
+1 -1
View File
@@ -4,7 +4,7 @@ codex_rust_crate(
name = "exec",
crate_name = "codex_exec",
test_shard_counts = {
"exec-all-test": 8,
"exec-all-test": 16,
},
test_tags = ["no-sandbox"],
)
+2 -2
View File
@@ -3,7 +3,7 @@ load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "image",
crate_name = "codex_utils_image",
test_sizes = {
"image-unit-tests-windows-cross": "medium",
test_shard_counts = {
"image-unit-tests": 4,
},
)
+31 -12
View File
@@ -239,7 +239,9 @@ def codex_rust_crate(
The launcher resolves the real Rust test binary through runfiles
and then assigns each libtest case to a stable bucket by hashing
the test name. Matching tests are also marked flaky, which gives
them Bazel's default three attempts.
them Bazel's default three attempts. Windows-cross and Wine
variants inherit the native target's count unless callers
override the generated variant name explicitly.
test_sizes: Mapping from generated test target name to Bazel test size.
All generated tests default to small. Callers can override slower
targets individually, including Windows-cross and Wine tests.
@@ -327,6 +329,9 @@ def codex_rust_crate(
windows_cross_unit_test_name = unit_test_name + "-windows-cross"
generated_test_names.extend([unit_test_name, windows_cross_unit_test_name])
unit_test_shard_count = _test_shard_count(test_shard_counts, unit_test_name)
windows_cross_unit_test_shard_count = _test_shard_count(test_shard_counts, windows_cross_unit_test_name)
if windows_cross_unit_test_shard_count == None:
windows_cross_unit_test_shard_count = unit_test_shard_count
# Shard at the workspace_root_test layer. rules_rust's sharding wrapper
# expects to run from its own runfiles cwd, while workspace_root_test
@@ -352,19 +357,19 @@ def codex_rust_crate(
tags = test_tags + ["manual"],
)
# Keep a distinct Windows-cross label so callers can raise its
# nonconfigurable size without slowing the native test everywhere.
for unit_test_target_name, target_compatible_with in [
(unit_test_name, WINDOWS_GNULLVM_INCOMPATIBLE),
(windows_cross_unit_test_name, WINDOWS_GNULLVM_ONLY),
# Keep a distinct Windows-cross label so callers can tune its
# nonconfigurable test attributes without changing every platform.
for unit_test_target_name, target_compatible_with, shard_count in [
(unit_test_name, WINDOWS_GNULLVM_INCOMPATIBLE, unit_test_shard_count),
(windows_cross_unit_test_name, WINDOWS_GNULLVM_ONLY, windows_cross_unit_test_shard_count),
]:
unit_test_kwargs = {
"size": _test_size(test_sizes, unit_test_target_name),
}
if unit_test_timeout:
unit_test_kwargs["timeout"] = unit_test_timeout
if unit_test_shard_count:
unit_test_kwargs["shard_count"] = unit_test_shard_count
if shard_count:
unit_test_kwargs["shard_count"] = shard_count
unit_test_kwargs["flaky"] = True
workspace_root_test(
@@ -457,6 +462,9 @@ def codex_rust_crate(
}
test_kwargs.update(integration_test_kwargs)
test_shard_count = _test_shard_count(test_shard_counts, test_name)
windows_cross_test_shard_count = _test_shard_count(test_shard_counts, windows_cross_test_name)
if windows_cross_test_shard_count == None:
windows_cross_test_shard_count = test_shard_count
if test_shard_count:
# Put Bazel sharding on the label users/CI invoke. Do not set
# rules_rust's experimental_enable_sharding on the Rust test
@@ -578,8 +586,11 @@ def codex_rust_crate(
wine_test_kwargs = {}
wine_test_kwargs.update(integration_test_kwargs)
wine_test_kwargs["size"] = _test_size(test_sizes, wine_test_name)
if test_shard_count:
wine_test_kwargs["shard_count"] = test_shard_count
wine_test_shard_count = _test_shard_count(test_shard_counts, wine_test_name)
if wine_test_shard_count == None:
wine_test_shard_count = test_shard_count
if wine_test_shard_count:
wine_test_kwargs["shard_count"] = wine_test_shard_count
wine_test_kwargs["flaky"] = True
# The Wine runner is a binary rather than a rust_test, but it still
@@ -601,8 +612,8 @@ def codex_rust_crate(
"size": _test_size(test_sizes, windows_cross_test_name),
}
windows_cross_test_kwargs.update(integration_test_kwargs)
if test_shard_count:
windows_cross_test_kwargs["shard_count"] = test_shard_count
if windows_cross_test_shard_count:
windows_cross_test_kwargs["shard_count"] = windows_cross_test_shard_count
windows_cross_test_kwargs["flaky"] = True
rust_test(
@@ -643,6 +654,14 @@ def codex_rust_crate(
if unknown_test_sizes:
fail("test_sizes contains unknown generated test targets: {}".format(", ".join(unknown_test_sizes)))
unknown_test_shard_counts = sorted([
test_name
for test_name in test_shard_counts
if test_name not in generated_test_names
])
if unknown_test_shard_counts:
fail("test_shard_counts contains unknown generated test targets: {}".format(", ".join(unknown_test_shard_counts)))
def _test_shard_count(test_shard_counts, test_name):
shard_count = test_shard_counts.get(test_name)
if shard_count == None: