forgectrl pinned at the status-page sys block; panel-serves reads it

The pin picks up /status carrying CPU and memory utilization (sys:
cpu_pct over the interval since the previous read, mem_pct from
MemTotal against MemAvailable) with the panel rows under the board
temperatures. forgectrl.panel-serves now re-reads /status after a
beat and asserts both percents are numbers in range, so the catalog
exercises the new telemetry on the bench.
This commit is contained in:
ScottW514
2026-08-24 07:07:49 -04:00
parent f54d086625
commit a2b391b8f6
2 changed files with 17 additions and 2 deletions
+16 -1
View File
@@ -212,7 +212,9 @@ def settings_bounds(ctx):
covers=[("forgectrl", "src/ui.*"), ("forgectrl", "src/ui/**"), ("forgectrl", "src/status.*"),
("forgectrl", "src/cam.c"), ("forgectrl", "src/main.c")],
description="The panel page is served, /status carries the machine telemetry the panel and "
"the acceptance tool read, and /cam/status answers.")
"the acceptance tool read (including the sys block: CPU busy percent over the "
"interval since the previous read, memory used percent), and /cam/status "
"answers.")
def panel_serves(ctx):
fc = ctx.forgectrl
ev = ctx.evidence
@@ -235,6 +237,19 @@ def panel_serves(ctx):
for key in ("lid", "button", "interlock_ok", "head", "hv_enable"):
ctx.check(key in (s.get("switches") or {}), "/status switches lacks %r", key)
# SoC utilization rides /status next to the temperatures. The CPU
# number is a delta over the interval since the previous read, so
# the read above primes it; after a beat both percents must be
# numbers in range.
ctx.sleep(1)
sys_ = ctx.forgectrl.status().get("sys") or {}
ev["sys"] = sys_
ctx.log("/status sys=%s", sys_)
ctx.check(isinstance(sys_.get("cpu_pct"), (int, float)) and 0.0 <= sys_["cpu_pct"] <= 100.0,
"/status sys.cpu_pct is not a percent: %s", sys_)
ctx.check(isinstance(sys_.get("mem_pct"), (int, float)) and 0.0 < sys_["mem_pct"] < 100.0,
"/status sys.mem_pct is not a percent: %s", sys_)
st, cam = fc.get("/cam/status")
ev["cam_status"] = st
ctx.log("GET /cam/status -> %s %s", st, cam)
@@ -2,5 +2,5 @@
# only SRCREV and PV here - the image manifest leaves *-pin.inc out of the
# layer content hash because the component entry already identifies the
# pinned source (forgefirm-image-manifest.bbclass).
SRCREV = "b27398a393ec2d3fb407cf2ab5f7dfba3dee19d3"
SRCREV = "3acd66425dd53b3a8b16ae175ec442a4d057b9ac"
PV = "0.1.0"