Re: [PATCH 2/2] diff tests: rewrite flakyness-causing test "aid"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 14, 2021, 06:35 UTC
- Message-ID
- <xmqqim4pz83e.fsf@gitster.g>
- In-Reply-To
- <874kg92xn0.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 23 quoted lines
> On Tue, Apr 13 2021, Matheus Tavares Bernardino wrote:
> ...
>>> >> actual="$pfx-diff.$test"
>>> >>
>>> >> test_expect_$status "git $cmd # magic is ${magic:-(not used)}" '
>>> >> + test_when_finished "rm $actual" &&
>>> >
>>> > Nit: before these two patches, "$actual" was only removed when the
>>> > test succeeded. So, in case of failure, the failed output files would
>>> > still be there for debugging. It might be interesting to keep this
>>> > behavior and only remove "$actual" at the end of the test.
> ...
> Ah, yes that's a problem we should solve, but I think we should not put
> off migration to test_when_finished because of that.
>
> The whole reason we use it is to clean up the work area for the next
> test.
>
> Thus if we do:
>
> git something >expected &&
> test_cmp expected actual &&
> rm expected actualIsn't it a poor example to use to argue for your particular change, where $actual in the original is designed to be unique among tests, in order to ensure that $actual files left after test pieces fail would not interfere with the tests that come later? IOW, there is not a reason to remove $actual until the end of the test sequence, is there?