Skip to content

test(coverage): stat_print / DB_STAT_ALL coverage (statprint001 + wire env020 into the suite) - #72

Merged
gburd merged 1 commit into
masterfrom
agent/stat-cov
Jul 29, 2026
Merged

test(coverage): stat_print / DB_STAT_ALL coverage (statprint001 + wire env020 into the suite)#72
gburd merged 1 commit into
masterfrom
agent/stat-cov

Conversation

@gburd

@gburd gburd commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

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_ALL formatters (__*_print_*) that format every field to a message file; functional tests read stat() values but almost never call stat_print(DB_STAT_ALL).

How

Two levers, both wired into the default COV_TESTS:

  1. env020 (already existed, was just never in the coverage subset) exercises every Tcl *_stat_print binding — env / lock / log / mpool / mutex / txn / rep / repmgr / db / seq — with each flag (default, -clear, -all, -subsystem, -lk_*, -hash, …).

  2. statprint001 (new) closes the two spots env020 misses and adds the db_stat utility entry path:

    • heap_stat.cenv020 opens no heap DB. Sweeps stat_print default / -fast / -all.
    • dbreg_stat.c __dbreg_print_all — reached only with DB_STAT_ALL | DB_STAT_SUBSYSTEM set together and databases open (so the LOG FNAME list has entries to iterate); env020 passes those flags separately. Calls env stat_print -all -subsystem with live open DBs and asserts the FNAME list is printed.
    • db_stat utility sweeputil/db_stat.c -> __*_stat_print (a separate read-only on-disk path the Tcl suite never touches). Runs db_stat with every meaningful flag: -e -E -c -C -l -L -m -M -x -X -r -R -t -Z -d -f over a populated all-subsystems env.

Registered statprint in testparams.tcl (subs + test_names), added a statprint case to the r dispatcher, and added env020 + statprint001 to run_coverage.sh COV_TESTS (README updated).

Measured lift (env020 + statprint001 vs full-run-2/cov-ranking.txt baseline)

file before after
env/env_stat.c 16.8% 79.9%
lock/lock_stat.c 17.4% 73.6%
rep/rep_stat.c 19.4% 72.4%
db/db_stati.c 22.0% 61.8%
log/log_stat.c 22.9% 87.1%
mutex/mut_stat.c 29.4% 86.8%
sequence/seq_stat.c 0.0% 63.0%
dbreg/dbreg_stat.c 0.0% 69.6%
heap/heap_stat.c 0.0% 80.3%
qam/qam_stat.c 57.6% 78.0%
txn/txn_stat.c 56.8% 69.0%

The 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", ran env020 + statprint001 under timeout in the nix dev shell, captured with lcov from .libs. Both tests PASS. r statprint also runs the new test via the dispatcher. No coverage artifacts / TESTDIR / cores committed.

Still cold (documented, not fixed)

  • seq_stat.c __seq_print_all is a no-op stub, and the Tcl seq stat_print binding exposes only -clear, not -all — reaching the DB_STAT_ALL branch would need a binding change for a 2-line stub. Left alone.
  • repmgr_stat.c send-path counters need a live repmgr transport (repmgr009+, COV_REP=1).

No bugs found

All stat_print paths behaved correctly under the sweep.

…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
@gburd
gburd merged commit 2471d13 into master Jul 29, 2026
45 of 47 checks passed
@gburd
gburd deleted the agent/stat-cov branch July 29, 2026 10:11
@github-actions

Copy link
Copy Markdown

Coccinelle convention checks

No new violations. ✅

Resolved since baseline (2) -- update dist/cocci/baseline.txt to lock these in.
rule_mutex_unbalanced|MUTEX_UNBALANCED|src/crypto/mersenne/mt19937db.c|return (ret);
rule_mutex_unbalanced|MUTEX_UNBALANCED|src/mp/mp_register.c|return (ret);

@github-actions

Copy link
Copy Markdown

ABI diff vs v5.3.31 (libabigail — authoritative)

Removed exported symbols (nm -D, _NNNN version suffix normalized)

None.


Advisory: libabigail/nm is the authoritative binary-ABI check; Coccinelle is complementary source-level early warning. See dist/cocci/README.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant