Re: t5570 shaky for anyone ?
- Date: Sun, 25 Nov 2018 23:22:47 +0100
- From: SZEDER Gábor <szeder.dev@xxxxxxxxx>
- Subject: Re: t5570 shaky for anyone ?
On Sun, Nov 25, 2018 at 09:52:23PM +0100, 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 think I saw the same failure on Travis CI already before 2.19, so
it's not a new issue. Here's the test's verbose output:
+ GIT_OVERRIDE_VIRTUAL_HOST=localhost git -c protocol.version=1 ls-remote git://127.0.0.1:5570/interp.git
+ cut -d -f2-
+ grep -i extended.attribute daemon.log
+ test_cmp expect actual
+ diff -u expect actual
--- expect 2018-06-12 10:06:50.758357927 +0000
+++ actual 2018-06-12 10:06:50.774365936 +0000
@@ -1,2 +0,0 @@
-Extended attribute "host": localhost
-Extended attribute "protocol": version=1
 Connection from 127.0.0.1:45836
 Extended attribute "host": localhost
 Extended attribute "protocol": version=1
error: last command exited with $?=1
 Request upload-pack for '/interp.git'
 Interpolated dir '/usr/src/git/t/trash
  Disconnected
not ok 21 - daemon log records all attributes
The thing is that 'git daemon's log is not written to 'daemon.log'
directly, but it goes through a fifo, which is read by a shell loop,
which then sends all log messages both to 'daemon.log' and to the test
script's standard error. So there is certainly a race between log
messages going through the fifo and the loop before reaching
'daemon.log' and 'git ls-remote' exiting and 'grep' opening
> The following fixes it, but I am not sure if this is the ideal
Currently this is the only test that looks at 'daemon.log', but if we
ever going to add another one, then that will be prone to the same
I wonder whether it's really that useful to have the daemon log in the
test script's output... if the log was sent directly to daemon log,
then the window for this race would be smaller, but still not
Anyway, I added Peff to Cc, since he added that whole fifo-shell-loop
> 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 ) &&