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

Re: t5570 shaky for anyone ?

From
Jeff King <peff@peff.net>
Date
Nov 26, 2018, 16:42 UTC
Message-ID
<20181126164252.GA27711@sigill.intra.peff.net>
In-Reply-To
<20181125220138.GK4883@hank.intra.tgummerer.com>
On Sun, Nov 25, 2018 at 10:01:38PM +0000, Thomas Gummerer wrote:
Show 13 quoted lines
> On 11/25, Torsten Bögershausen wrote:
> > After running the  "Git 2.20-rc1" testsuite here on a raspi,
> > the only TC that failed was t5570.
> > When the "grep" was run on daemon.log, the file was empty (?).
> > When inspecting it later, it was filled, and grep would have found
> > the "extended.attribute" it was looking for.
> 
> I believe this has been reported before in
> https://public-inbox.org/git/1522783990.964448.1325338528.0D49CC15@webmail.messagingengine.com/,
> but it seems like the thread never ended with actually fixing it.
> Reading the first reply Peff seemed to be fine with just removing the
> test completely, which would be the easiest solution ;)  Adding him to
> Cc: here.

Yes, I don't think there is a way to make this race-proof without somehow convincing "cat" to flush (and let us know when it has). Which really implies killing the daemon, and wait()ing on cat to process the EOF and exit. And that makes the tests a lot more expensive if we have to start the daemon for each snippet.

So I'm still fine with just dropping this test.
Show 16 quoted lines
> > diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
> > index 7466aad111..e259fee0ed 100755
> > --- a/t/t5570-git-daemon.sh
> > +++ b/t/t5570-git-daemon.sh
> > @@ -192,6 +192,7 @@ test_expect_success 'daemon log records all attributes' '
> >  	GIT_OVERRIDE_VIRTUAL_HOST=localhost \
> >  		git -c protocol.version=1 \
> >  			ls-remote "$GIT_DAEMON_URL/interp.git" &&
> > +	sleep 1 &&
> >  	grep -i extended.attribute daemon.log | cut -d" " -f2- >actual &&
> >  	test_cmp expect actual
> >  '
> > ----------------
> > A slightly better approach may be to use a "sleep on demand":
> > 
> > +	( grep -i -q extended.attribute daemon.log || sleep 1 ) &&

That doesn't really fix it, but just broadens the race window. I dunno. Maybe that is enough in practice. We could do something like:

  repeat_with_timeout () {
	local i=0
	while test $i -lt 10
	do
		"$@" && return 0
		sleep 1
	done
	# no success even after 10 seconds
	return 1
  }
  repeat_with_timeout grep -i extended.attribute daemon.log

to make the pattern a bit more obvious (and make it easy to extend the window arbitrarily; surely 10s is enough?).

-Peff
Previous: Thomas GummererNext: Thomas Gummerer
Message 3 of 12 in “t5570 shaky for anyone ?”
  1. Torsten BögershausenNov 25, 2018
  2. Thomas GummererNov 25, 2018
  3. Jeff KingNov 26, 2018
  4. t5570: drop racy testThomas Gummerer, Dec 20, 2018
  5. Jeff KingDec 20, 2018
  6. Johannes SchindelinDec 21, 2018
  7. Thomas GummererJan 6, 2019
  8. 2/1 Revert "t/lib-git-daemon: record daemon log"Thomas Gummerer, Jan 6, 2019
  9. Jeff KingJan 7, 2019
  10. Junio C HamanoJan 7, 2019
  11. SZEDER GáborNov 25, 2018
  12. Jeff KingNov 26, 2018

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.