From: Johannes Sixt <j6t@kdbg.org>
To: Junio C Hamano <gitster@pobox.com>,
Eric Sunshine via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
Elijah Newren <newren@gmail.com>,
Fabian Stelzer <fs@gigacodes.de>,
Lessley Dennington <lessleydennington@gmail.com>,
Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH 3/3] t: detect and signal failure within loop
Date: Tue, 23 Aug 2022 08:30:03 +0200 [thread overview]
Message-ID: <103fa5ac-d67c-82a7-11b2-0ffee7570349@kdbg.org> (raw)
In-Reply-To: <xmqqfshoataq.fsf@gitster.g>
Am 22.08.22 um 22:59 schrieb Junio C Hamano:
> t5329: notice a failure within a loop
>
> We try to write "|| return 1" at the end of a sequence of &&-chained
> command in a loop of our tests, so that a failure of any step during
> the earlier iteration of the loop can properly be caught.
>
> There is one loop in this test script that is used to compute the
> expected result, that will be later compared with an actual output
> produced by the "test-tool pack-mtimes" command. This particular
> loop, however, is placed on the upstream side of a pipe, whose
> non-zero exit code does not get noticed.
>
> Emit a line that will never be produced by the "test-tool pack-mtimes"
> to cause the later comparison to fail. As we use test_cmp to compare
> this "expected output" file with the "actual output", the "error
> message" we are emitting into the expected output stream will stand
> out and shown to the tester.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> t/t5329-pack-objects-cruft.sh | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git c/t/t5329-pack-objects-cruft.sh w/t/t5329-pack-objects-cruft.sh
> index 6049e2c1d7..43d752acc7 100755
> --- c/t/t5329-pack-objects-cruft.sh
> +++ w/t/t5329-pack-objects-cruft.sh
> @@ -29,7 +29,8 @@ basic_cruft_pack_tests () {
> while read oid
> do
> path="$objdir/$(test_oid_to_path "$oid")" &&
> - printf "%s %d\n" "$oid" "$(test-tool chmtime --get "$path")"
> + printf "%s %d\n" "$oid" "$(test-tool chmtime --get "$path")" ||
> + echo "object list generation failed for $obj"
This looks like the right thing to do. But write $oid, not $obj.
> done |
> sort -k1
> ) >expect &&
>
>
-- Hannes
next prev parent reply other threads:[~2022-08-23 6:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-22 18:26 [PATCH 0/3] tests: fix broken &&-chains & abort loops on error Eric Sunshine via GitGitGadget
2022-08-22 18:26 ` [PATCH 1/3] t2407: fix broken &&-chains in compound statement Eric Sunshine via GitGitGadget
2022-08-22 18:26 ` [PATCH 2/3] t1092: fix buggy sparse "blame" test Eric Sunshine via GitGitGadget
2022-08-22 20:09 ` Derrick Stolee
2022-08-22 18:26 ` [PATCH 3/3] t: detect and signal failure within loop Eric Sunshine via GitGitGadget
2022-08-22 20:22 ` Junio C Hamano
2022-08-22 20:59 ` Junio C Hamano
2022-08-23 6:30 ` Johannes Sixt [this message]
2022-08-23 3:05 ` Elijah Newren
2022-08-28 4:50 ` Eric Sunshine
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=103fa5ac-d67c-82a7-11b2-0ffee7570349@kdbg.org \
--to=j6t@kdbg.org \
--cc=fs@gigacodes.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=lessleydennington@gmail.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.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).