git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git Test Coverage Report (Thursday, Aug 15)

From
Jeff King <peff@peff.net>
Date
Aug 16, 2019, 18:11 UTC
Message-ID
<20190816181103.GA13894@sigill.intra.peff.net>
In-Reply-To
<6dd8797a-289d-cabb-d4c3-761b9f9d3ca0@gmail.com>
On Thu, Aug 15, 2019 at 10:01:04PM -0400, Derrick Stolee wrote:
> Here is today's test coverage report.
Are the scripts you use to generate these available somewhere?

I think it's useful to look at uncovered code, but I often struggle to figure out whether the parts attached to my name are relevant. In particular, I think two changes to the report format might help:

  1. Include names alongside commit ids when listing uncovered lines. I
     know that will end up with some overly-long lines, but it makes it
     easy to grep for one's name to find relevant sections of the file
     (as opposed to finding your name at the bottom and
     cross-referencing with actual content lines).
     Seeing that an uncovered line is a BUG(), for example, makes it
     easy to know that it's not really an interesting uncovered case in
     the code.
  2. Include more context. Just taking a random example from this email:
> builtin/rebase.c
> e191cc8b 129) strbuf_addstr(&buf, strategy_opts);

We know what the uncovered line was trying to do, but more interesting is likely the conditional that causes it to be uncovered. In this case the surrounding code is:

          if (opts->ignore_whitespace) {
                  struct strbuf buf = STRBUF_INIT;
  
                  if (strategy_opts)
                          strbuf_addstr(&buf, strategy_opts);
  
                  strbuf_addstr(&buf, " --ignore-space-change");
                  free(strategy_opts);
                  strategy_opts = strbuf_detach(&buf, NULL);
          }

even the usual 3 lines of diff context would make it a lot quicker to understand what's going on (it only kicks in when multiple strategy options are used).

(As an aside, this code leaks the newly allocated buffer and leaves a dangling pointer in opts->strategy_opts, but that's all orthogonal to the uncovered line; I'll send a separate message to the original author).

Anyway, I wonder if we could adjust the output of the script to make reading it that way a bit easier.

-Peff
Previous: Derrick StoleeNext: Jeff King
Message 2 of 4 in “Git Test Coverage Report (Thursday, Aug 15)”
  1. Derrick StoleeAug 16, 2019
  2. Jeff KingAug 16, 2019
  3. Jeff KingAug 16, 2019
  4. Derrick StoleeAug 20, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.