Probe failures follow the compile branch's transient rules, strict on the native esp8266 job

This commit is contained in:
J. Nick Koston
2026-08-26 23:02:18 -05:00
parent 0266b7f0fb
commit 34daa6138a
4 changed files with 51 additions and 8 deletions
@@ -1878,6 +1878,10 @@ def test_write_project_pch_strict_emits_probe_edge(
)
content = _write_ninja(paths, ccache="/usr/bin/ccache")
assert "pchprobe esphome_pch.h.gch\n flags = " in content
for line in content.splitlines():
if line.startswith("build obj/src/main.cpp.o:"):
assert line.endswith("| esphome_pch.h.gch esphome_pch.probe")
edges = [
line
for line in content.splitlines()
if line.startswith("build obj/src/") and ".cpp.o:" in line
]
assert edges
assert all(line.endswith("| esphome_pch.h.gch esphome_pch.probe") for line in edges)
+26
View File
@@ -903,6 +903,32 @@ def test_prepare_pch_probe_spawn_failure_degrades(
prepare_pch()
def test_prepare_pch_probe_environmental_failures_do_not_latch(
tmp_path: Path,
) -> None:
"""A signal-killed or ENOSPC probe retries next build, no marker."""
from esphome.build_gen.espidf import prepare_pch
for stderr, code in (("", -9), ("fatal: No space left on device", 1)):
dev = _make_pch_device(tmp_path, f"dev_pe{code}")
CORE.build_path = dev
gch = dev / "build" / "esphome_pch.h.gch"
def env_probe(cmd, _gch=gch, _stderr=stderr, _code=code, **kwargs):
if "-fsyntax-only" in cmd:
return subprocess.CompletedProcess(cmd, _code, "", _stderr)
_gch.write_bytes(b"gch")
return subprocess.CompletedProcess(cmd, 0, "", "")
with (
patch.object(CORE, "name", "test"),
patch("esphome.build_helpers.pch.subprocess.run", side_effect=env_probe),
):
prepare_pch()
assert not gch.exists()
assert not (dev / "build" / "esphome_pch.h.gch.failed").exists()
def test_prepare_pch_signal_kill_strict_raises(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None: