Fix package smoke tests for Cargo and Bazel debug symbols (#51849)

## Why

Cargo and Bazel embed different PDB filenames in the Windows code-mode host executable. The package smoke test must support both names while verifying that the debug symbols match the packaged executable.

## What changed

- Keep the archived PDB and copy it to `codex_code_mode_host.pdb`, allowing `dumpbin /PDBPATH` to resolve either name. Accept either path in the assertion.
- Set `sandbox_workspace_write.writable_roots = []` explicitly in the smoke-test configuration.

GitOrigin-RevId: fc2610f580dad49e38848582bc63f1f829cb766d
This commit is contained in:
Dmitriy Kovalenko
2026-10-07 22:10:49 +00:00
committed by copyberry
parent 745d865521
commit 391bf191c2
2 changed files with 11 additions and 6 deletions
@@ -85,6 +85,7 @@ suppress_unstable_features_warning = true
[sandbox_workspace_write]
network_access = true
writable_roots = []
[features]
code_mode_only = true
@@ -234,11 +234,13 @@ def test_windows_debug_symbols_resolve_packaged_code(
code_mode_host_debug_symbols: Path,
) -> None:
"""Windows host symbols match the packaged executable's debug signature."""
# Rust embeds an underscored PDB name, but release archives normalize it.
symbols = code_mode_host_debug_symbols.rename(
code_mode_host_debug_symbols.with_name("codex_code_mode_host.pdb")
)
host = symbols.with_suffix(".exe")
# Cargo embeds an underscored PDB name; Bazel uses the binary's name.
# Offer the archived PDB under both names so dumpbin still verifies that
# its signature matches the packaged executable, regardless of builder.
cargo_symbols = code_mode_host_debug_symbols.with_name("codex_code_mode_host.pdb")
shutil.copy2(code_mode_host_debug_symbols, cargo_symbols)
symbols = (code_mode_host_debug_symbols, cargo_symbols)
host = code_mode_host_debug_symbols.with_suffix(".exe")
shutil.copy2(package.cli.with_name("codex-code-mode-host.exe"), host)
result = subprocess.run(
["dumpbin", "/PDBPATH", str(host)],
@@ -249,4 +251,6 @@ def test_windows_debug_symbols_resolve_packaged_code(
check=True,
timeout=45,
)
assert str(symbols).casefold() in result.stdout.casefold(), result.stdout
assert any(str(path).casefold() in result.stdout.casefold() for path in symbols), (
result.stdout
)