test: caution on our version of 'yes'
During a review of a patch, we noticed that we use our own imitation of 'yes' with the limit of 99 lines. It is very tempting to lift this arbitrary limit, but the limit is there for a reason. Add an in-code comment to prevent future developers from wasting their time. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Feb 9, 2019 at 10:25 UTC
11f470aee7ccd43bc2be159e69e121c35a72f91d
2 files changed
+14
-1
t/README
+9
@@ -927,6 +927,15 @@ library for your script to use.
927
test_oid_init or test_oid_cache. Providing an unknown key is an
928
error.
929
930
+ - yes [<string>]
931
+
932
+ This is often seen in modern UNIX but some platforms lack it, so
933
+ the test harness overrides the platform implementation with a
934
+ more limited one. Use this only when feeding a handful lines of
935
+ output to the downstream---unlike the real version, it generates
936
+ only up to 99 lines.
937
+
938
+
939
Prerequisites
940
-------------
941
t/test-lib.sh
+5
-1
@@ -1313,7 +1313,11 @@ then
1313
fi
1314
fi
1315
1316
-# Provide an implementation of the 'yes' utility
1316
+# Provide an implementation of the 'yes' utility; the upper bound
1317
+# limit is there to help Windows that cannot stop this loop from
1318
+# wasting cycles when the downstream stops reading, so do not be
1319
+# tempted to turn it into an infinite loop. cf. 6129c930 ("test-lib:
1320
+# limit the output of the yes utility", 2016-02-02)
1321
yes () {
1322
if test $# = 0
1323
then