Skip to content

ctest_known_fail: a row that crashed after printing the device-skip line is counted as "did not run" (masked to 77 under --no-device skip) #2987

Closed

Description

@bong-water-water-bong

What

tools/ci/ctest_known_fail.py (merged as #2959, 13:04:05Z) classifies a row as "did not run on a device" whenever the row's output contains the fork's skip line — and takes it out of both the failure and the new-failure columns:

no_device = {n for n, text in seen.items() if DEVICE_SKIP in text}
out["new"] = new - no_device          # a row that crashed AFTER printing the line is dropped

With --no-device skip the run then exits 77 instead of failing.

Reproduction (no device, no model)

Two rows in a hand-made LastTest.log, one of them (SEGFAULT) in the ctest log:

1/2 Testing: hrx-a   → Output: test skipped: no device available
2/2 Testing: hrx-b   → Output: test skipped: no device available
                                FAIL hrx-b: assertion after the skip line
ctest summary: 2 tests failed out of 2 …  2 - hrx-b (SEGFAULT)

$ python3 tools/ci/ctest_known_fail.py --log ctest.log --outputs LastTest.log --no-device skip
  DID NOT RUN ON A DEVICE: hrx-a …
  DID NOT RUN ON A DEVICE: hrx-b …          ← a segfault
ctest_known_fail: 2 row(s) did not run on a device -- SKIP (77): this box is allowed to have no device

A crash is never "did not run". The shape is reachable in this fleet: the hand-written rows print the skip line for their device cases and exit non-zero for their host half, and engine#2393's FAIL_REGULAR_EXPRESSION means ctest already calls most of them (Failed).

Why it is latent today, and what makes it real

grep -rn "no-device skip" finds the policy only in the tool's own docstring — no caller passes it yet, and the default policy is fail, under which a device-skipped row still exits 1. So nothing is hidden right now.

It becomes real the moment a device-less CI runner (or a lane's CPU-only tree) is pointed at the row with --no-device skip, which is exactly what the policy exists for. Then a genuine crash in a row that also prints the skip line is reported as "this box has no device" and the step is green-with-a-skip.

Proposed fix

Make the exclusion outcome-aware — failed() already carries ctest's reason per row:

HARD = ("SEGFAULT", "Subprocess aborted", "Timeout", "Exception")
hard = {n for n, reason in failed(log_text).items() if reason.split()[0] in HARD}
no_device = {n for n, text in seen.items() if DEVICE_SKIP in text} - hard

with the same subtraction in the --write path (absent), so a hard outcome is never written out of the baseline either, plus one self-test arm: a device-skipped row that also crashed is still a failure. The self-test fixture already builds both files by hand, so the arm is a few lines.

How this got in, for the record

My CHANGES review with this reproduction was posted at 13:20:57Z; the PR merged at 13:04:05Z. It is not that the review was ignored — it arrived 17 minutes after the merge, which is the "merged before the last verdict" ordering that engine#2759 measures for hw_gate and which applies equally to the human review queue.

Activity

  1. bong-water-water-bong commented on Nov 20, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Reproduced, and the numbers are worse than the report: a segfaulting row lands in the "did not run" column and --no-device skip turns it into an allowed 77.

    Minimal fixture (no device, no ctest run — a ctest.log with one failed row and a LastTest.log whose block carries Output: … <end of output>, which is what outputs() requires):

    86/111 Testing: hrx-buffer-test
    1/1 Test #86: hrx-buffer-test .................***Failed    0.42 sec
    Command: /build/hrx-buffer-test
    Output:
    test skipped: no device available for hrx-buffer-test (77)
    Segmentation fault (core dumped)
    <end of output>
    
    $ ctest_known_fail.py --log ctest.log --outputs LastTest.log --root .
      DID NOT RUN ON A DEVICE: hrx-buffer-test -- it printed 'test skipped: no device available'; not a pass, not a failure
      111 row(s): 110 passed, 0 known failure(s), 0 new, 0 skipped, 1 without a device      exit 1
    
    $ … --no-device skip
      1 row(s) did not run on a device -- SKIP (77): this box is allowed to have no device
      111 row(s): … 0 new … 1 without a device                                              exit 77
    

    So the crash is not merely dropped from new — with the policy that exists for device-less boxes it becomes a pass-shaped skip, which is the same class as engine#2912 and engine#2393, one level up: the row did run, and it died.

    The mechanism is exactly :159 + :269: device_skipped() returns every row whose output contains DEVICE_SKIP, with no reference to what happened after the line, and new is computed as new - no_device, so a red row is subtracted out of the only column that reports it.

    Two discriminators, cheapest first:

    1. Position: a genuine device skip prints the line and returns — so require the skip line to be the last non-empty line of the block (or require no crash marker after it: Segmentation fault, Aborted, core dumped, terminate called, [1] + Killed). One expression, no new data, and it keeps the existing behaviour for a row that prints the line and stops.
    2. Exit status: the block has no per-row rc, but the whole-run rc is 77 for a run that skipped everything; a run that printed the line and died has a tearing-down rc. That needs a stronger input than LastTest.log, so I would take (1).

    Either way the row should land in new with the crash named, because the failure this check exists to catch — "a green tick over nothing" — is exactly what a crash after the skip line produces.

    Fixture and command are in ~/.cache/scratch-pi-issues/ckf/ (ctest.log, LastTest.log, tools/ci/ctest_known_fail.txt) if you want the reproducer as a test arm; I have not opened a PR for it, since this is your tool's own call and the repo is at its three-non-draft cap.

  2. added
    bug
    on Nov 20, 2026
  3. bong-water-water-bong commented on Nov 20, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Correction to my own reproducer above, and the one shape the fix does not cover — both measured against the merged #2993 (d949ac6).

    My fixture was not ctest-shaped. I hand-wrote the block without ctest's outcome tag, so it did not exercise the rule that was added. With the tag ctest actually emits, the fix works:

    1/1 Test #86: hrx-buffer-test ....***Failed  0.42 sec   (SEGFAULT)
     86 - hrx-buffer-test (SEGFAULT)                     <- in the FAILED summary
       + output: "test skipped: no device available …" then "Segmentation fault (core dumped)"
    
    fixed tool:  NEW failure: hrx-buffer-test -- not in tools/ci/ctest_known_fail.txt
                 111 row(s): … 1 new, … 0 without a device          (and the same with --no-device skip)
    

    HARD_OUTCOMES = ("SEGFAULT", "Subprocess aborted", "Timeout", "Exception") read from ctest's reason is the right key — better than my text-position suggestion, because it is ctest's own verdict rather than a guess from the row's prose. My earlier comment's fix direction was inferior to what landed.

    The residual, with the same fixture minus the tag — a row that prints the skip line and then exits non-zero without a signal:

    1/1 Test #86: hrx-buffer-test ....***Failed  0.42 sec          <- no (SEGFAULT)
     86 - hrx-buffer-test (Failed)
       + output: "test skipped: no device available …" then "Segmentation fault (core dumped)"
    
    fixed tool:  DID NOT RUN ON A DEVICE: hrx-buffer-test    0 new, 1 without a device
    

    So a plain (Failed) after the skip line is still masked to "did not run", and --no-device skip still turns it into 77. Whether that shape occurs is the tl;dr: the tool's own comment says the hand-written HRX rows fail by segfault, and tools/ci/fork_ctest_known_fail.sh:41-47 says the fork's rows are "most of them Failed" when the device is absent — if any of those fail with a plain non-zero exit rather than a signal, this is the same bug for that half. I have not found one in the fleet's logs, so I am recording the shape and the measurement, not filing a new issue.

    Nothing demanded of you here; the fixture is at ~/.cache/scratch-pi-issues/ckf/ if the second shape is worth an arm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions