diff options
| author | user <user@clank> | 2026-08-15 16:07:32 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-15 16:07:32 +0200 |
| commit | 5585c0736e876c9c54ec4feb5139a8607139daa7 (patch) | |
| tree | 32c456a01311992d0f5ab0df3711e6b6d1f6c9a1 /tests/live_m0.py | |
| parent | sl0ppty: only panes that were given a command keep their corpse (diff) | |
| download | slosh-5585c0736e876c9c54ec4feb5139a8607139daa7.tar.gz slosh-5585c0736e876c9c54ec4feb5139a8607139daa7.tar.xz slosh-5585c0736e876c9c54ec4feb5139a8607139daa7.zip | |
make coverage: a number, cheaply
`make coverage` builds a second binary with gcc's --coverage into build/cov,
runs every suite against it, and prints a per-file table from gcov. About a
minute. Nothing installed, nothing about the normal zig build changed.
gcc rather than clang because the counters need a gcov that matches the
compiler, and gcov is what this machine has -- no llvm-profdata, no llvm-cov,
no lcov, no gcovr. The aggregation is forty lines of python reading gcov's own
summaries, which is the whole reason this was cheap.
The suites drive it through $SL0PPTY_BIN, one line in the harness, so there is
no second copy of the test code and no risk of the coverage run testing
something else.
Two things about the result, both in the report itself:
- the C unit tests link the *same* instrumented objects, so input.c, kdl.c,
shader.c and expr.c are credited for the tests that exercise them. Built
separately, input.c read 54% while having a dedicated decoder test -- a lie
about where the tests are rather than about the code.
- server.c reads ~8% and is not untested. The session server is a daemonised
child ending in _exit(), which is right there and skips the flush gcov needs.
The counters are lost, not the tests. Said in the output, because an
unexplained low number invites someone to "fix" working code -- and changing
correct code to make a tool happier is the wrong trade.
Where it lands today: 85.4% of 6298 lines. The gaps that are real rather than
mechanical are jsonval.c (58%), screen.c (64%) and pty.c (59%) -- error paths
and the parts of the diff emitter that only a resize or a weird terminal
reaches.
Diffstat (limited to 'tests/live_m0.py')
| -rw-r--r-- | tests/live_m0.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/live_m0.py b/tests/live_m0.py index 1d0b463..4248fd4 100644 --- a/tests/live_m0.py +++ b/tests/live_m0.py @@ -6,7 +6,7 @@ raw mode, the diff emitter, SIGWINCH, and the quit path. """ import os, pty, uuid, re, select, signal, struct, subprocess, sys, termios, time, fcntl -BIN = os.path.join(os.path.dirname(__file__), "..", "build", "sl0ppty") +BIN = os.environ.get("SL0PPTY_BIN", os.path.join(os.path.dirname(__file__), "..", "build", "sl0ppty")) # A unique session per run. Without this the tests attach to whatever "main" |
