From: Taylor Blau <me@ttaylorr.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Taylor Blau <me@ttaylorr.com>,
git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Phillip Wood <phillip.wood123@gmail.com>,
Calvin Wan <calvinwan@google.com>
Subject: Re: [PATCH 2/3] submodule tests: reset "trace.out" between "grep" invocations
Date: Mon, 31 Oct 2022 19:58:56 -0400 [thread overview]
Message-ID: <Y2BhQHynNWkl6cbY@nand.local> (raw)
In-Reply-To: <221031.86pme86tcg.gmgdl@evledraar.gmail.com>
On Mon, Oct 31, 2022 at 01:50:07PM +0100, Ævar Arnfjörð Bjarmason wrote:
> >> (
> >> cd downstream &&
> >> GIT_TRACE=$(pwd)/trace.out git fetch &&
> >> grep "1 tasks" trace.out &&
> >> + >trace.out &&
> >> +
> >
> > I fail to see why these hunks are necessary. If we specify GIT_TRACE,
> > and don't have a test_must_fail around the execution, then why should we
> > feel obligated to clean up the trace.out after every execution?
>
> Because the trace file isn't clobbered by each git command that
> specifies GIT_TRACE, so these tests are basically doing:
>
> (echo foo; echo bar) >>trace &&
> grep foo trace &&
>
> (echo bar) >>trace &&
> grep bar trace
>
> Now, it just so happens that the earlier command isn't echoing "bar" to
> the file, so this is currently working out.
Ah, nicely explained. This is new to me, since I thought the behavior of
both GIT_TRACE and GIT_TRACE2 was to clobber the file.
> But it's a bad pattern to be pretending as though you care about the
> last output (which was the intent of the test), when really what you're
> testing is the combined output of all preceding commands.
>
> This would also be a potenital landmine with "test_must_fail", just
> because the command failed we're not guaranteed to have written nothing
> to the log (and usually we'd get as far as to write something).
Yeah, both make sense, thanks.
Thanks,
Taylor
next prev parent reply other threads:[~2022-10-31 23:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-29 2:59 [PATCH 0/3] tests: improve misc run-command, hook, submodule tests Ævar Arnfjörð Bjarmason
2022-10-29 2:59 ` [PATCH 1/3] hook tests: fix redirection logic error in 96e7225b310 Ævar Arnfjörð Bjarmason
2022-10-29 20:11 ` Taylor Blau
2022-10-31 12:44 ` Ævar Arnfjörð Bjarmason
2022-10-31 23:56 ` Taylor Blau
2022-10-29 2:59 ` [PATCH 2/3] submodule tests: reset "trace.out" between "grep" invocations Ævar Arnfjörð Bjarmason
2022-10-29 20:13 ` Taylor Blau
2022-10-31 12:50 ` Ævar Arnfjörð Bjarmason
2022-10-31 23:58 ` Taylor Blau [this message]
2022-10-29 2:59 ` [PATCH 3/3] run-command tests: test stdout of run_command_parallel() Ævar Arnfjörð Bjarmason
2022-10-29 20:15 ` Taylor Blau
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=Y2BhQHynNWkl6cbY@nand.local \
--to=me@ttaylorr.com \
--cc=avarab@gmail.com \
--cc=calvinwan@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood123@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).