Commit e7771b9
committed
feat(test): stream, time and bound
`mcpp test --workspace` did not report time, did not set a deadline, and did
not flush. The three compound: a macOS CI lane spent 45 minutes in it, was
killed by the job timeout, and left a log containing not one line of mcpp's own
output — only the test binaries', which are separate processes that flush at
their own exit. Attributing the stall meant reverse-engineering log timestamps.
stdout: every status line was a bare std::println with no flush anywhere, and
the repo had no setvbuf — so *when* output became visible was decided by each
platform's libc buffer size, and that number differs everywhere: musl (the
Linux release linkage) hardcodes BUFSIZ = 1024 and ignores st_blksize, Apple
libc takes st_blksize which is 65536 for a pipe, MSVCRT uses 4096 and treats
_IOLBF as _IOFBF. Measured on one 97-member workspace, the same 13 639 bytes of
status output flushed 13 times on Linux and zero times on macOS. Fixed on both
legs (setvbuf in main, ui::flush from every stdout writer): 3 block writes
became 391 line writes.
Timing: the clock started after the package build and the bulk test build, so
`finished in` covered only the per-test loop — one member printed 6.53s against
93.5s actual, and the understatement is worst exactly on the build-heavy
members where the number matters. It now starts before Phase A and reports
`finished in 93.5s (build 87.0s + run 6.5s)`.
Bounds: --timeout only ever covered the test *run*; all three ninja drives had
no deadline at all, which is why a link that never returns could not be stopped
by any --timeout value. Adds --build-timeout (per drive, default 900, POSIX
only) and --workspace-timeout (whole fan-out), and makes --timeout default to
300 — `--timeout 0` still means no limit, it just has to be asked for.
Fan-out: per-member M/N progress, per-test durations, per-member elapsed, a
workspace-level summary and a `slowest:` list.
JSON: the fan-out header used to escape for member #1 and be suppressed from #2
on, because run_tests set the quiet flag itself — one stream, two behaviors,
and a stray non-JSON line. Silenced before the first member instead. Records
are now member-qualified and the stream ends with a workspace_summary.
Also surfaces the one silent platform difference in this path: macOS injects no
runtime library path for test binaries (deliberately — DYLD_LIBRARY_PATH would
reach every executable ninja launches), so a test needing [runtime]
library_dirs fails there with a dyld error naming neither cause nor platform.
Analysis and plan in .agents/docs/2026-07-31-test-workspace-observability-*.md.mcpp test (2026.8.1.1)1 parent 0547324 commit e7771b9
22 files changed
Lines changed: 1089 additions & 48 deletions
File tree
- .agents/docs
- docs
- zh
- src
- build
- cli
- toolchain
- tests
- e2e
- unit
Lines changed: 104 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
0 commit comments