summaryrefslogtreecommitdiff
path: root/test/tx/cmake/coverage_union.py
AgeCommit message (Collapse)Author
2026-09-23Excluded the regression-test hook code from the coverage denominatorFrédéric Desbiens
The test build defines TX_REGRESSION_TEST for every configuration, which opens a block in the Linux port header defining eight *_EXTENSION macros. They expand to live code -- flag tests, state changes and calls -- at eight sites in common/src, and an application defines none of them and compiles none of it. gcov attributes a macro expansion to the file that invokes it, so the harness's own scaffolding was being counted as certified source. coverage_union.py now drops those expansions and prints what it dropped beside the configurations it merged, so the exclusion is auditable, and a site that no longer matches the report fails the run rather than being skipped. tx_timer_initialize.c:275 keeps its line and loses only its branches: it is the one macro whose tx_api.h fallback is not empty, so under TX_MISRA_ENABLE that line still carries a statement in a build that ships. gcovr's merged report is not touched. The hook code is 8 lines and 22 branch outcomes, all covered, 0.183% of lines and 0.694% of outcomes. The union goes from 4383/4383 and 3150/3170 to 4376/4376 and 3128/3148: line coverage stays at 100.00%, and the branch rate falls from 99.36909% to 99.364676%, since removing an all-covered block from a figure below 100% moves it down. Both thresholds are unchanged and both pass, the branch one by 0.15 of an outcome. Seven configurations from a wiped tree, 115/115 tests in each, and the twenty uncovered outcomes are the same twenty at the same sixteen sites. Assisted-by: Claude Code (Opus 5) <[email protected]>
2026-09-15Reported coverage of the source rather than of the compiled configurationsFrédéric Desbiens
The merged report's branch denominator is not the number of branches in common/src. gcovr keys each branch by the basic-block pair gcov assigned it, and those numbers shift when a file compiles to a different amount of code, so a source branch that survives block renumbering between two configurations is counted twice. Measured over the six configurations: 521 of 1123 branch sites carry more branches in the merged report than any single configuration has, and the denominator reads 4627 where the source carries 3156. The inflation is symmetric for a branch covered everywhere, so the percentage stays plausible and the fault is easy to miss. It is not harmless. A figure quoted as branch coverage of the source has to have the source in its denominator, and this one moves when a build configuration is added for reasons that have nothing to do with the code. coverage_union.py reports the union instead: a line is covered if any configuration executed it, and the Nth branch on a line is covered if any configuration took it, keyed by position within the line rather than by block number. gcovr's merged report is still produced and published unchanged; the ratchet now gates on the union, so the floor tracks the source. Both figures agree on what is uncovered: the same 28 branch outcomes in the same 14 files either way. Over the six configurations the union reads 4339/4339 lines and 3128/3156 branches, against 4339/4339 and 4599/4627 merged, with the gates set to 99.95 and 99.00. Assisted-by: Claude Code (Opus 5) <[email protected]>