From a2b391b8f66dfb8484e4bcff1bd7d55b7f480c6e Mon Sep 17 00:00:00 2001 From: ScottW514 Date: Mon, 24 Aug 2026 07:07:49 -0400 Subject: [PATCH] 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. --- forgetest/forgetest/suite/forgectrl.py | 17 ++++++++++++++++- .../forgectrl/forgectrl-pin.inc | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/forgetest/forgetest/suite/forgectrl.py b/forgetest/forgetest/suite/forgectrl.py index 3b1348b..2f94b92 100644 --- a/forgetest/forgetest/suite/forgectrl.py +++ b/forgetest/forgetest/suite/forgectrl.py @@ -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) diff --git a/meta-forgefirm/recipes-forgefirm/forgectrl/forgectrl-pin.inc b/meta-forgefirm/recipes-forgefirm/forgectrl/forgectrl-pin.inc index b8004d4..bd55c96 100644 --- a/meta-forgefirm/recipes-forgefirm/forgectrl/forgectrl-pin.inc +++ b/meta-forgefirm/recipes-forgefirm/forgectrl/forgectrl-pin.inc @@ -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"