This commit is contained in:
1 parent
503c93fada
commit
a17db0c3c8
3 files changed
+128
No files matched your search
@@ -110,6 +110,9 @@ COVERS = {
|
||||
"one-register": ("R-426: an open roadmap row whose state NAMES another row's CLOSED (a live hole until "
|
||||
"2026-10-06), its id only in register prose, a suffix id; genuine: a row with a counterpart, "
|
||||
"and an `idea` row (R-424's accepted hole, asserted BY DESIGN)"),
|
||||
"hub-gofmt": ("R-1160: an unformatted .go file in a SCRATCH module dir is convicted by name; its "
|
||||
"formatted twin passes; with no gofmt reachable, CI passes OUT LOUD and a dev machine is "
|
||||
"INCONCLUSIVE, never a silent pass"),
|
||||
"hub-copy": ("R-558: an English retrieval promise in the NEW bundle (the sentences moved "
|
||||
"out of templates.go, so the surface list had to move with them), the same "
|
||||
"in Hungarian, and an INNOCENT control using the identical verbs without the "
|
||||
@@ -1079,6 +1082,45 @@ else:
|
||||
print("ok poster-facts/output-is-ascii")
|
||||
|
||||
|
||||
# --- hub-gofmt (R-1160): the gate on a scratch module dir, never the real hub tree. ----------------------------
|
||||
import tempfile as _tf
|
||||
_gd = _tf.mkdtemp(prefix="hub-gofmt-decoy-")
|
||||
try:
|
||||
os.makedirs(os.path.join(_gd, "internal", "x"))
|
||||
_gp = os.path.join(_gd, "internal", "x", "zz_gofmt_decoy.go")
|
||||
io.open(_gp, "w", encoding="utf-8").write(u"package x\n\nfunc F( ) int {return 1}\n")
|
||||
if shutil.which("gofmt") or shutil.which("go"):
|
||||
ran += 1
|
||||
_rc, _out = gate("hub_gofmt_gate.py", [_gd])
|
||||
if _rc != 1 or "zz_gofmt_decoy.go" not in _out:
|
||||
fails.append("hub-gofmt: an unformatted planted file was not convicted (rc=%d)\n%s" % (_rc, _out[-400:]))
|
||||
else:
|
||||
print("ok hub-gofmt/unformatted-convicted")
|
||||
ran += 1
|
||||
io.open(_gp, "w", encoding="utf-8").write(u"package x\n\nfunc F() int { return 1 }\n")
|
||||
_rc, _out = gate("hub_gofmt_gate.py", [_gd])
|
||||
if _rc != 0:
|
||||
fails.append("hub-gofmt: the formatted twin did not pass (rc=%d)\n%s" % (_rc, _out[-400:]))
|
||||
else:
|
||||
print("ok hub-gofmt/formatted-passes")
|
||||
else:
|
||||
print(" -- hub-gofmt not runnable here (no Go toolchain) — the two cases below pin that mode")
|
||||
for _ci, _want_rc, _want_txt, _name in ((True, 0, "NOT CHECKED in CI", "hub-gofmt/ci-without-go"),
|
||||
(False, 2, "INCONCLUSIVE", "hub-gofmt/dev-without-go")):
|
||||
ran += 1
|
||||
_env = {"PATH": os.path.join(_gd, "empty-path"), "HOME": _gd}
|
||||
if _ci:
|
||||
_env["GITEA_ACTIONS"] = "true"
|
||||
_p = subprocess.run([sys.executable, os.path.join("scripts", "hub_gofmt_gate.py"), _gd], cwd=ROOT, env=_env,
|
||||
capture_output=True, text=True)
|
||||
if _p.returncode != _want_rc or _want_txt not in _p.stdout:
|
||||
fails.append("%s: rc=%d, want %d with %r\n%s" % (_name, _p.returncode, _want_rc, _want_txt, _p.stdout[-300:]))
|
||||
else:
|
||||
print("ok %s" % _name)
|
||||
finally:
|
||||
shutil.rmtree(_gd, ignore_errors=True)
|
||||
|
||||
|
||||
print()
|
||||
if fails:
|
||||
for f in fails:
|
||||
|
||||
Reference in new issue
Block a user