From: Junio C Hamano <gitster@pobox.com>
To: Andrei Rybak <rybak.a.v@gmail.com>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
"Git mailing list" <git@vger.kernel.org>,
"Kirill Smelkov" <kirr@nexedi.com>, "Jeff King" <peff@peff.net>
Subject: Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test
Date: Fri, 17 Aug 2018 13:09:09 -0700 [thread overview]
Message-ID: <xmqq4lfsbvru.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <eeb04c94-50c1-13ee-880b-ea380031a685@gmail.com> (Andrei Rybak's message of "Fri, 17 Aug 2018 21:27:22 +0200")
Andrei Rybak <rybak.a.v@gmail.com> writes:
> I think it would be a good trade-off to allow these helper functions to skip
> checking emptiness of arguments for test_cmp. Such patch will require only
> s/test_cmp/&_allow_empty/ for these helper functions and it will help catch
> cases as bogus test in t5310.
>
> I'll try something like the following on the weekend:
>
> test_cmp() {
Style: SP before and after ().
> if test "$1" != - && ! test -s "$1"
> then
> echo >&4 "error: trying to compare empty file '$1'"
> return 1
> fi
> if test "$2" != - && ! test -s "$2"
> then
> echo >&4 "error: trying to compare empty file '$2'"
> return 1
> fi
> test_cmp_allow_empty "$@"
> }
I actually think the above gives way too confusing output, when the
actual output is empty and we are expecting some output. I.e.
: >expect &&
git cmd >actual &&
test_cmp expect actual
The tester wants to hear from test_cmp "your 'git cmd' produced some
output when we are expecting none" as the primary message. We are
trying to find bugs in "git" under development, and diagnosing iffy
tests is secondary. But with your change, the first thing that is
checked is if 'expect' is an empty file and that is what we get
complaints about, without even looking at what is in 'actual'.
It's the same story, and it is even worse than the above, when we
are expecting some output but the command produced no output, i.e.
echo Everything up-to-date. >expect &&
git cmd >actual &&
test_cmp expect actual
We should get a complaint from test_cmp that 'actual' does not match
the string we were expecting (and even better, we show how they are
different by running them thru "diff -u"), not that 'actual' is an
empty file.
> test_cmp_allow_empty() {
> $GIT_TEST_CMP "$@"
> }
>
> (I'm not sure about redirections in test lib functions. The two if's would
> probably be in a separate function to be re-used by test_i18ncmp.)
next prev parent reply other threads:[~2018-08-17 20:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-14 11:47 [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test SZEDER Gábor
2018-08-14 21:49 ` Jeff King
2018-08-16 20:51 ` Andrei Rybak
2018-08-16 22:36 ` Junio C Hamano
2018-08-17 17:39 ` SZEDER Gábor
2018-08-17 19:27 ` Andrei Rybak
2018-08-17 20:09 ` Junio C Hamano [this message]
2018-08-19 17:50 ` Andrei Rybak
2018-08-19 20:32 ` Jeff King
2018-08-19 21:37 ` Andrei Rybak
2018-08-19 21:43 ` Jeff King
2018-08-21 21:52 ` Junio C Hamano
2018-08-17 20:15 ` SZEDER Gábor
2018-08-22 18:14 ` Matthew DeVore
2018-08-27 10:22 ` Kirill Smelkov
2018-08-27 23:04 ` Jeff King
2018-08-28 6:37 ` Kirill Smelkov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq4lfsbvru.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=kirr@nexedi.com \
--cc=peff@peff.net \
--cc=rybak.a.v@gmail.com \
--cc=szeder.dev@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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.