git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Stephan Beyer <s-beyer@gmx.net>
Cc: git@vger.kernel.org, Tarmigan Casebolt <tarmigan+git@gmail.com>
Subject: Re: [PATCH] t5561: get rid of racy appending to logfile
Date: Wed, 23 Sep 2015 21:45:41 -0400	[thread overview]
Message-ID: <20150924014541.GB6442@sigill.intra.peff.net> (raw)
In-Reply-To: <1443054017-8312-1-git-send-email-s-beyer@gmx.net>

On Thu, Sep 24, 2015 at 02:20:17AM +0200, Stephan Beyer wrote:

> The definition of log_div() appended information to the web server's
> logfile to make the test more readable. However, it could happen that
> this information is written before the web server writes its log line
> (this consistently happens with a PROFILE=GEN build), and hence the
> test failed.

I don't know if you want to add more detail here or not, but I believe
the race is based on the amount of time between git-http-backend
finishes serving the request, and when the process exits. We run
log_div() as soon as the first is done, but Apache waits for the latter
to flush out the logfile. And PROFILE=GEN lengthens that time.

> To get rid of this behavior, the logfile is not touched at all. This
> commit removes log_div() and its calls. The readability-improving
> information is kept in the test but filtered out before comparing
> it to the actual logfile.
> 
> Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
> ---
>  t/t5560-http-backend-noserver.sh |  4 ----
>  t/t5561-http-backend.sh          |  8 +-------
>  t/t556x_common                   | 12 ------------
>  3 files changed, 1 insertion(+), 23 deletions(-)

This looks good to me.

I'd have written the grep as:

> -cat >exp <<EOF
> +grep -e '^[GP]' >exp <<EOF

grep '^[^#]' >exp <<EOF

to exclude blank lines and comments, but I doubt it matters in practice
(I cannot imagine any line except GET or POST here).

-Peff

  reply	other threads:[~2015-09-24  1:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 23:21 t5561 failing after make PROFILE=GEN Stephan Beyer
2015-09-23 23:24 ` Jeff King
2015-09-24  0:20   ` [PATCH] t5561: get rid of racy appending to logfile Stephan Beyer
2015-09-24  1:45     ` Jeff King [this message]
2015-09-24 18:12       ` Stephan Beyer
2015-09-24 18:23         ` Jeff King
2015-09-25 15:50         ` Junio C Hamano
2015-09-24  0:22   ` t5561 failing after make PROFILE=GEN Stephan Beyer
2015-09-24  1:41     ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2015-09-24 23:31 [PATCH] t5561: get rid of racy appending to logfile Stephan Beyer
2015-09-25 17:44 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150924014541.GB6442@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=s-beyer@gmx.net \
    --cc=tarmigan+git@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).