skc/tests: batch the invalid-test suite via sharded skc --batch#1320
Open
mbouaziz wants to merge 1 commit into
Open
skc/tests: batch the invalid-test suite via sharded skc --batch#1320mbouaziz wants to merge 1 commit into
mbouaziz wants to merge 1 commit into
Conversation
The compiler test suite runs valid tests in-process via @exptest, but the 826 invalid_tests/ (which must fail to compile) each spawned a fresh skc, re-typing the stdlib (~64% of a compile) ~800 times. Batch them through skc --batch so the stdlib is type-checked a handful of times instead. - compile.sk: skc --batch writes each failed unit's diagnostics to a per-unit <output>.err sidecar (alongside the stderr print), so a driver can attribute failures per unit without parsing interleaved stderr. - tests.sk: only the invalid path changes (valid @exptest/fallback untouched). batchCompileInvalid runs in the parent only (workers are re-execs marked by SKTEST_RANK), before test_harness forks the workers; it shards the invalid set into njobs manifests run as concurrent skc --batch processes (each types the stdlib once), writing results to a per-run scratch dir under Environ.temp_dir() that parent and workers derive identically. Each per-test closure is now a pure filesystem read: artifact present => "Expected compile error", else compare <output>.err to .exp_err (same .trim() as before). Per-test semantics are unchanged: the sidecar holds the same rendered errors a one-shot skc writes to stderr. Full suite: identical 1723/1724 PASS/FAIL vs main, in ~58s vs ~351s (~6x), typing the stdlib ~8 times instead of ~800. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #1300 (compiler test harness). The suite runs valid tests in-process via
@exptest, but the 826invalid_tests/(which must fail to compile) each spawned a freshskc— re-type-checking the stdlib (~64% of a compile, #1295) 826 times. This batches them throughskc --batch(#1298/#1301), so the stdlib is type-checked a handful of times instead of ~800.Builds on the batch continue-on-error work (#1301) and the frontend-error robustness fix (#1313) that made
--batchsurvive every invalid unit.How
compile.sk—skc --batchnow writes each failed unit's diagnostics to a per-unit<output>.errsidecar (alongside the existing stderr print), so a driver can attribute failures per-unit without parsing interleaved stderr.tests.sk— only the invalid path changes; valid@exptest/fallback handling is untouched.batchCompileInvalidruns in the parent only (sktest workers are re-execs marked bySKTEST_RANK), beforetest_harnessforks the workers. It shards the 826 invalid tests intonjobsmanifests and runs them as concurrentskc --batchprocesses — recovering the parallelism the per-test path had, while each shard types the stdlib only once.Environ.temp_dir(), recreated each run (no stale artifacts) and derived identically by parent and workers (no coordination needed).runInvalidFromBatch) is now a pure filesystem read: an artifact present ⇒ "Expected compile error"; otherwise compare<output>.errto.exp_err(same.trim()as before).Per-test semantics are unchanged: the
.errsidecar holds the same rendered errors a one-shotskcwrites to stderr (verified byte-for-byte modulo the trailing newline.trim()already absorbs).Verified
Built the full compiler test binary with the new harness and ran the whole suite:
main: both harnesses report 1723 successes / 1724 on the same machine — every one of the 826 invalid tests and 897 valid tests passes through the batch. (The lone failure,Native CompilerVersionCheck, reproduces identically onmain; it's a local multi-stage-build artifact — the test binary bakes the working-tree commit while a locally-builtstage1skcreports its bootstrap commit — and matches in CI.).errsidecars, 0 binaries, 8 shard manifests — exactly as designed.skargo testrun, same machine): ~58 s vs ~351 s onmain— a ~6× reduction, from type-checking the stdlib ~8 times instead of ~800.Test plan
🤖 Generated with Claude Code