Parallelize the test gate; cache cold-init tests, drop the benchmark from it (#139)

run-tests.janet runs the same file set as `jpm test` across a pool of worker
processes (one `janet FILE` each, ev-based). The full gate goes from ~790s
serial to ~98s here (8x), and more on CI where the heavy files don't thrash on
swap. CI and the docs point at it; `jpm test` still works serially.

Three things dominated the wall:

- Nine integration tests cold-built a compile ctx (~8s each); switch them to
  api/init-cached so they share the prebuilt image. The cache key already
  fingerprints the ctx-shaping env vars, so the direct-link ones share one DL
  image and the rest share the plain one.
- core-bench's main ran on every gate (~35s of benchmark loops that assert
  nothing); gate it behind JOLT_BENCH=1.
- cli-test spawned `janet src/jolt/main.janet` ~20 times at ~8s cold each
  (340s under parallel load, and it was the whole wall); prefer build/jolt
  (~20ms baked ctx) when present, fall back to from-source for an unbuilt tree.

type-check-test stays on cold init: a snapshot-loaded ctx loses the success
checker's op/msg detail (jolt-vley). jolt-pria tracks caching from-source
startup generally, which would let cli-test drop the build/jolt preference.

Co-authored-by: Yogthos <yogthos@gmail.com>
This commit is contained in:
Dmitri Sotnikov 2026-06-16 14:23:02 +00:00 committed by GitHub
parent 307b65b45b
commit f0293fb4ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 134 additions and 17 deletions

View file

@ -1,14 +1,19 @@
# Smoke-test the command-line flags by running main.janet from source (no build
# needed, so it can't go stale).
# Smoke-test the command-line flags. Prefer the built binary (baked ctx, ~20ms
# startup); from-source is ~8s cold per invocation, and with ~20 invocations this
# file dominated the (parallel) gate's wall clock. Falls back to running
# main.janet from source when there's no binary, so an unbuilt tree still works —
# the gate (`jpm build && janet run-tests.janet`) builds first, so it's fresh.
(def- jolt-cmd
(if (os/stat "build/jolt") ["build/jolt"] ["janet" "src/jolt/main.janet"]))
(defn- run [& args]
(def p (os/spawn ["janet" "src/jolt/main.janet" ;args] :p {:out :pipe :err :pipe}))
(def p (os/spawn [;jolt-cmd ;args] :p {:out :pipe :err :pipe}))
(def out (:read (p :out) :all))
(os/proc-wait p)
(string (or out "")))
(defn- run-err [& args]
(def p (os/spawn ["janet" "src/jolt/main.janet" ;args] :p {:out :pipe :err :pipe}))
(def p (os/spawn [;jolt-cmd ;args] :p {:out :pipe :err :pipe}))
(def err (:read (p :err) :all))
(os/proc-wait p)
(string (or err "")))