test: coverage.sh takes no args, always full serial suite

This commit is contained in:
Andrew Hamilton 2026-09-10 10:17:24 +10:00
parent 1a77721177
commit 1d8a4d4cee

View file

@ -1,8 +1,10 @@
#!/bin/sh
# Line coverage of kick.c unioned across the test suite (gcc/gcov route).
#
# ./coverage.sh [pytest args...] # e.g. ./coverage.sh tests/test_smoke.py::test_cycle_tabs
# # with no args: full default suite
# ./coverage.sh # always the full default suite, no args: partial runs
# # give a misleading union, and -n/pytest-xdist shares
# # .gcda files across workers (read-merge-write race),
# # so parallel coverage is not supported.
#
# Builds build-cov/ instrumented (--coverage + KICK_COVERAGE flush hook for
# the SIGTERM/_exit teardown path), zeroes counters, runs pytest against
@ -11,6 +13,11 @@
set -e
cd "$(dirname "$0")"
if [ $# -ne 0 ]; then
echo "usage: $0 (no arguments; always the full suite)" >&2
exit 2
fi
if [ ! -f build-cov/build.ninja ]; then
meson setup build-cov -Db_coverage=true "-Dc_args=-DKICK_COVERAGE"
else
@ -19,7 +26,7 @@ fi
meson compile -C build-cov kick wltest
find build-cov -name '*.gcda' -delete
KICK_BIN="$PWD/build-cov/kick" pytest "$@"
KICK_BIN="$PWD/build-cov/kick" pytest
echo "--- kick.c line coverage (union of all runs above) ---"
gcovr -r . --filter 'kick\.c$' --txt