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

Re: Git Test Coverage Report (Mon. Dec 9)

From
Derrick Stolee <stolee@gmail.com>
Date
Dec 9, 2019, 17:44 UTC
Message-ID
<58a3e2c4-4c5a-e276-f74e-128438f2ab40@gmail.com>
In-Reply-To
<CAPig+cTrAsn64S0Qm7PdJVFhsquVA3+ugwngLpo1S4yUjMcrGA@mail.gmail.com>
On 12/9/2019 12:19 PM, Eric Sunshine wrote:
Show 13 quoted lines
> On Mon, Dec 9, 2019 at 12:11 PM René Scharfe <l.s.r@web.de> wrote:
>> Am 09.12.19 um 16:36 schrieb Derrick Stolee:
>>> René Scharfe  0bb313a5 xdiff: unignore changes in function context
>>> xdiff/xemit.c
>>> 0bb313a5 223)        xchp->i1 + xchp->chg1 <= s1 &&
>>> 0bb313a5 224)        xchp->i2 + xchp->chg2 <= s2)
>>> 0bb313a5 225) xchp = xchp->next;
>>
>> Hmm, line 223 *is* exercised by t4015.85.
> 
> This, along with Dscho's[1] review of an earlier coverage report,
> makes one wonder if there is some off-by-one error in the reporting
> logic, such that it is reporting the wrong lines as not covered.

This is definitely possible. I'll see if I can locate the bug in my report-generation code.

However, line 222 is here [1]
	while (xchp != xch &&

So if this is always false, then the rest of the while condition will not be tested, nor will the body (line 225: xchp = xchp->next;).

If it's just an off-by-one error in either direction, then line 224
still is definitely not covered (which would imply that 225 is not
covered, either).
 
Show 11 quoted lines
> Footnotes:
> 
> [1]: https://lore.kernel.org/git/nycvar.QRO.7.76.6.1911262116100.31080@tvgsbejvaqbjf.bet/
> which, among other seeming anomalies pointed out by Dscho, showed a
> closing brace '}' not covered by a test:
> 
>     > Johannes Schindelin 867bc1d2 rebase-merges: ...
>     > sequencer.c
>     > 867bc1d2 4539) }
> 
>     Not sure why this closing parenthesis isn't covered :-D

That closing paren is the end of a for loop [2] that has an if (*) break; inside. The closing paren _could_ be uncovered if the "break;" is hit every time.

So, these seem like reasonable lines to report as uncovered. However, I'll continue to look for a problem in my code as I would hate to cause readers to stress over an actually-covered line.

Thanks, -Stolee

[1] https://github.com/git/git/blob/e0522318ac56aeb88f14e72ba2db25912e9972de/xdiff/xemit.c#L223 [2] https://github.com/git/git/blob/083378cc35c4dbcc607e4cdd24a5fca440163d17/sequencer.c#L4539

Previous: Eric SunshineNext: René Scharfe
Message 4 of 7 in “Git Test Coverage Report (Mon. Dec 9)”
  1. Derrick StoleeDec 9, 2019
  2. René ScharfeDec 9, 2019
  3. Eric SunshineDec 9, 2019
  4. Derrick StoleeDec 9, 2019
  5. René ScharfeDec 9, 2019
  6. Derrick StoleeDec 9, 2019
  7. Derrick StoleeDec 9, 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.