Skip to content

test: make the local suite actually runnable (1 test → 245) - #130

Merged
solderzzc merged 1 commit into
mainfrom
claude/local-test-bootstrap
Aug 8, 2026
Merged

solderzzc merged 1 commit into
mainfrom
claude/local-test-bootstrap

Conversation

@solderzzc

Copy link
Copy Markdown
Member

Tier 3 from #128.

The trap

MLX aborts the process when it cannot load its Metal library. A bare swift test therefore dies on the first test that touches MLX — in practice the second test of the run:

Test Case '-[SwiftBuddyTests.AudioExtractionTests testAudio_Base64WAVExtraction]' passed
Test Case '-[SwiftBuddyTests.AudioExtractionTests testAudio_LongAudioChunking]' started.
MLX error: Failed to load the default metallib. library not found …

Everything after that goes unexecuted, and the output still reads as a short, passing run. A contributor can run the tests, see green, and have exercised one assertion out of ~250.

CI is unaffected — it installs the metallib inline (ci.yml, "Install MLX Metal library"), which is exactly why this went unnoticed.

The fix

scripts/install-test-metallib.sh performs that same step locally. It prefers a metallib already produced by build.sh, otherwise pulls one from the mlx wheel as CI does, then installs it beside the built products and inside every .xctest bundle — MLX looks for a metallib colocated with the running binary, which for tests is inside the bundle, not next to it.

swift build --build-tests
scripts/install-test-metallib.sh
swift test

Measured

Executed tests Failures
before 1 0
after 245 0

README documents the sequence in the Testing section.

Note

This also means the "full suite green" claims made while fixing #108/#110/#112 were per-suite (--filter) runs, not a single invocation — the single invocation was never possible. It is now, and it passes.

🤖 Generated with Claude Code

Tier 3 from #128. MLX aborts the process when it cannot load its Metal
library, so a bare `swift test` dies on the first test that touches MLX — in
practice the second test of the run. Everything after it goes unexecuted while
the output still reads as a short, passing run, which is a trap: a contributor
can run the tests, see green, and have exercised one assertion out of ~250.

CI is unaffected because it installs the metallib inline, which is why this
went unnoticed.

scripts/install-test-metallib.sh is that same step for local use. It prefers a
metallib already built by build.sh and otherwise pulls one from the mlx wheel,
then installs it beside the built products and inside every .xctest bundle —
MLX looks for a metallib colocated with the running binary, which for tests is
inside the bundle.

Measured: 1 executed test before, 245 executed and 0 failures after. README
documents the three-command sequence.

Co-Authored-By: Claude Opus 5 <[email protected]>
@solderzzc
solderzzc merged commit b37853c into main Aug 8, 2026
11 of 12 checks passed
@solderzzc
solderzzc deleted the claude/local-test-bootstrap branch August 8, 2026 04:30
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