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

Re: [JGIT PATCH 6/5 v2] Add tests for RevWalk and its supporting code

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 16, 2009, 14:33 UTC
Message-ID
<20090316143359.GM22920@spearce.org>
In-Reply-To
<200903151234.36812.robin.rosenberg.lists@dewire.com>
Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
Show 7 quoted lines
> 
> A few /09 interesting/ places in StartGenerator are not covered by the tests.
> 
> 		if (q instanceof DateRevQueue)
> 			pending = (DateRevQueue)q;
> 		else
> -->			pending = new DateRevQueue(q);

This one is difficult to test. Near as I can tell from the code in the revwalk package, it never happens. But if we did get here with a non date rev queue, DateRevQueue()'s constructor can copy the data from q over to one with no risk.

Perhaps just test this constructor in isolation?
Show 6 quoted lines
> and
> 
> 		if (tf != TreeFilter.ALL) {
> -->			rf = AndRevFilter.create(rf, new RewriteTreeFilter(w, tf));
> -->			pendingOutputType |= HAS_REWRITE | NEEDS_REWRITE;
> 		}

That says we have no tests on the path filter code. Adding one is likely to identify at least one bug. Clearly we need additional tests on the path filter sections. And it isn't just for this one little conditional; the entire RewriteTreeFilter and RewriteGenerator are untested right now.

I can work on adding more test coverage here, but its not in the
critical path for me at day-job right now.  The other problems I
tried to address in this series were.  So its lower in my queue
so-to-speak.  But I'll see what I can do in the near future to
write additional tests for this area of the revwalk package.
 
Show 8 quoted lines
> PendingGenerator
> 						if (n != null && n.commitTime >= last.commitTime) {
> 							// This is too close to call. The next commit we
> 							// would pop is dated after the last one produced.
> 							// We have to keep going to ensure that we carry
> 							// flags as much as necessary.
> 							//
> -->							overScan = OVER_SCAN;
*sigh*  We never get here in the test suite? I missed that.  I'll try to
work out a test case today and send an additional patch to get coverage
here.  I thought RevWalkCullTest testProperlyCullAllAncestors1() would
be hitting here.  It doesn't.
 
> I'll merge it anyway since this is still a huge improvement compared to the previous
> state.
Thanks.

A co-worker and I are also currently trying to track down a deadlock between C git-fetch and JGit upload-pack. Both get stuck waiting for the other to answer. Clearly its JGit's fault.

-- 
Shawn.
Previous: Robin Rosenberg
Message 13 of 13 in “RevWalk fixes for UNINTERESTING”
  1. 0/5 RevWalk fixes for UNINTERESTINGShawn O. Pearce, Mar 13, 2009
  2. 1/5 Show critical flags in debug toString() descriptions of rev queuesShawn O. Pearce, Mar 13, 2009
  3. 2/5 Make RevObject.getType implementations finalShawn O. Pearce, Mar 13, 2009
  4. 3/5 Remove the horribly stupid RevSort.START_ORDERShawn O. Pearce, Mar 13, 2009
  5. 4/5 Fix RevWalk with Linus Torvald's occasional bad commit date hackShawn O. Pearce, Mar 13, 2009
  6. 5/5 Avoid incorrect output of UNINTERESTING commits when clock skew occursShawn O. Pearce, Mar 13, 2009
  7. 4/5 Fix RevWalk with Linus Torvald's occasional bad commit date hackShawn O. Pearce, Mar 14, 2009
  8. Robin RosenbergMar 13, 2009
  9. 0/6 Add tests for RevWalk and its supporting codeShawn O. Pearce, Mar 13, 2009
  10. Shawn O. PearceMar 14, 2009
  11. 6/5 Add tests for RevWalk and its supporting codeShawn O. Pearce, Mar 14, 2009
  12. Robin RosenbergMar 15, 2009
  13. Shawn O. PearceMar 16, 2009

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.