cool_report_test: the homing runner is handed the report secret

The runner case asserted that the homing runner the controller starts
does not inherit GF_REPORT_SECRET. The runner is the reporter while a
gfcloud $H holds the machine (the controller sends no report then), so
the assertion described the defect: every camera home ran with nobody
reporting, and the cooling engine's hung-controller dead-man stopped the
session's first motion.

The case now requires the runner to be handed exactly the controller's
secret, and two new cases require that it be handed none when the
controller was started with no secret (runner-none) or with one that is
not 32 hex digits (runner-malformed). The harness's descriptions in
scripts/bench/README.md and in the bench page's catalog say so.

Proof: all 11 cases pass on the driver that hands the secret over
(grblHAL-glowforge, "gfhome: the homing runner is handed the report
secret"); the driver before it fails the runner case: "the homing
runner was handed [], not '0123456789abcdef0123456789abcdef'".

Acceptance: a host harness in the driver's CI; no catalog test runs it.
forgetest/forgetest/bench.py changes one description string, which no
test judges.
This commit is contained in:
ScottW514
2026-09-25 14:22:50 -04:00
parent ef2390f7d4
commit d40ebb090e
3 changed files with 17 additions and 8 deletions
+14 -6
View File
@@ -16,8 +16,11 @@ the null-sink controller against it, and reads every report as it arrives.
malformed a value that is not 32 hex digits (short, a letter out of range,
a CR LF and a header of its own behind it) is never sent, and
nothing of it reaches the wire
runner the homing runner the controller starts does not inherit the
secret, and the reports still carry it afterwards
runner the homing runner the controller starts is handed the secret (it
reports in the controller's place while a gfcloud $H holds the
machine, and the controller is quiet then), and the reports
still carry it afterwards; a controller with no secret, or with
one that is not 32 hex digits, hands the runner none
Usage: cool_report_test.py <path-to-grblHAL_glowforge>
"""
@@ -125,7 +128,7 @@ class Controller:
shutil.rmtree(self.workdir, ignore_errors=True)
def run(name, secret, check, runner=False):
def run(name, secret, check, runner=False, handed=None):
lis = Listener()
ctl = Controller(lis, secret, runner_cmd=("env > %s" % "RUNNER_ENV") if runner else None)
try:
@@ -142,8 +145,11 @@ def run(name, secret, check, runner=False):
time.sleep(0.3)
with open(env_file) as f:
runner_env = f.read()
if "GF_REPORT_SECRET" in runner_env or SECRET in runner_env:
fail("[%s] the homing runner inherited the report secret" % name)
got = [ln.split("=", 1)[1] for ln in runner_env.splitlines() if ln.startswith("GF_REPORT_SECRET=")]
if got != ([handed] if handed else []):
fail("[%s] the homing runner was handed %r, not %r" % (name, got, handed))
if not handed and SECRET in runner_env:
fail("[%s] the secret reached the homing runner another way" % name)
if "GF_STATE_DIR" not in runner_env:
fail("[%s] the runner's environment was not read: %r" % (name, runner_env[:80]))
s.close()
@@ -184,7 +190,9 @@ def main():
SECRET[:16] + "\r\nX-Evil: 1\r\nX-Pad: 12",
SECRET[:16] + "\r\nX-Evil: 1\r\nX:1"), 1): # the last is 32 long
run("malformed-%d" % i, bad, without)
run("runner", SECRET, with_secret, runner=True)
run("runner", SECRET, with_secret, runner=True, handed=SECRET)
run("runner-none", None, without, runner=True)
run("runner-malformed", SECRET[:16] + "\r\nX-Evil: 1\r\nX:1", without, runner=True)
print("cool_report_test: all passed")