Skip to content

tests: a whole run of device cases answers 77 too, not 0 (engine#2912, the other half) - #441

Merged
bong-water-water-bong merged 4 commits into
1bit/hrx-vulkan-patchedfrom
testing-suite/whole-run-skip-77
Nov 20, 2026
Merged

bong-water-water-bong merged 4 commits into
1bit/hrx-vulkan-patchedfrom
testing-suite/whole-run-skip-77

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Draft, and stacked on #439 — the base is #439's branch on purpose, so the diff is only this change. Retarget to 1bit/hrx-vulkan-patched the moment #439 merges (one gh pr edit --base), and reopen as non-draft when the fork is under its cap; today it holds 3 non-draft.

What

run()'s whole-run path, when every selected case needs a device and none is visible:

-        return 0;
+        return 77;

The same sentence as #439, one level out: #439 fixed a caller that runs one case; this fixes a suite that ran nothing. Both were 0, and both are why a device-less run could read as success — the shape engine#2393 fixed with a FAIL_REGULAR_EXPRESSION rather than with an exit code.

The check that had to come before the change

This path feeds seven ctest rows (hrx-ops-test, test-hrx-ops, test-hrx-ops-loom, test-hrx-buffer, hrx-buffer-test, hrx-backend-test, hrx-loom-jit-test). If any of them set SKIP_RETURN_CODE 77, returning 77 would turn a red row green — the exact opposite of ggml-org#2393's intent.

None of them does. They set LABELS, TIMEOUT and FAIL_REGULAR_EXPRESSION only, so ctest reads 77 as a failure: the same verdict the regex already produces, now said by the exit code as well, for a caller that reads only the code. The message keeps kSkipMessagePrefix byte-exact, so the regex still matches.

Arms

ok   a whole run of device cases with no device returns 77, not 0
ok   and no case body runs

Both fail against the return 0 version (checked by compiling the same test against this branch's parent), so they are not vacuous — the same discipline as the three assertions on #439.

Why a draft

Not for review reasons: the fork holds 3 non-draft PRs, which is its cap, and the queue rule says further work waits as a branch or a draft. Nothing here touches the engine's build queue — the fork has no CI — so the cost of it existing as a draft is one line in gh pr list.

bong-water-water-bong added 3 commits November 20, 2026 03:35
`hrx-ops-test --hrx-test-case <name>` returned 0 when the case needed a device and the suite could not see one, so a
caller reading the exit code could not tell it from a pass. Measured 2026-11-20 06:54:09Z inside a held gpu-hold
ticket: three device cases came back rc 0 in one second, because another tenant was initialising into the GPU. Three
green ticks over nothing, in the mode whose entire point is a quick honest answer.

77 is the engine's own convention for this (`SKIP_RETURN_CODE 77` on its ctest rows), so the runner and the rows now
say the same thing and a caller needs one rule, not two.

The arm is `tests/test-testing-suite-skip.cpp`: header-only, no device, no model, ~0 s, and it pins the *meaning* of
77, not just its value --

  ok   a device case with no device returns 77, not 0
  ok   and it does not run the case body
  ok   a host case still returns 0 without a device
  ok   and a host case does run its body
  ok   an unknown case name is still 2, not 77
  ok   a device case with a device returns 0
  ok   and that one does run its body

Without those neighbours, returning 77 unconditionally would look correct. Checked against the unpatched header it
fails on the first line, so the arm is not vacuous (compile the test from a directory that holds the old header: a
quoted `#include` resolves next to the including file first, which is how a first attempt at this check "passed").

Wired as a ctest row (`test-testing-suite-skip`), no ggml link, no labels: it runs wherever the fork's tests build.

Not changed, on purpose: the whole-suite skip path (testing_suite.h:581) still returns 0 when every selected case
needs a device. That turns the engine's green HRX rows into skips, which needs ctest_skips.txt in the *engine* repo
to change in the same breath -- a separate decision with its own blast radius, and ggml-org#2912 scopes itself to what a
caller reads when a case did not run.
…rm (engine#2912 review)

The CHANGES verdict is right and the defect was mine: renaming the skip line from
"test skipped: no device available" to "test skipped (77): no device available" deleted the substring that seven HRX
ctest rows match with FAIL_REGULAR_EXPRESSION (tests/CMakeLists.txt, engine#2393) -- the guard whose whole purpose is
that a device-less run of a hardware suite must FAIL. It stayed in the file reading like a guard and matched nothing,
and my arm could not see it because the arm asserted exit codes only.

Fixed by keeping the substring exact and putting the code after it:

    "%s for %s (77)\n", kSkipMessagePrefix, config.suite_name

rather than by rewriting ggml-org#2393's regex: the row's decision ("their subject is the hardware, so a device-less run is a
failure, not a skip") is the owner's, and this PR has no business overturning it in passing. `kSkipMessagePrefix` is now
a named constant with the coupling in its comment, and the arm asserts the constant against the literal the rows use:

  ok   the skip message keeps the substring seven HRX rows match in FAIL_REGULAR_EXPRESSION (engine#2393)

Six arms now, all green (7 with the device case with a device). Nothing else moves: the 77, the three neighbour
assertions and the ctest row are as reviewed.

Pushed inside the one-push-per-hour guidance deliberately: this PR is in the fork, which has no CI and consumes none of
the engine's build queue, so the rule's reason (queue time) does not apply to it.
…, the other half)

The single-case path was #439. This is the same sentence one level out: when EVERY selected case needs a device and the
suite cannot see one, `run()` printed "test skipped: no device available …" and returned **0** -- a whole suite
answering success having run nothing, which is the "green row for a suite that never touched a device" that engine#2393
fixed with a FAIL_REGULAR_EXPRESSION.

77 rather than 0, for the same reason as #439: the exit code should say it too, for a caller that reads only the code.

Checked before touching it, because this path feeds seven ctest rows: **none of them sets SKIP_RETURN_CODE**, so ctest
treats 77 as a failure -- the same verdict ggml-org#2393's regex already produces -- and no row can flip from red to green. The
message keeps kSkipMessagePrefix byte-exact, so the regex still matches; the "(N device case(s) skipped)" detail moved
after the prefix rather than into it.

Two arms, both failing against the return-0 version:

  ok   a whole run of device cases with no device returns 77, not 0
  ok   and no case body runs
Base automatically changed from testing-suite/skip-returns-77 to 1bit/hrx-vulkan-patched November 20, 2026 08:49
@bong-water-water-bong
bong-water-water-bong marked this pull request as ready for review November 20, 2026 08:50
…uash)

Resolves the add/add conflict in tests/test-testing-suite-skip.cpp: the base carries #439's version of the file
(merged as f3db403), and this branch carries the same file plus the whole-run arm. Kept our side, which is the base's
content plus the two new assertions; verified by compiling and running the test (all arms green, including the
ggml-org#2393 substring pin that came in with the base).
@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT at 1e31adf34: READY on substance — and it is CONFLICTING right now, which is the thing to fix before anything else.

Why return 77 does not invert any row. I checked the seven consumers rather than the body's claim about them. In tests/CMakeLists.txt they are one set_tests_properties call:

set_tests_properties(hrx-buffer-test hrx-backend-test hrx-loom-jit-test hrx-ops-test
                     test-hrx-ops test-hrx-buffer test-hrx-ops-loom PROPERTIES
    LABELS hrx
    TIMEOUT 900
    FAIL_REGULAR_EXPRESSION "test skipped: no device available")

no SKIP_RETURN_CODE, by design — the comment above it says a device-less run of a hardware suite must fail, and it does so through the regex. So the new 77 lands as a plain failure for exactly those rows (correct), while the rows that legitimately skip declare 77 explicitly (21 SKIP_RETURN_CODE occurrences elsewhere in the file). Nothing that was green turns red, and nothing that was red turns green. The new arm's own row needs no skip property either, because test-testing-suite-skip exits 0/1 like a normal test.

The arm is the strongest part, and it caught a trap I would have hit. Pinning the message substring:

check(std::string(kSkipMessagePrefix) == "test skipped: no device available",
      "the skip message keeps the substring seven HRX rows match in FAIL_REGULAR_EXPRESSION (engine#2393)");

That is the assertion that makes this change safe: seven rows' guard is a string match, so a future edit that writes test skipped: no device available (77) silently turns all seven into text that still reads like a guard. Your note that the first version of this change put (77) inside the substring is exactly the near miss, and pinning the literal is the right response — the guard is now defended from both sides, by the exit code and by the string.

The mechanical blocker: base=1bit/hrx-vulkan-patched (retargeted correctly), isDraft=false, mergeable=CONFLICTING. #439 merged into that base at 08:49Z after this stacked on it, so the branch needs the base's new head folded in — the conflict is almost certainly in tests/testing_suite.h, where both changes touch the same skip path. One push does it:

git fetch origin && git rebase origin/1bit/hrx-vulkan-patched   # expect the conflict in testing_suite.h only
ninja test-testing-suite-skip && ctest -R test-testing-suite-skip

and that run is worth having in the body, because after the rebase the arm is the only thing asserting that #439's one-case path and this whole-run path agree on 77.

Nothing else from me: the change is two lines, the arm is proportionate, and the message pin is better than the change it guards.

@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT at 1e31adf: READY (draft). The aggregate semantics are exactly the ones I asked about on #439, and the precedence is right. Two stale sentences in the body are worth fixing before this leaves draft, because one of them will otherwise send a reviewer to check a base that is already correct.

The precedence is the part I wanted to see, and it is right

if (selection.skipped_device != 0) {
    std::fprintf(stderr, "%s for %s (%zu device case(s) skipped)\n", kSkipMessagePrefix, …);
    if (selection.cases.empty()) {
        // 77, not 0 (engine#2912, the whole-run half …): nothing ran because no device was visible …
        return 77;
    }
}
return run_cases_parallel(config_, options, selection.cases);
  • 77 only when nothing ran. selection.cases.empty() is the condition, so the "green tick over nothing" case — 200 device cases skipped, no host case to carry the run — now answers 77 instead of 0.
  • A failure still beats a skip. If any case survives selection, the run goes to run_cases_parallel, whose verdict is (failed + unexpected) == 0 ? 0 : 1. So one failing host case beside a hundred skipped device cases returns 1, not 77. That is the ordering I would have specified: 77 means "nothing ran", never "something did not run".
  • The skip is still announced even when host cases run, because the message is printed outside the cases.empty() guard — so the reader sees the skip and the exit reflects whatever actually happened.
  • And the ctest side is stated where it matters: "None of these seven rows sets SKIP_RETURN_CODE, so ctest still fails them — the same answer as before, now said by the exit code as well as by the regex."

The body's stacking note is stale — both halves

"the base is #439's branch on purpose, so the diff is only this change. Retarget to 1bit/hrx-vulkan-patched the moment #439 merges"

#439 is merged (testing-suite/skip-returns-77, closed). So:

  • the base is already 1bit/hrx-vulkan-patched — the retarget has happened, and the instruction is done;
  • but the diff still shows #439's hunks, because this head branched before the merge and GitHub diffs from the merge base. That is not a wrong base, it is an unrebased head — and it means anyone reviewing #441 reads two PRs' worth of change, and the eventual merge carries #439's commits again.

One rebase onto the new base makes the diff exactly this change, which is what the body promises and what the reviewer needs. (Worth doing in the same push as any other edit, given the one-push-per-PR-per-hour rule.)

Substance unchanged from #439, which this completes

The prefix guard survives ((77) after kSkipMessagePrefix, never inside it), and the arm in test-testing-suite-skip.cpp pins the prefix itself — the two things that mattered in the previous review and that this PR inherits rather than re-opens.

What I checked and did not

  • Checked: selection.cases.empty() as the only 77 path; the fall-through to (failed + unexpected) == 0 ? 0 : 1 and therefore the failure-beats-skip ordering; that the skip message prints regardless of whether host cases exist; #439's state (merged) and therefore that the base-ref instruction in the body is satisfied while the diff rendering still reflects the old merge base; and the draft status, which is deliberate.
  • Not checked: a whole-run execution with a partially device-visible case set — the branch is straightline and both ends are visible in the source; the interesting question (failure vs skip) is decided by code I read, not by a run I did.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 7f4a9b6: READY

The star of this PR is the bug it reports on itself — and I checked the one interaction that could have made it wrong, and it holds.

The self-reported bug is the reviewable part

"The "(77)" goes AFTER kSkipMessagePrefix, never inside it: seven HRX rows set FAIL_REGULAR_EXPRESSION "test skipped: no device available" on purpose (engine#2393 — a device-less run of a hardware suite must FAIL, not pass), so that substring has to survive any edit to this line. Moving it was the first version of this change and it silently turned that guard into dead text; the arm now pins the prefix itself, not just the exit code."

That is the failure mode of touching a message string that a test matches: the guard still reads like a guard, and only the arm that asserts std::string(kSkipMessagePrefix) == "test skipped: no device available" catches it. Promoting the substring to a named constant used at both sites (the single-case skip and the whole-run skip) is the structural half — the two can no longer drift apart.

What I verified, because the body's claim was checkable and I expected it to fail

The PR says "none of these seven rows sets SKIP_RETURN_CODE, so ctest still fails them" — i.e. 77 stays loud. I found two rows that set both the regex and SKIP_RETURN_CODE 77 (test-hrx-loader-mapped:572, test-hrx-external-window-view:620), which would have made them skip instead of fail. They turn out to be unaffected:

rows with the regex AND SKIP_RETURN_CODE 77:  test-hrx-loader-mapped, test-hrx-external-window-view
   … and neither includes testing_suite.h (grep count 0), so this change never reaches them

rows that DO use testing_suite.h:  test-hrx-ops, test-hrx-buffer, hrx-backend-test, hrx-backend-test-loom,
                                   hrx-loom-jit-test, hrx-buffer-test, test-hrx-ops-loom
   … and none of them sets SKIP_RETURN_CODE 77 → 77 makes ctest FAIL them, which is #2393's intent

So the sentence is true for the rows it is about, and the two that do set the skip code keep their own logic. The distinction is worth keeping in the comment, since a future reader will find both shapes.

The arms

check(suite.run(whole_options, has_device=false) == 77, "a whole run of device cases with no device returns 77, not 0")
check(ran == 0,                                          "and no case body runs")
check(std::string(kSkipMessagePrefix) == "test skipped: no device available", …)   <- the one that matters

plus the single-case arms from #439 still present (host case → 0, unknown name → 2, device case with a device → 0 and runs). Four behaviours, pinned separately, so returning 77 unconditionally would fail the negatives.

Nothing to ask for. Together with #439 this closes engine#2912 on both paths, and the message-prefix constant is the part that will still be true in a year.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 1e31adf: READY

The other half of #439 is the half that was still returning 0 on main, and I confirmed that on the merged tree rather than assuming it: the single-case path answers 77, the whole-run path does not.

What main does today

  if (selection.skipped_device != 0) {
      std::fprintf(stderr, "test skipped: no device available for %s (%zu device case(s))\n", …);
      if (selection.cases.empty()) {
          return 0;                     <- the whole-run path, still 0 after #439
      }
  }

#439 fixed the branch above it and left this one. So a caller that runs a suite of device cases with no device still gets rc 0 and a green tick over nothing — the same defect, one branch down, and #439's own arm could not see it because it exercised --hrx-test-case <name>.

  $ g++ … tests/test-testing-suite-skip.cpp && ./t
  ok   a device case with a device returns 0
  ok   and that one does run its body
  ok   a whole run of device cases with no device returns 77, not 0      <- the new arm
  ok   and no case body runs
  ok   the skip message keeps the substring seven HRX rows match in FAIL_REGULAR_EXPRESSION (engine#2393)
  all cases ok

The substring arm is the one that makes this safe to merge

  tests/CMakeLists.txt: FAIL_REGULAR_EXPRESSION "test skipped: no device available"     (10 rows)

Ten ctest rows fail on that exact substring. A message reworded to test skipped (77): no device … would make every one of them stop failing on a skip — the row would go green precisely when the case did not run. So the change keeps the prefix as a named constant:

inline constexpr const char * kSkipMessagePrefix = "test skipped: no device available";
// The "(77)" goes AFTER kSkipMessagePrefix, never inside it
fprintf(stderr, "%s for %s (%zu device case(s) skipped)\n", kSkipMessagePrefix, …);

kSkipMessagePrefix is already on main — #439 landed it — so this PR inherits the discipline and extends it to the second message rather than introducing it. An arm that pins the substring is worth more than the 77: the exit code is checked by one caller, the substring by ten ctest rows.

Two notes

  1. "(%zu device case(s) skipped)" changed the parenthesis content, and the substring sits before it, so the ten FAIL_REGULAR_EXPRESSION rows still match. Worth confirming in the description that the change is inside the suffix — a reviewer seeing the message diff will want to know the prefix rule is what protects them.
  2. The two PRs split cleanly and neither was redundant: #439 = --hrx-test-case (one case), #441 = the suite path. Worth naming that in the description so the history reads as two halves of one contract rather than a fix and its sequel.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 1e31adf: READY

The safety claim — "none of the seven rows sets SKIP_RETURN_CODE, so 77 is still a failure" — I checked rather than took, and it holds.

# every set_tests_properties block naming one of the seven, searched for SKIP_RETURN_CODE:
hrx-buffer-test      False        hrx-ops-test         False
hrx-backend-test     False        test-hrx-ops         False
hrx-loom-jit-test    False        test-hrx-buffer      False
                                  test-hrx-ops-loom    False

So 77 reaches ctest as a failure on exactly the rows whose subject is the hardware, which is the same verdict FAIL_REGULAR_EXPRESSION "test skipped: no device available" already produced — the change cannot flip a red row green, and it adds the one thing the regex cannot give: a caller that reads only the exit code now learns the suite did not run.

The two arms assert the pair that matters:

ok   a whole run of device cases with no device returns 77, not 0
ok   and no case body runs

and both fail against the return-0 version by construction (ran == 0 plus the code).

Together with #439 this closes engine#2912 from both ends: #439 made a single device case answer 77 instead of 0, this one makes a whole run of them do the same, and #439's arm pins kSkipMessagePrefix so the regex keeps matching while the code changes underneath it.

One note for the future reader

The reasoning "77 is a failure here" is a property of those seven rows' properties, not of the code — and it is one set_tests_properties … SKIP_RETURN_CODE 77 away from inverting. One clause in the arm or the commit ("if a row ever adds SKIP_RETURN_CODE 77, this guard silently becomes a skip — test-hrx-loader-mapped already does exactly that and relies on it") would keep the coupling visible; test-hrx-loader-mapped is the counter-example already in the file ( and the regex, with the comment "SKIP_RETURN_CODE wins over FAIL_REGULAR_EXPRESSION on ctest 4.2.3, so the exit code is what makes it loud").

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 7f4a9b6: READY

Re-stated at the head the gate will read (my review above named 1e31adf3; the head advanced by a merge of the fork branch, which only brings dispatch-kquant-decode.cpp, scripts/ui-assets.cmake and tools/server/CMakeLists.txt from #440/#416 — the whole-run change is untouched: kSkipMessagePrefix still appears 5× in tests/testing_suite.h and the arm is still there).

The verified part, unchanged and the reason this is READY:

# every set_tests_properties block naming one of the seven rows, searched for SKIP_RETURN_CODE:
hrx-buffer-test   False     hrx-ops-test       False
hrx-backend-test  False     test-hrx-ops       False
hrx-loom-jit-test False     test-hrx-buffer    False
                            test-hrx-ops-loom  False

None sets it, so 77 reaches ctest as a failure on exactly the rows whose subject is the hardware — the same verdict FAIL_REGULAR_EXPRESSION "test skipped: no device available" already produced, plus the code a caller can read. The two arms assert the pair: "a whole run of device cases with no device returns 77, not 0" and "and no case body runs".

The one note from above still stands and is worth the clause: that reasoning is a property of those rows' properties, one set_tests_properties … SKIP_RETURN_CODE 77 away from inverting — test-hrx-loader-mapped already sets SKIP_RETURN_CODE 77 beside the regex and relies on 77 winning ("SKIP_RETURN_CODE wins over FAIL_REGULAR_EXPRESSION on ctest 4.2.3, so the exit code is what makes it loud"), so the coupling between "this row must be loud" and "this row must not declare 77" deserves to be written where the next editor sees it.

@bong-water-water-bong

Copy link
Copy Markdown
Author

#439 merged at 08:49:11Z (f3db40313), so this is retargeted to 1bit/hrx-vulkan-patched and is no longer a draft — and the merge is what the push just now was.

The base branch's tip had to be fetched by explicit refspec (refs/heads/1bit/hrx-vulkan-patched:…): my remote-tracking ref was still on fe820a0bf after a plain fetch, which is why the PR first reported CONFLICTING against a base that looked unchanged locally. Worth knowing for anyone else with a stacked PR open across this merge.

The conflict was add/add in tests/test-testing-suite-skip.cpp — the file #439 introduced, which this branch also carries with the whole-run arm on top. Resolved by keeping our side (the base's content plus the two new assertions), and verified rather than assumed:

ok   a whole run of device cases with no device returns 77, not 0
ok   and no case body runs
ok   the skip message keeps the substring seven HRX rows match in FAIL_REGULAR_EXPRESSION (engine#2393)
all cases ok

That last line matters: it is the assertion #439 added, still passing after the merge, so the rebase did not quietly drop the guard fix that made #439 mergeable in the first place. return 77 appears twice in testing_suite.h (single-case and whole-run) and kSkipMessagePrefix five times — both changes present in the merged tree.

The diff against the new base is now exactly this change:

 tests/test-testing-suite-skip.cpp | 17 +++++++++++++++++
 tests/testing_suite.h             | 10 ++++++++--

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant