test(coverage): stat_print / DB_STAT_ALL coverage (statprint001 + wire env020 into the suite) - #72
Merged
Merged
Conversation
…e suite
The verbose stat_print / DB_STAT_ALL formatters were 0-29% covered:
functional tests read stat() values but almost never call
stat_print(DB_STAT_ALL), which formats every field to a message file.
env020 already exercises every Tcl *_stat_print binding with every flag,
but it was never in the coverage subset, and two paths stay cold even
with it:
- heap_stat.c: env020 opens no heap database.
- dbreg_stat.c __dbreg_print_all: reached only with
DB_STAT_ALL | DB_STAT_SUBSYSTEM set *together* and databases open;
env020 passes those flags separately.
The db_stat *utility* entry path (util/db_stat.c -> __*_stat_print) is
never touched by the Tcl suite at all.
New statprint001 closes those gaps:
- a heap DB stat_print sweep (default / -fast / -all),
- env stat_print -all -subsystem with live open DBs (dbreg),
- a db_stat utility flag sweep (-e -E -c -C -l -L -m -M -x -X -r -R
-t -Z -d -f) over a populated all-subsystems env.
Registered in testparams.tcl (subs + test_names), added a `statprint`
case to the `r` dispatcher, and added env020 + statprint001 to the
default COV_TESTS in run_coverage.sh (README updated).
Measured lift (env020 + statprint001 vs full-run-2 baseline):
env_stat 16.8 -> 79.9 lock_stat 17.4 -> 73.6
rep_stat 19.4 -> 72.4 db_stati 22.0 -> 61.8
log_stat 22.9 -> 87.1 mut_stat 29.4 -> 86.8
seq_stat 0.0 -> 63.0 dbreg_stat 0.0 -> 69.6
heap_stat 0.0 -> 80.3 qam_stat 57.6 -> 78.0
txn_stat 56.8 -> 69.0
Coccinelle convention checksNo new violations. ✅ Resolved since baseline (2) -- update dist/cocci/baseline.txt to lock these in. |
ABI diff vs
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Raises coverage of the statistics subsystem — the biggest tractable single-process gap (~2k lines across 8 files at 0-29%). These are the verbose
stat_print/DB_STAT_ALLformatters (__*_print_*) that format every field to a message file; functional tests readstat()values but almost never callstat_print(DB_STAT_ALL).How
Two levers, both wired into the default
COV_TESTS:env020(already existed, was just never in the coverage subset) exercises every Tcl*_stat_printbinding —env/lock/log/mpool/mutex/txn/rep/repmgr/db/seq— with each flag (default,-clear,-all,-subsystem,-lk_*,-hash, …).statprint001(new) closes the two spotsenv020misses and adds thedb_statutility entry path:env020opens no heap DB. Sweepsstat_printdefault /-fast/-all.__dbreg_print_all— reached only withDB_STAT_ALL | DB_STAT_SUBSYSTEMset together and databases open (so the LOG FNAME list has entries to iterate);env020passes those flags separately. Callsenv stat_print -all -subsystemwith live open DBs and asserts the FNAME list is printed.util/db_stat.c -> __*_stat_print(a separate read-only on-disk path the Tcl suite never touches). Runsdb_statwith every meaningful flag:-e -E -c -C -l -L -m -M -x -X -r -R -t -Z -d -fover a populated all-subsystems env.Registered
statprintintestparams.tcl(subs+test_names), added astatprintcase to therdispatcher, and addedenv020+statprint001torun_coverage.shCOV_TESTS(README updated).Measured lift (env020 + statprint001 vs
full-run-2/cov-ranking.txtbaseline)env/env_stat.clock/lock_stat.crep/rep_stat.cdb/db_stati.clog/log_stat.cmutex/mut_stat.csequence/seq_stat.cdbreg/dbreg_stat.cheap/heap_stat.cqam/qam_stat.ctxn/txn_stat.cThe two 0% files (
seq_stat.c,dbreg_stat.c,heap_stat.c) are now substantially covered.Validation
Built with
CC=gcc ... CFLAGS="-O0 -g --coverage", ranenv020+statprint001undertimeoutin the nix dev shell, captured withlcovfrom.libs. Both tests PASS.r statprintalso runs the new test via the dispatcher. No coverage artifacts / TESTDIR / cores committed.Still cold (documented, not fixed)
seq_stat.c __seq_print_allis a no-op stub, and the Tclseq stat_printbinding exposes only-clear, not-all— reaching theDB_STAT_ALLbranch would need a binding change for a 2-line stub. Left alone.repmgr_stat.csend-path counters need a live repmgr transport (repmgr009+,COV_REP=1).No bugs found
All stat_print paths behaved correctly under the sweep.