Skip to content

test: add a documented local test entry point that cannot report a vacuous pass - #240

Merged
solderzzc merged 1 commit into
mainfrom
test/local-test-entrypoint
Oct 18, 2026
Merged

solderzzc merged 1 commit into
mainfrom
test/local-test-entrypoint

Conversation

@solderzzc

Copy link
Copy Markdown
Member

Closes the discoverability gap left by Tier 3 of #128.

Problem

scripts/bootstrap_local_tests.sh already makes the suite runnable locally (landed in #222, verified on both Swift 6.4 and 6.2). Nothing pointed at it: the README had build instructions only, there was no Makefile, and #128's Tier 3 was already recorded as done. So the trap the Tier 3 note described was still live for anyone who did not already know the script existed:

  • a bare swift test on a fresh checkout aborts when MLX cannot load its Metal library,
  • on the pre-6.4 layout that happens at the second test,
  • and swift test still exits 0 after printing Failed to load the default metallib — the run looks like a short green pass while almost nothing executed.

Change

  • make test — one command over the bootstrap plus swift test --skip-build.
  • scripts/run-tests.sh — runs the bootstrap, then fails an unfiltered run that executed fewer than 200 tests, with the metallib explanation. Filtered runs are exempt, because narrowing is the point there (make test-filter FILTER=PromptCacheTests).
  • README — a "Run the Tests" section under Build from Source, covering both toolchains: Swift 6.4 embeds the metallib and only needs the Metal Toolchain; Swift 6.2 (the CI runner) fetches it from the mlx wheel. It also records why copying a metallib into <bundle>.xctest/Contents/MacOS is harmful on 6.4 (CodeSign).

No production code changes; no behaviour change to the test suite itself.

Verification

On Swift 6.4 / Xcode 27 (the toolchain on this machine):

Check Result
make test 326 tests, exit 0
make test-filter FILTER=PromptCacheTests 25 tests, exit 0 (floor correctly not applied)
MIN_TESTS=100000 ./scripts/run-tests.sh exit 1 with the metallib explanation
bash scripts/bootstrap_local_tests.sh takes the .build/out path, checks the Metal Toolchain, copies nothing
bash -n, make -n clean

The Swift 6.2 path is unchanged by this PR; it was verified on this machine on 2026-10-11 (recorded in #128) and remains covered by CI.

`scripts/bootstrap_local_tests.sh` makes the suite runnable locally, but nothing
pointed at it: the README had build instructions only, there was no Makefile, and
the Tier 3 note in #128 already counted the bootstrap as done. A contributor who
runs a bare `swift test` on a fresh checkout can still get a run that reports
success while almost nothing executed — MLX aborts the process when it cannot load
its Metal library, and `swift test` exits 0 anyway.

Add `make test`, a one-command entry point over the bootstrap plus
`swift test --skip-build`, and document it under Build from Source along with the
Swift 6.4 / Swift 6.2 difference and the Metal Toolchain requirement.

`scripts/run-tests.sh` also rejects a short run: an unfiltered run that executed
fewer than 200 tests fails with the metallib explanation instead of reporting a
pass. Filtered runs are exempt, because narrowing is the point there.

Verified on Swift 6.4 / Xcode 27: `make test` runs 326 tests, exit 0;
`make test-filter FILTER=PromptCacheTests` runs 25, exit 0; forcing
MIN_TESTS=100000 turns the same green run into the intended failure.

Refs #128.
@solderzzc
solderzzc merged commit 87d781f into main Oct 18, 2026
15 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.

1 participant