mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-27 16:51:12 -07:00
bench: every board-runnable tool ported to the bench page
The remaining bench diagnostics run from forgetest's #bench tab. The tools that also run from a LAN host share scripts/bench/gfbench.py: GF_HOST names a remote machine (host mode, sysfs through ssh, Grbl and forgectrl over the LAN); unset, the tool runs on the board itself (local mode, sysfs directly, everything on 127.0.0.1), which is how the page runs them - with GF_HOST=127.0.0.1, the panel token in GF_TOKEN and their data files under <data>/bench/ (FORGETEST_BENCH_DATA). The helper also reads a machine setting from forgectrl, or from the settings file on the board while forgectrl is stopped. Ported: pwm_sweep / pwm_hold (scope = a takeover; the latch relocked, the write refused if FIRE or LASER_ON reads active), pwm_stream_test (PASS/FAIL exit), flow_characterize, flow_recheck_char, flow_warm_validate and flow_matrix (takeovers: forgectrl owns the thermal hardware, so the page's takeover replaces the tools' own controller stop/restart, whose command line predated the supervisor; results and logs in the bench data directory), flow_sustained, fan_test, temp_calibrate (dry; watch bounded in seconds; the threshold and the coolant conversion from the shared code), flow_escalate_drill (cool_confirm_max_s shortened through forgectrl's settings for the drill and restored; the setting's minimum is the default budget), and live_fire_drills (<drill> [S] [F], all six drills, host from GF_HOST, token from the board). flow_matrix joins the registry. What stays unported cannot run against the machine at all: the two null-sink CI harnesses and the .puls decoder. Runner: a scope tool runs inside the takeover wrapper; the bench environment above is passed to every tool. Tests: test_bench_registry (registry <-> scripts/bench consistency, every ported tool builds its command line, every script compiles, gfbench host/local modes) and the server test (scope tool takeover, the environment reaching the tool). Local mode smoke-run on the bench (temp_calibrate watch, setting, token) from /tmp, removed after. No catalog consequence: bench tools are not image components (dev-only forgetest); the acceptance catalog is unchanged.
This commit is contained in:
@@ -1,20 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Bench drill for the starved-re-check escalation path.
|
||||
|
||||
Runs ON THE BOARD against a controller started with a short
|
||||
confirmation budget (GFCOOL_CONFIRM_MAX_S=45; see the runbook for the
|
||||
manual start line). With the pump off, the job-start check reads
|
||||
Runs ON THE BOARD with the controller running. The cooling engine's
|
||||
confirmation budget (`cool_confirm_max_s`, re-read at every run start)
|
||||
is set to a short value for the drill through forgectrl's settings and
|
||||
restored afterward. With the pump off, the job-start check reads
|
||||
over-limit -> SUSPECT; the cooked stagnant loop then cannot pass the
|
||||
settle gate within 45 s, so the budget expires and the driver must
|
||||
escalate: "COOLANT FLOW FAULT: no clean re-check within 45 s".
|
||||
settle gate within the budget, so it expires and the engine must
|
||||
escalate: "COOLANT FLOW FAULT: no clean re-check within N s".
|
||||
|
||||
Usage: flow_escalate_drill.py [budget_s] (default 60, the setting's minimum)
|
||||
Prints PASS/FAIL and leaves the machine idle: M9 sent, pump on,
|
||||
heater off.
|
||||
heater off, the budget setting as it was.
|
||||
"""
|
||||
import select
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
|
||||
from gfbench import forgectrl_post, setting
|
||||
|
||||
BUDGET_S = int(sys.argv[1]) if len(sys.argv) > 1 else 60
|
||||
T0 = time.monotonic()
|
||||
|
||||
|
||||
@@ -57,6 +63,14 @@ def wait_msg(substrs, deadline):
|
||||
return None
|
||||
|
||||
|
||||
budget_was = setting('cool_confirm_max_s') # None = not set (compiled default)
|
||||
st, body = forgectrl_post('/settings', data={'cool_confirm_max_s': str(BUDGET_S)})
|
||||
if st != 200:
|
||||
log('!! could not set cool_confirm_max_s=%d (POST /settings -> %s %s)' % (BUDGET_S, st, body))
|
||||
s.close()
|
||||
sys.exit(2)
|
||||
log('cool_confirm_max_s=%d for the drill (was %s)' % (BUDGET_S, budget_was or 'unset'))
|
||||
|
||||
ok = True
|
||||
try:
|
||||
time.sleep(0.5)
|
||||
@@ -67,10 +81,19 @@ try:
|
||||
if wait_msg(['FLOW SUSPECT'], el() + 180) is None:
|
||||
log('!! no SUSPECT within 180 s')
|
||||
ok = False
|
||||
elif wait_msg(['no clean re-check within'], el() + 120) is None:
|
||||
log('!! no escalation FAULT within 120 s of the suspect')
|
||||
elif wait_msg(['no clean re-check within'], el() + BUDGET_S + 75) is None:
|
||||
log('!! no escalation FAULT within %d s of the suspect' % (BUDGET_S + 75))
|
||||
ok = False
|
||||
finally:
|
||||
try:
|
||||
if budget_was is None:
|
||||
st, _ = forgectrl_post('/settings', params={'cool_confirm_max_s': ''})
|
||||
else:
|
||||
st, _ = forgectrl_post('/settings', data={'cool_confirm_max_s': str(budget_was)})
|
||||
log('cool_confirm_max_s restored to %s (-> %s)' % (budget_was or 'unset', st))
|
||||
except OSError as e:
|
||||
log('!! could not restore cool_confirm_max_s: %s' % e)
|
||||
ok = False
|
||||
try:
|
||||
s.sendall(b'M9\n')
|
||||
time.sleep(1.0)
|
||||
@@ -83,3 +106,4 @@ finally:
|
||||
log('--- M9 sent, pump on, heater off')
|
||||
|
||||
print('ESCALATION DRILL %s' % ('COMPLETE' if ok else 'FAILED'), flush=True)
|
||||
sys.exit(0 if ok else 1)
|
||||
|
||||
Reference in New Issue
Block a user