Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9e46dce
feat(xtask): #3058 cargo xtask test runs every test binary under the …
THEtheChad Oct 26, 2026
6b6bbd3
fix(xtask): #3058 keep going through doctests, keep ci --quick's thre…
THEtheChad Oct 26, 2026
48b774f
fix(xtask): #3058 under nextest, --test-threads and --nocapture go be…
THEtheChad Oct 30, 2026
3b8ef15
docs(xtask): #3058 the test help says a CARGO_BUILD_JOBS or RUST_TEST…
THEtheChad Nov 3, 2026
6cd47f5
Issue #3058: ci's test step runs every binary since #3791; xtask test…
THEtheChad Nov 6, 2026
0c2a49a
Issue #3058: the Quick start line says what --keep-going does
THEtheChad Nov 9, 2026
fe076d6
Issue #3058: the CI caps go on only once the CI slot is held
THEtheChad Nov 11, 2026
11e753a
build(cargo): #3059 plain cargo test runs at most 4 tests at once
THEtheChad Oct 26, 2026
fa3cdbc
fix(xtask): #3059 state exactly when an explicit RUST_TEST_THREADS wins
THEtheChad Oct 26, 2026
9ef72f5
fix(xtask): #3059 ci --quick's test binaries get the RAM-aware test t…
THEtheChad Oct 30, 2026
53d0028
test(xtask): #3059 the config check reads RUST_TEST_THREADS and its m…
THEtheChad Nov 3, 2026
2b3021e
test(xtask): #3059 the config check also requires the marker to be fo…
THEtheChad Nov 3, 2026
36b38a1
feat(xtask): #3060 bound each test binary's run and the wait for the …
THEtheChad Oct 26, 2026
f206ea8
fix(xtask): #3060 make the per-binary clock, the kill and the --list …
THEtheChad Oct 26, 2026
7c6902f
fix(xtask): #3060 signal only processes xtask started, and bound the …
THEtheChad Oct 26, 2026
9c4e9d4
docs: #3060 the build isn't timed, only what a run waits on after it
THEtheChad Nov 3, 2026
f37fccb
docs: #3060 a reparented process that cleared its environment isn't f…
THEtheChad Nov 3, 2026
b7180d2
fix(xtask): #3060 signal a timed-out run's processes through pidfds, …
THEtheChad Nov 3, 2026
659d806
fix(xtask): #3060 trust a parent only while it lives, and signal no b…
THEtheChad Nov 3, 2026
d5ffde0
fix(xtask): #3060 a pidfd that can't be asked vouches for nothing; SI…
THEtheChad Nov 3, 2026
743f331
fix(xtask): #3060 the CI-slot wait never sleeps past its limit
THEtheChad Nov 4, 2026
dc58e6c
fix(xtask): #3060 a stalled output reader can't hold up the clock; no…
THEtheChad Nov 4, 2026
66d92d2
fix(xtask): #3060 say what the output gate can't stop; handshake the …
THEtheChad Nov 4, 2026
4cf76a5
fix(xtask): #3060 a CI slot taken only after the wait's limit, while …
THEtheChad Nov 4, 2026
646c3fb
fix(xtask): #3060 a slot freed as the wait ran out says so, instead o…
THEtheChad Nov 4, 2026
2e13ab9
fix(xtask): #3060 the freed-slot message doesn't claim the slot is st…
THEtheChad Nov 4, 2026
d3be7e7
test(xtask): #3059 the config check ignores a trailing comment on the…
THEtheChad Nov 3, 2026
01c2236
Issue #3060: the README names the GPU probe's 5-minute limit, as docs…
THEtheChad Nov 9, 2026
024d889
Issue #3059: plain cargo test keeps libtest's defaults; only xtask te…
THEtheChad Nov 20, 2026
1c389d0
Issue #3060: the CI-slot wait defaults to 240 min, room for three ful…
THEtheChad Nov 20, 2026
ff2dfa7
Merge #3086's new head (plain cargo test keeps libtest's defaults) in…
THEtheChad Nov 20, 2026
6e7c5b9
Issue #3060: nextest's 30-minute limit per test is in an xtask profil…
THEtheChad Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# `cargo xtask ci` and `cargo xtask test` run nextest (LIGHTCRAFT_NEXTEST=1) with this profile, set
# through NEXTEST_PROFILE unless you set it yourself. A plain `cargo nextest run` uses the default
# profile and keeps nextest's own defaults (#3058).
[profile.xtask]
# A test still running after 30 minutes is killed (`cargo xtask` gives each test binary under
# `cargo test` the same limit, LIGHTCRAFT_TEST_BINARY_TIMEOUT, #3060). That variable doesn't change
# this one (`0` included): NEXTEST_PROFILE=default runs without it.
slow-timeout = { period = "60s", terminate-after = 30 }
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ cargo xtask web --serve # the same app in the br
cargo run --release -p lightcraft-cli -- render photo.jpg -o out.jpg --set light.exposure=0.5
cargo xtask ci # fmt, clippy, HEIF, tests, parity, layers, assets, WASM
cargo xtask ci --quick # only what your branch's changes can break (minutes)
cargo xtask test -p lightcraft-raw --keep-going # tests only, with ci's caps; runs every binary, names each that failed
```

`cargo xtask ci --quick` compares with the merge base of `origin/main` (`--base REF` for another)
Expand All @@ -415,7 +416,19 @@ the wasm check when the changes touch them; a change to `Cargo.toml`, `Cargo.loc
config tests everything. GitHub runs the full `cargo xtask ci` on every pull request
(`.github/workflows/ci.yml`). Only one `ci` runs at a time per machine: a second one, from another
worktree say, waits for the first and names it, since several at once take longer in total than in
turn. `LIGHTCRAFT_CI_SLOTS=2` allows two; `LIGHTCRAFT_CI_LOCK=off` skips the lock.
turn. `LIGHTCRAFT_CI_SLOTS=2` allows two; `LIGHTCRAFT_CI_LOCK=off` skips the lock. The wait
gives up after `LIGHTCRAFT_CI_LOCK_WAIT` minutes (default 240; `0` waits as long as it takes) and
names the run holding the slot. The build isn't timed (a first build can rightly take long), but the
test binaries are: each may run for `LIGHTCRAFT_TEST_BINARY_TIMEOUT` minutes (default 30, timed from
cargo's `Running` line for it; `0` for no limit). The GPU probe's test binaries get 5 minutes each, or
`LIGHTCRAFT_TEST_BINARY_TIMEOUT` when that is shorter (5 minutes even at `0`: the probe is optional). One that runs longer, a test hung on a GPU device say, is killed with the
processes it started (on Linux found by an environment variable they inherit, so those that outlived
their parent too, unless they cleared their environment; on macOS and the BSDs only the process xtask
started is killed, which under the full `ci` is cargo, so a hung test binary may keep running), and the run reports it as `timed out after 30 min` with the tests still running
and those that never reported a result. Under `LIGHTCRAFT_NEXTEST=1`, xtask runs nextest with the `xtask` profile of
`.config/nextest.toml`, which kills a test after 30 minutes instead, whatever
`LIGHTCRAFT_TEST_BINARY_TIMEOUT` says (`0` included; `NEXTEST_PROFILE=default` runs without it). A
plain `cargo nextest run` uses the default profile, so it keeps nextest's own defaults. After a timeout, `ci` skips its GPU probe and translation gaps report.

CI defaults to line-table debug information and one build job per 1.5 GB of RAM
available when it starts (at most one per CPU; 4 if memory can't be read), so an
Expand All @@ -427,6 +440,16 @@ unchanged. Explicit `CARGO_PROFILE_DEV_DEBUG`, `CARGO_BUILD_JOBS`, `RUST_TEST_TH
`cargo test`; `LIGHTCRAFT_NEXTEST=1` runs them under [cargo-nextest](https://nexte.st) instead (one
process per test, slower here because each regenerates the demo scenes). Ordinary development commands keep their own settings.

To run tests without the rest of `ci`, use `cargo xtask test` rather than `cargo test --workspace`,
which runs one test per CPU in every test binary (on a 16-core machine the UI tests alone run out of
memory) and takes no CI slot. It has `ci`'s caps and waits for its slot, builds every test target
once (the same build as `ci`'s, so neither rebuilds the other) and runs each test binary, or those
of the `-p PKG` packages, with whatever follows `--` (`cargo xtask test -p lightcraft-ui-egui --
i18n::`). It stops at the first failing binary; `--keep-going` runs them all and names each that
failed, as `ci`'s test step does. `--doc` adds the doctests; `LIGHTCRAFT_NEXTEST=1` applies here too, where
`--test-threads N` and `--nocapture` become nextest's own options and only filters, `--exact`,
`--skip`, `--ignored` and `--include-ignored` may follow `--`.

**Release builds on memory-constrained machines:** [#1196](https://github.com/storytold/lightcraft/issues/1196)
reports Arch/AUR release-link OOM kills on a 16 GB machine when the desktop and CLI build concurrently
with full debug information, thin LTO and one codegen unit. The CI defaults above do not apply to
Expand Down
42 changes: 41 additions & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,42 @@ module per file (`cargo test -p <crate> --test it <module>::`); a test that chan
whole process (a global allocator, closing the GPU) keeps a binary of its own in `tests/`. The WASM
build is one `cargo check --target wasm32-unknown-unknown --keep-going` over the wasm-safe crates.

`ci`'s resource caps (build jobs by available RAM, at most 4 test threads, line-table debuginfo) and
its one-run-per-machine slot (`xtask/src/ci_lock.rs`) also cover `cargo xtask test [-p PKG]…
[--keep-going] [--doc] [-- ARGS]` (`xtask/src/test.rs`), the way to run the tests alone: subcommands
opt into the caps with `use_ci_caps`. It builds every workspace test target once, as `ci` does, and
runs each test binary, or the `-p` packages' binaries, itself (`test::run_binary`, which `ci --quick`
uses too); `--keep-going` runs every binary and names each that failed instead of stopping at the
first.

What these runs wait on after the build is bounded (`xtask/src/deadline.rs`, #3060). Stable libtest
has no per-test timeout, so each test binary gets `LIGHTCRAFT_TEST_BINARY_TIMEOUT` minutes (default 30; `0`
for none): timed from its start when xtask runs it (`test::run_binary`), and from cargo's `Running` /
`Doc-tests` line for it, and again from its own first `running N tests` line, when `cargo test` runs it (the
full `ci`'s test and HEIF steps; the build before isn't bounded; cargo runs with
`CARGO_TERM_QUIET=false` and without `-q` so it prints those lines). The output streams through and is
read for libtest's lines, keeping a bounded amount. On timeout the binary and the processes it started
that xtask can find are killed, and no process xtask didn't start. On Linux that is the binary, its process
tree and every process whose `/proc/<pid>/environ` holds the run's exact marker entry
(`LIGHTCRAFT_XTASK_RUN_<pid>_<nonce>_<n>=1`, inherited by all it starts; the nonce is random per xtask
process), which finds those that outlived their parent (one that also cleared its environment isn't
found and may keep running). Each is held by a pidfd and signalled only through it, so a pid reused
meanwhile is never signalled. They are frozen with SIGSTOP, then killed; one whose SIGKILL fails twice
is continued with SIGCONT rather than left stopped, and the report names it. Without pidfds (other
Unix, Linux before 5.3) only xtask's own child is killed (the test binary, or under the full `ci`
cargo, whose test binary may then keep running) and the report says so; Windows uses `taskkill /T`. The child stays in xtask's process group, so Ctrl-C
still reaches it. The run reports `timed out after N min: <binary>`, what
the kill found, the tests still running (libtest's "has been running for over 60 seconds" warnings,
or the test a single-threaded run started) and those that never reported a result (`--list`, itself
bounded in time and size). Under nextest, xtask sets `NEXTEST_PROFILE=xtask` (unless the caller set
one), and that profile's `slow-timeout` in `.config/nextest.toml` kills a test after 30 minutes
instead, whatever `LIGHTCRAFT_TEST_BINARY_TIMEOUT` says (xtask notes that when it is set); a plain
`cargo nextest run` uses the default profile and keeps nextest's own defaults. The wait for the CI slot gives up after `LIGHTCRAFT_CI_LOCK_WAIT` minutes
(default 240, three full runs at the 80 minutes GitHub's gate allows one; `0` for no limit) with an error naming the run that holds it.

`ci` also probes the machine: OS, CPUs, RAM, the GPU adapters of each backend (from the ignored
`gpu_probe` test of `lightcraft-gpu`, run after the workspace tests so it reuses their build; xtask
`gpu_probe` test of `lightcraft-gpu`, run after the workspace tests so it reuses their build, each
test binary it starts bounded by 5 minutes, and skipped once a test binary timed out; xtask
has no wgpu), the corpus and `CRAFT_FONTS_DIR`. Tests
that need what is missing call `lightcraft_testkit::skip!(need, reason)`, which appends a JSON line to
the file `LIGHTCRAFT_SKIP_LOG` names. The run ends with the machine and the skips by need and reason,
Expand All @@ -87,6 +121,12 @@ the `lightcraft-gpu` tests once per backend with a hardware adapter (`LIGHTCRAFT

| Date | Change | Summary |
|---|---|---|
| 2026-11-20 | minor | Quality gates: nextest's 30-minute limit per test is in an `xtask` profile that `ci` and `xtask test` pick, so a plain `cargo nextest run` keeps nextest's defaults |
| 2026-11-20 | minor | Quality gates: the wait for the CI slot (`LIGHTCRAFT_CI_LOCK_WAIT`) defaults to 240 minutes, room for two or three full runs queued on a shared machine |
| 2026-11-03 | minor | Quality gates: a test run's output is forwarded outside the lock its clock is checked under, and not (but for a write under way) after the run ends; only a binary's first `running N tests` line restarts its clock; the slot wait never sleeps past its limit |
| 2026-11-03 | minor | Quality gates: a timed-out test run's processes are signalled through pidfds on Linux (never a reused pid; without pidfds only xtask's own child is killed), and one that can't be killed is continued rather than left stopped |
| 2026-10-26 | minor | Quality gates: each test binary's run (`LIGHTCRAFT_TEST_BINARY_TIMEOUT`) and the wait for the CI slot (`LIGHTCRAFT_CI_LOCK_WAIT`) have a time limit |
| 2026-10-26 | minor | Quality gates: `cargo xtask test` runs the tests with `ci`'s caps and slot, and can keep going past a failing binary |
| 2026-10-23 | minor | Quality gates: one integration-test binary per crate, doctests apart, nextest on request, one WASM check |
| 2026-10-11 | minor | Quality gates: the CI machine probe, visible skips (`testkit`) and `target/ci/report.json` |
| 2026-10-10 | major | Created from the code (crate sizes, layers, data model, rendering, control, gates) |
5 changes: 5 additions & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ sha2 = { workspace = true }
# precompressed web bundle (`cargo xtask web`); pure Rust
flate2 = "1"
brotli = { version = "9", default-features = false, features = ["std"] }

# ending a timed-out test run (deadline/kill.rs): pidfds, so a pid that passed to another process
# is never signalled; no unsafe here, pure Rust (already in the lock through tempfile and wayland)
[target.'cfg(target_os = "linux")'.dependencies]
rustix = { version = "1", default-features = false, features = ["std", "process", "event"] }
Loading
Loading