diff --git a/forgetest/forgetest/suite/setup_burns.py b/forgetest/forgetest/suite/setup_burns.py index 265d608..cc5fd0f 100644 --- a/forgetest/forgetest/suite/setup_burns.py +++ b/forgetest/forgetest/suite/setup_burns.py @@ -176,9 +176,6 @@ def emission_ok(ctx, last, seen): "the result does not record the beam sensor: %s", e) ctx.log("the beam sensor rose %s (seen: %s)", e.get("thermopile_delta"), e.get("beam_sensor_seen")) w = seen.record() - ctx.evidence["emission_seen"] = w - ctx.log("seen from here: LASER_ON count peak %s, tube current peak %s over %d polls", - w["laser_on_max"], w["hv_max"], w["reads"]) ctx.check(w["reads"] > 0, "the test could not read the witnesses from sysfs during the burn") ctx.check((w["laser_on_max"] or 0) > 0, "the kernel's LASER_ON count never read nonzero from here during the burn (%d reads); the " @@ -231,6 +228,12 @@ def burn(ctx, wid, arm, pick, want): last = run_check(ctx, wid, on_prompt, 900, on_poll=seen) finally: ctx.clear_notice() + # What the test read itself goes on record however the burn ends: + # reported dark, failed, timed out, or aborted. + w = seen.record() + ctx.evidence["emission_seen"] = w + ctx.log("seen from here: LASER_ON count peak %s, tube current peak %s over %d polls", + w["laser_on_max"], w["hv_max"], w["reads"]) emission_ok(ctx, last, seen) r = last.get("result") or {} missing = [k for k in want if k not in r] diff --git a/forgetest/tests/test_setup_burns.py b/forgetest/tests/test_setup_burns.py index 7d9e9bc..3dfdc2a 100644 --- a/forgetest/tests/test_setup_burns.py +++ b/forgetest/tests/test_setup_burns.py @@ -314,7 +314,7 @@ class BurnRunTests(unittest.TestCase): def run_test(self, tid): t = catalog.load_suite()[tid] - run = Run("test", t.id, t.title) + run = self.run = Run("test", t.id, t.title) # kept for a run that fails run.unattended = True # the ready gate passes; the arm cue is a notice t.fn(Context(run, None, t)) return run @@ -434,6 +434,9 @@ class BurnRunTests(unittest.TestCase): with self.assertRaises(Failed) as cm: self.run_test("setup.focus") self.assertIn("the tube current never rose", str(cm.exception)) + # what the test read itself is on record beside the daemon's word + seen = self.run.evidence["emission_seen"] + self.assertEqual((seen["laser_on_max"], seen["hv_max"]), (118, 431)) self.assert_found() def test_a_head_off_its_home_fails_before_any_start(self): @@ -469,6 +472,15 @@ class BurnRunTests(unittest.TestCase): self.assert_found() self.assert_restarted_on_found() + def test_a_burn_whose_tube_current_the_test_never_saw_rise_fails(self): + # The LASER_ON count read nonzero from here, and the tube current + # never left zero: the second witness is judged on its own reads. + self.plant("pic/hv_current", "0") + with self.assertRaises(Failed) as cm: + self.run_test("setup.focus") + self.assertIn("tube current never read over %d from here" % setup_burns.HV_ON, str(cm.exception)) + self.assert_found() + def test_a_burn_with_a_silent_beam_sensor_passes(self): # A head whose beam sensor gives no output: the tube current and # LASER_ON saw the beam, so the burn counts. @@ -511,6 +523,7 @@ class BurnRunTests(unittest.TestCase): with self.assertRaises(Aborted): t.fn(Context(run, None, t)) self.assertEqual(self.daemon.aborted, ["laser.focus"]) + self.assertIn("emission_seen", run.evidence) # the test's own reads, on record all the same self.assert_found() self.assert_restarted_on_found()