Skip to content

Actually run the unit tests in CI - #63

Merged
Purple10101 merged 1 commit into
mainfrom
20260915-ci-run-unit-tests
Sep 15, 2026
Merged

Purple10101 merged 1 commit into
mainfrom
20260915-ci-run-unit-tests

Conversation

@Purple10101

Copy link
Copy Markdown

The build-blah2 test job has never executed a single test, and has been reporting success for it.

It ran them against the runtime image:

cd /opt/blah2/bin/test/unit 2>/dev/null || { echo "No unit tests directory found"; exit 0; }

The runtime stage copies only /blah2/bin/blah2, so that directory has never existed there. Every run printed "No unit tests directory found" and exited 0. Confirmed on run 34849707024, which is green and ran nothing.

The fix

The tests are built into /opt/blah2/bin/test/unit by the blah2 stage, so they now run there, as part of the build:

  • set -e means a failing test fails the build.
  • Two emptiness checks mean a missing or empty test directory fails the build as well, so the silent-pass mode cannot come back.
  • BLAH2_FFT_CACHE points at a writable path, because a test that measures FFT lengths has to agree with itself across instances and the default cache location is a host mount that does not exist at build time.

The workflow step is replaced with the opposite assertion: the runtime image must not contain test binaries. That keeps the deployed image lean and would catch someone "fixing" this by copying tests into it.

Running them in the build rather than a separate job avoids shipping the build-stage image, which carries vcpkg and the toolchain, between jobs.

Verified

Run 34951645250, on this branch:

==== testAmbiguity ====        assertions: 16 | 16 passed
==== testHammingNumber ====    All tests passed (3 assertions in 1 test case)
==== testTracker ====          All tests passed (11 assertions in 6 test cases)
==== 3 unit test binaries passed ====

Build cost is 0.3 s. All three of main's existing suites pass, so this does not turn CI red on merge.

Why this matters now

There are three PRs stacked behind this (#60, #61, #62) whose safety argument rests entirely on unit tests that compare new code against the code it replaces. Without this, those checks are decorative.

It has already cost something real: #62 carries a test that fails, and nobody noticed, because CI never ran it. Expect that PR to go red once this lands, which is the correct outcome.

🤖 Generated with Claude Code

The build-blah2 test job has never executed a test. It ran them against the
runtime image:

    cd /opt/blah2/bin/test/unit 2>/dev/null || { echo "No unit tests directory
    found"; exit 0; }

but the runtime stage copies only /blah2/bin/blah2, so that directory has never
existed there. Every run printed "No unit tests directory found" and exited 0,
and the job reported success. Confirmed on run 34849707024, which is green and
ran nothing.

The tests are built into /opt/blah2/bin/test/unit by the blah2 stage, so they
now run there, as part of the build. set -e makes a failing test fail the
build, and the two emptiness checks make a missing or empty test directory fail
it as well, so the previous silent-pass mode cannot come back. BLAH2_FFT_CACHE
is pointed at a writable path because a test that measures FFT lengths has to
agree with itself across instances, and the default cache location is a host
mount that does not exist at build time.

The workflow step is replaced with the opposite assertion: the runtime image
must NOT contain test binaries. That keeps the deployed image lean and would
catch someone "fixing" this by copying tests into it.

Running them in the build rather than in a separate job avoids shipping the
build-stage image, which carries vcpkg and the toolchain, between jobs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Purple10101
Purple10101 merged commit a781b86 into main Sep 15, 2026
4 checks passed
@Purple10101
Purple10101 deleted the 20260915-ci-run-unit-tests branch September 15, 2026 09:20
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