hub v0.137.0 source + burn-down round 2 in felhom.eu: R-277 R-581 R-600 R-544 R-855 R-134 R-92 R-292 R-599 R-725 R-728 (hub), R-819 R-857 R-555 R-364 R-587 (gates/tools), R-571 R-129 R-124-runbook (docs); 28 rows closed incl. catalog + agent v0.147.0 rows, R-350 merged into R-132, R-888 opened, R-887 mechanism (249 -> 222)
gates / gates (push) Successful in 2m3s
gates / gates (push) Successful in 2m3s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""R-725: every console banner felhom-bootstrap.sh paints uses only glyphs the console font draws.
|
||||
|
||||
The box console loads a Latin-2 font (Lat2-Terminus16 and friends, set_console_font). A glyph outside it is
|
||||
drawn as something else: the linked banner ended in "✔", and the household saw "a doboz össze van kötve. V".
|
||||
This test reads every printf literal in the script and the banner goldens the ISO harness compares against,
|
||||
and refuses any character outside ASCII + the Hungarian letters + the em dash (which the banners already use
|
||||
and which renders). Pure file reads: runs on the BusyBox CI runner.
|
||||
Run: python3 scripts/iso/test/test_console_glyphs.py"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
ISO = os.path.dirname(HERE)
|
||||
ALLOWED_NON_ASCII = set("áéíóöőúüűÁÉÍÓÖŐÚÜŰ—")
|
||||
PRINTF = re.compile(r"""printf\s+(?:'([^']*)'|"([^"]*)")""")
|
||||
|
||||
|
||||
def bad_glyphs(text):
|
||||
return sorted({c for c in text if ord(c) > 127 and c not in ALLOWED_NON_ASCII})
|
||||
|
||||
|
||||
def main():
|
||||
failures, checked = [], 0
|
||||
script = os.path.join(ISO, "felhom-bootstrap.sh")
|
||||
with open(script, encoding="utf-8") as fh:
|
||||
for n, line in enumerate(fh, 1):
|
||||
for m in PRINTF.finditer(line):
|
||||
checked += 1
|
||||
bad = bad_glyphs(m.group(1) or m.group(2) or "")
|
||||
if bad:
|
||||
failures.append("felhom-bootstrap.sh:%d: %s" % (n, " ".join(bad)))
|
||||
gdir = os.path.join(HERE, "golden")
|
||||
goldens = sorted(f for f in os.listdir(gdir) if f.endswith(".txt"))
|
||||
for g in goldens:
|
||||
with open(os.path.join(gdir, g), encoding="utf-8") as fh:
|
||||
bad = bad_glyphs(fh.read())
|
||||
if bad:
|
||||
failures.append("golden/%s: %s" % (g, " ".join(bad)))
|
||||
# Scope is a fact: a reader that found no banners checked nothing.
|
||||
if checked < 20 or not goldens:
|
||||
print("FAIL: read only %d printf literals and %d goldens — the scope is wrong" % (checked, len(goldens)))
|
||||
return 1
|
||||
# Positive control: the checker convicts the glyph that started this row.
|
||||
if bad_glyphs("a doboz össze van kötve. ✔") != ["✔"]:
|
||||
print("FAIL: the checker does not convict the check-mark glyph")
|
||||
return 1
|
||||
if failures:
|
||||
print("FAIL: console glyphs the Latin-2 font cannot draw (R-725):\n " + "\n ".join(failures))
|
||||
return 1
|
||||
print("OK: %d printf literals + %d goldens use only console-safe glyphs" % (checked, len(goldens)))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user