Drop the nice(1) dependency from the load test; ship htop on the dev image

The image has no `nice` binary - BusyBox ships renice only - so
motion.step-timing-under-load could not spawn its CPU hog at all. Set the
niceness from the parent with os.setpriority once the child exists, and
assert the value that actually took: a hog left at nice 0 would be a
harsher test than intended, and one left unset must not pass silently.

Add htop to the dev image for bench diagnostics. The release image is
unchanged - it carries neither forgetest nor htop.
This commit is contained in:
ScottW514
2026-08-17 17:02:16 -04:00
parent faaa6cb40b
commit 5a3bd902fe
2 changed files with 17 additions and 3 deletions
+16 -3
View File
@@ -1011,10 +1011,23 @@ def step_timing_under_load(ctx):
load = None load = None
try: try:
# One SCHED_OTHER hog at the same nice as forgectrl's HTTP threads: # One SCHED_OTHER hog at the same nice as forgectrl's HTTP threads:
# the realistic competitor, and the one the fix must outrank. # the realistic competitor, and the one the fix must outrank. The
load = subprocess.Popen(["nice", "-n", "5", "sh", "-c", "while :; do :; done"], # image has no `nice` binary (BusyBox ships renice only), so the
# niceness is applied from here once the child exists, and the value
# that actually took is recorded - a hog left at nice 0 would be a
# harsher test than intended, and one left unset must not pass
# silently.
load = subprocess.Popen(["sh", "-c", "while :; do :; done"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
ctx.log("CPU hog started (pid %d, nice 5)", load.pid) try:
os.setpriority(os.PRIO_PROCESS, load.pid, 5)
hog_nice = os.getpriority(os.PRIO_PROCESS, load.pid)
except OSError as exc:
hog_nice = None
ctx.log("could not set the hog niceness: %s", exc)
ev["hog_nice"] = hog_nice
ctx.check(hog_nice == 5, "CPU hog is at nice %s, expected 5", hog_nice)
ctx.log("CPU hog started (pid %d, nice %s)", load.pid, hog_nice)
with ctx.grbl() as g: with ctx.grbl() as g:
clean_slate(ctx, g) clean_slate(ctx, g)
ctrl0 = cpu_ticks(pid) ctrl0 = cpu_ticks(pid)
@@ -9,6 +9,7 @@ DESCRIPTION = "OpenGlow/ForgeFIRM development image for Glowforge"
IMAGE_INSTALL += " \ IMAGE_INSTALL += " \
forgectrl \ forgectrl \
forgetest \ forgetest \
htop \
" "
# debug-tweaks (passwordless root, root SSH login) belongs ONLY to the dev # debug-tweaks (passwordless root, root SSH login) belongs ONLY to the dev