motion.job: measure the job's reach from where the test began

_job_wait read its own starting X when it was called, which is after the
lease wait and three refused requests beside the running job. On image
20260920204744 those took long enough that the head was already 2.55 mm
out, and the test failed with "the kernel saw 17.450 mm of the 20" on a
job whose record said done, 7 of 7 acknowledged, no emission sample, and
the counters back at 0.0. It now takes the caller's X, read before the job
was posted; laser.recorder-dark, the helper's other caller, reads no
distance and passes none.

Proven. On the bench reference with the fixed file over image
20260920204744's: motion.job PASS three times running, laser.recorder-dark
PASS. The file is in image 20260920211625. The unit suite passes (422).

Acceptance. motion.job is the test. The helper is module text, so every
motion.py test's fingerprint moves; no product behavior changes.
This commit is contained in:
ScottW514
2026-09-20 18:02:31 -04:00
parent d627ee32f1
commit 474bf9db09
+7 -4
View File
@@ -2260,9 +2260,12 @@ def _job_post(fc, program, name="forgetest", **fields):
headers={"Content-Type": "multipart/form-data; boundary=%s" % mark})
def _job_wait(ctx, fc, timeout):
"""Until the job is over; the record, and the farthest the kernel saw X go."""
x0 = kernel_xy_mm(ctx)[0]
def _job_wait(ctx, fc, timeout, x0=None):
"""Until the job is over; the record, and the farthest the kernel saw X go
from x0. A caller that reads the distance passes the X it took before it
posted the job: by the time this is called the head is already moving."""
if x0 is None:
x0 = kernel_xy_mm(ctx)[0]
far = 0.0
deadline = time.time() + timeout
while time.time() < deadline:
@@ -2361,7 +2364,7 @@ def job_runner(ctx):
ctx.check(st == 409 and "a job (forgetest) holds the machine" in _words(body),
"%s beside the job -> %s %s", name, st, _words(body)[:160])
ev["refused_beside_the_job"] = beside
rec, far = _job_wait(ctx, fc, 40)
rec, far = _job_wait(ctx, fc, 40, x0)
x1 = kernel_xy_mm(ctx)[0]
ev["dark_job"] = {"record": rec, "farthest_mm": round(far, 3), "kernel": [x0, x1]}
ctx.log("the dark job: %s; the kernel saw %.3f mm out and ended %.3f from the start",