Skip to content
  • Derrick Stolee's avatar
    contrib: add coverage-diff script · 783faedd
    Derrick Stolee authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    We have coverage targets in our Makefile for using gcov to display line
    coverage based on our test suite. The way I like to do it is to run:
    
        make coverage-test
        make coverage-report
    
    This leaves the repo in a state where every X.c file that was covered has
    an X.c.gcov file containing the coverage counts for every line, and "#####"
    at every uncovered line.
    
    There have been a few bugs in recent patches what would have been caught
    if the test suite covered those blocks (including a few of mine). I want
    to work towards a "sensible" amount of coverage on new topics. In my opinion,
    this means that any logic should be covered, but the 'die()' blocks covering
    very unlikely (or near-impossible) situations may not warrant coverage.
    
    It is important to not measure the coverage of the codebase by what old code
    is not covered. To help, I created the 'contrib/coverage-diff.sh' script.
    After creating the coverage statistics at a version (say, 'topic') you can
    then run
    
        contrib/coverage-diff.sh base topic
    
    to see the lines added between 'base' and 'topic' that are not covered by the
    test suite. The output uses 'git blame -s' format so you can find the commits
    responsible and view the line numbers for quick access to the context, but
    trims leading tabs in the file contents to reduce output width.
    
    Signed-off-by: default avatarDerrick Stolee <dstolee@microsoft.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    783faedd