Skip to content

skc/tests: batch the invalid-test suite via sharded skc --batch#1320

Open
mbouaziz wants to merge 1 commit into
mainfrom
batch-invalid-harness
Open

skc/tests: batch the invalid-test suite via sharded skc --batch#1320
mbouaziz wants to merge 1 commit into
mainfrom
batch-invalid-harness

Conversation

@mbouaziz

@mbouaziz mbouaziz commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements #1300 (compiler test harness). The suite runs valid tests in-process via @exptest, but the 826 invalid_tests/ (which must fail to compile) each spawned a fresh skc — re-type-checking the stdlib (~64% of a compile, #1295) 826 times. This batches them through skc --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 --batch survive every invalid unit.

How

  • compile.skskc --batch now writes each failed unit's diagnostics to a per-unit <output>.err sidecar (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.
    • batchCompileInvalid runs in the parent only (sktest workers are re-execs marked by SKTEST_RANK), before test_harness forks the workers. It shards the 826 invalid tests into njobs manifests and runs them as concurrent skc --batch processes — recovering the parallelism the per-test path had, while each shard types the stdlib only once.
    • Outputs go to a deterministic scratch dir under Environ.temp_dir(), recreated each run (no stale artifacts) and derived identically by parent and workers (no coordination needed).
    • Each per-test closure (runInvalidFromBatch) is now a pure filesystem read: an artifact present ⇒ "Expected compile error"; otherwise compare <output>.err to .exp_err (same .trim() as before).

Per-test semantics are unchanged: the .err sidecar holds the same rendered errors a one-shot skc writes 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:

  • Identical PASS/FAIL vs 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 on main; it's a local multi-stage-build artifact — the test binary bakes the working-tree commit while a locally-built stage1 skc reports its bootstrap commit — and matches in CI.)
  • Scratch dir after a run: 826 .err sidecars, 0 binaries, 8 shard manifests — exactly as designed.
  • Speed (full skargo test run, same machine): ~58 s vs ~351 s on main — a ~6× reduction, from type-checking the stdlib ~8 times instead of ~800.

Test plan

  • full suite: all 826 invalid + 897 valid pass through the batch
  • before/after wall-clock on the same machine
  • CI

🤖 Generated with Claude Code

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>
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