Re: [PATCH v2 3/3] t/lib-httpd: avoid occasional failures when checking access.log

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 11, 2018 at 4:57 PM Jeff King <peff@xxxxxxxx> wrote:
>
> On Wed, Jul 11, 2018 at 02:56:47PM +0200, SZEDER Gábor wrote:
>
> > +# Requires one argument: the name of a file containing the expected stripped
> > +# access log entries.
> > +check_access_log() {
> > +     sort "$1" >"$1".sorted &&
> > +     strip_access_log >access.log.stripped &&
> > +     sort access.log.stripped >access.log.sorted &&
> > +     if ! test_cmp "$1".sorted access.log.sorted
> > +     then
> > +             test_cmp "$1" access.log.stripped
> > +     fi
> > +}
>
> This will generate output showing both the unsorted and sorted
> differences. Do we want to suppress the sorted ones (e.g., by just using
> "cmp" directly)? I guess it doesn't matter unless there is an actual
> test failure, but I just wonder if it would be confusing to see both.

I have no opinion about this, at all.  I tried it both ways back then,
and didn't find one any better than the other, so I just chose the
simpler-shorter one, i.e. no 2>/dev/null redirection in the condition.

> > diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
> > index 6cd986797d..a481e3989a 100755
> > --- a/t/t5541-http-push-smart.sh
> > +++ b/t/t5541-http-push-smart.sh
> > @@ -43,15 +43,13 @@ test_expect_success 'no empty path components' '
> >       cd "$ROOT_PATH" &&
> >       git clone $HTTPD_URL/smart/test_repo.git/ test_repo_clone &&
> >
> > -     strip_access_log >act &&
> > +     check_access_log exp
> > +'
> >
> > +test_expect_success 'clear access log' '
> >       # Clear the log, so that it does not affect the "used receive-pack
> >       # service" test which reads the log too.
> > -     #
> > -     # We do this before the actual comparison to ensure the log is cleared.
> > -     >"$HTTPD_ROOT_PATH"/access.log &&
> > -
> > -     test_cmp exp act
> > +     >"$HTTPD_ROOT_PATH"/access.log
> >  '
>
> This took some head-scratching, mostly because of the original comment.
> I thought the "before" here was referring to a timing issue (maybe
> because we're talking about timing ;) ).

Heh, I had to do some head-scratching now as well...  That's what I
get for updating the patch, and then waiting almost a month to finish
it up and update the commit message.

> But it is really "make sure that a failed test here does not prevent us
> from doing this cleanup". So the original really should have just
> dropped that comment and added a test_when_finished. Bumping it into a
> separate test as you have here accomplishes the same thing.

After taking a step back, I think this would fit better into the first
patch, wouldn't it?
I will send v3 shortly.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux