From: Junio C Hamano <gitster@pobox.com>
To: "Martin Ågren" <martin.agren@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/3] t: drop debug `cat` calls
Date: Mon, 24 Feb 2020 11:32:57 -0800 [thread overview]
Message-ID: <xmqqlforpyqe.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <179c67caec0f8123d09455cb78532419166e1b9e.1582447606.git.martin.agren@gmail.com> ("Martin Ågren"'s message of "Sun, 23 Feb 2020 09:48:36 +0100")
Martin Ågren <martin.agren@gmail.com> writes:
> We `cat` files, but don't inspect or grab the contents in any way.
> Unlike in an earlier commit, there is no reason to suspect that these
> files could be missing, so `cat`-ing them is just wasted effort.
> ...
> rm -rf repo-cloned &&
> test_must_fail git clone repo repo-cloned 2>git-stderr.log &&
> - cat git-stderr.log &&
> grep "error: .missing-delay\.a. was not filtered properly" git-stderr.log
Loss of cat does not change if git-stderr.log file went missing for
whatever reason (e.g. typo while updating the test), just like 2/3,
so the debugging cruft can safely be removed.
> - $RUN for-each-reflog-ent HEAD >actual && cat actual &&
> + $RUN for-each-reflog-ent HEAD >actual &&
> head -n1 actual | grep first &&
Very similar, as lack of 'actual' for whatever reason will manifest
in a failure for "grep" from finding 'first' anyway.
I sort of sympathetic to your desire to have two classes and
separate/distribute them into 2/3 and 3/3, but to me the line
between two classes looks like it was drawn along a wrong axis.
The proposed log message for this step hints that the criteria for
tests to be thrown into this category is that the output of 'cat' is
not used in any useful way, and the input of 'cat' is known to exist
(i.e. so "cat fails if the file is missing" is not part of the test),
but that applies to the one instance singled out in 2/3 (i.e. the
file in question, kwdelfile.c, is created with shell redirection,
just like "actual" file above is).
> diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
> index 02478bc4ec..d09eff503c 100755
> --- a/t/t1450-fsck.sh
> +++ b/t/t1450-fsck.sh
> @@ -141,7 +141,6 @@ test_expect_success 'email without @ is okay' '
> git update-ref refs/heads/bogus "$new" &&
> test_when_finished "git update-ref -d refs/heads/bogus" &&
> git fsck 2>out &&
> - cat out &&
> ! grep "commit $new" out
> '
This one on the other hand *DOES* rely on 'out' being created; we do
not want to take the failing 'grep' as a sign of success if it is
because 'out' is missing.
> diff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh
> index 2242cd098e..a30b7ca6bc 100755
> --- a/t/t2107-update-index-basic.sh
> +++ b/t/t2107-update-index-basic.sh
> @@ -9,7 +9,6 @@ Tests for command-line parsing and basic operation.
>
> test_expect_success 'update-index --nonsense fails' '
> test_must_fail git update-index --nonsense 2>msg &&
> - cat msg &&
> test -s msg
> '
This one does not. "test -s msg" on non-existent msg will fail, so
this is closer to category 2/3.
So, I am OK to have two patches that catch two classes, but the
division between 2/3 and 3/3 in this series does not look the right
one.
I am also OK to have a single patch with updated log message, saying
"removal of 'cat <file>' may miss a failure mode that <file> did not
get created, which would have been caught as a test failure in the
original, but the <file>s used by cats removed in this patch are
either impossible to be missing (because a preceding step in the
test created it, or the &&-cascade would have failed if it failed to
create the file), or followed by another step in the test that would
fail if the file is missing (e.g. running grep on the file), so it is
safe to drop these cats", or something like that.
next prev parent reply other threads:[~2020-02-24 19:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-23 8:48 [PATCH 1/3] t4117: check for files using `test_path_is_file` Martin Ågren
2020-02-23 8:48 ` [PATCH 2/3] t9810: drop debug `cat` call Martin Ågren
2020-02-24 19:18 ` Junio C Hamano
2020-02-23 8:48 ` [PATCH 3/3] t: drop debug `cat` calls Martin Ågren
2020-02-24 19:32 ` Junio C Hamano [this message]
2020-02-24 20:24 ` Martin Ågren
2020-02-24 20:49 ` Junio C Hamano
2020-02-23 21:46 ` [PATCH 1/3] t4117: check for files using `test_path_is_file` Jeff King
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=xmqqlforpyqe.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=martin.agren@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 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 NNTP newsgroup(s).