Skip to content

Print the reason a failing boot test gives - #108

Merged
scottjones merged 1 commit into
omacom:mainfrom
only21mil:boot-tests-print-fail-reason
Nov 9, 2026
Merged

scottjones merged 1 commit into
omacom:mainfrom
only21mil:boot-tests-print-fail-reason

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

fail() in omarchy-mac-boot/test/base-test.sh prints only its first argument:

fail() { printf 'not ok - %s\n' "$1" >&2; exit 1; }

About 240 calls in the boot tests that use this helper pass a reason as the second argument, often the output under test (fail "..." "$(cat "$test_tmp/err")"). The helper drops it, so a boot test that fails in CI shows only its title. A reviewer can't tell a real regression from a host problem without rerunning the test.

Change

fail() now prints the reason on the lines after the not ok line:

fail() { printf '%s\n' "not ok - $1" "${@:2}" >&2; exit 1; }

The not ok line keeps the bare title, so a search for a test's title still finds it, and a multi-line reason such as a dumped file stays readable. This is how the boot tests that define their own fail() (mac-hid-initramfs-test.sh, mac-vconsole-initramfs-test.sh, mac-plymouth-progress-test.sh) already print a reason. A call without a reason prints exactly what it did before.

omarchy-mac-boot/test/fail-reason-test.sh runs the helpers in a child shell and checks three cases: a failure with a two-line reason prints the title and then the reason, a failure without one prints only its title, and a pass prints only its title.

Scope and approval

One change to the boot tests' shared helper and one new test. No package code, manual text or runtime input changes, so there is no version to bump, no integration test and no cold-boot evidence to collect. No issue tracks this; the fix is small enough to review on its own.

Verification

Base 24430b4, candidate 404698e.

Check Base Candidate
bash omarchy-mac-boot/test/fail-reason-test.sh exit 1, not ok - a failing test prints its reason after its title exit 0, ok - a failing test prints the reason it gives
omarchy-mac-boot/test/all (Arch-like sh, see below) n/a exit 0, 259 ok, 2 skip
Every other boot test, run one by one on base and candidate same output same output (only mktemp paths differ)
shellcheck -x on both files n/a clean
.github/scripts/check-scope n/a passes

The same fixture failure on base and on the candidate:

Before (main): the reason is dropped.

Base: the new test fails, and a failing fixture prints only its title

After (this branch): the reason follows the title.

Candidate: the new test passes, and a failing fixture prints its reason after its title

Not checked

  • The suite ran on Ubuntu, not in CI's Arch container. Ubuntu's /bin/sh is dash, which orders globs without the locale, so update-m1n1-locale-test.sh fails on main too. With bash first on PATH as sh, as on Arch, the whole suite passes. This change doesn't touch that test.
  • Two cases skipped locally: the m1n1 display default (no vercmp off Arch) and the HOOKS takeover case (no OMARCHY_TEST_RUNTIME). CI runs both.

Prior PRs

None. No open or closed PR changes this helper. #92 edited omarchy-mac/test/base-test.sh, a different package's copy, which already prints the reason.

Generated with Claude Opus 5.5 and GPT-6.1 Sol in T3 Code Nightly

fail() in the boot tests' base-test.sh printed only its first argument,
so the reason about 240 calls pass as the second argument, often the
output under test, never reached the CI log. It now prints the reason
on the lines after the title, as the boot tests that define their own
fail() already do, so the TAP line keeps the bare title. A failure
without a reason prints exactly what it did before.

fail-reason-test.sh runs the helpers in a child and checks a failure
with a reason, one without, and a pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

Updates fail() to print reasons after the failure title.

  • Failed boot checks now print their reasons below the title.

No actionable issues were found. Tests were inspected but not run during this review.

Reviews (1) · Last reviewed commit: "omarchy-mac-boot: print the reason a fai..." · Reviewed by Greptile

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Welcome, and thanks for this! It's a really useful change. Printing the reason is format-safe, and a call with no reason prints exactly what it did before. The suite's glob picks up the new test with nothing else to wire in.

@only21mil

Copy link
Copy Markdown
Contributor Author

Note

🤖 Opus 5.5 replying on behalf of Victor.

@scottjones, thank you for the welcome and the review. Confirming that a call with no reason prints exactly what it did before was the check that mattered most, since every existing test depends on that output staying the same.

@scottjones
scottjones merged commit 863a3a1 into omacom:main Nov 9, 2026
4 of 5 checks passed
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.

2 participants