Skip to content

Commit 01486b5

Browse files
pks-tgitster
authored andcommitted
t: adapt test_copy_bytes() to not use Perl
The `test_copy_bytes()` helper function copies up to N bytes from stdin to stdout. This is implemented using Perl, but it can be trivially adapted to instead use dd(1). Refactor the helper accordingly, which allows a bunch of tests to pass when Perl is not available. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2df6710 commit 01486b5

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

t/test-lib-functions.sh

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,17 +1640,7 @@ test_match_signal () {
16401640

16411641
# Read up to "$1" bytes (or to EOF) from stdin and write them to stdout.
16421642
test_copy_bytes () {
1643-
perl -e '
1644-
my $len = $ARGV[1];
1645-
while ($len > 0) {
1646-
my $s;
1647-
my $nread = sysread(STDIN, $s, $len);
1648-
die "cannot read: $!" unless defined($nread);
1649-
last unless $nread;
1650-
print $s;
1651-
$len -= $nread;
1652-
}
1653-
' - "$1"
1643+
dd ibs=1 count="$1" 2>/dev/null
16541644
}
16551645

16561646
# run "$@" inside a non-git directory

0 commit comments

Comments
 (0)