Subject: Re: [PATCH 13/20] t: refactor tests depending on Perl for textconv scripts

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 25 Mar 2025 13:43:29 +0100

On Mon, Mar 24, 2025 at 04:16:22PM +0000, Phillip Wood wrote:
> Hi Patrick
> 
> On 20/03/2025 09:35, Patrick Steinhardt wrote:
> > We have a couple of tests that depend on Perl for textconv scripts.
> > Refactor these tests to instead be implemented via shell utilities so
> > that we can drop a couple of PERL_TEST_HELPERS prerequisites.
> > 
> > Note that not all of the conversions are a one-to-one equivalent to the
> > previous textconv scripts. But that's not really needed in the first
> > place: we only care that the textconv script does something, and that
> > can be verified trivially without having a full-blown invocation of
> > hexdump. So at times, the implementation of the textconv scripts is
> > reduced to their bare minimum.
> > > -cat >hexdump <<'EOF'
> > -#!/bin/sh
> > -"$PERL_PATH" -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
> > -EOF
> > -chmod +x hexdump
> > -
> >   test_expect_success 'setup binary file with history' '
> > +	write_script hexdump <<-\EOF &&
> > +	tr "\000\001" "01" <"$1"
> I guess it is fine just to handle the characters we expect at the moment (is
> that what the second paragraph of the commit message is referring to?), but
> the script it was more tolerant of future changes to the test data. We could
> always just use 'test-tool hexdump' here like the tests below but it is
> probably not worth a re-roll on its own.

That was my first version, but it required a bunch of changes to tests
all over the place. So I decided to simplify this test suite to do the
bare minimum.

Patrick