aboutsummaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-09-08 21:39:38 -0700
committerJunio C Hamano <gitster@pobox.com>2016-09-08 21:39:38 -0700
commit49981d8a250837019b4a14f44d471fc6ff7e334f (patch)
treec3394268eaaade296d7de692fe7e76bacb3be97b /t/test-lib-functions.sh
parent0202c411edc25940cc381bf317badcdf67670be4 (diff)
parent6ebdac1bab966b720d776aa43ca188fe378b1f4b (diff)
downloadgit-49981d8a250837019b4a14f44d471fc6ff7e334f.tar.gz
git-49981d8a250837019b4a14f44d471fc6ff7e334f.tar.xz
Start maintenance track for 2.10.x series
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index ca40a1289..4f7eadb59 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -976,3 +976,17 @@ test_match_signal () {
fi
return 1
}
+
+# Read up to "$1" bytes (or to EOF) from stdin and write them to stdout.
+test_copy_bytes () {
+ perl -e '
+ my $len = $ARGV[1];
+ while ($len > 0) {
+ my $s;
+ my $nread = sysread(STDIN, $s, $len);
+ die "cannot read: $!" unless defined($nread);
+ print $s;
+ $len -= $nread;
+ }
+ ' - "$1"
+}