Skip to content

Commit

Permalink
test-lib: limit the output of the yes utility
Browse files Browse the repository at this point in the history
On Windows, there is no SIGPIPE. A consequence of this is that the
upstream process of a pipe does not notice the death of the downstream
process until the pipe buffer is full and writing more data returns an
error. This behavior is the reason for an annoying delay during the
execution of t7610-mergetool.sh: There are a number of test cases where
'yes' is invoked upstream. Since the utility is basically an endless
loop it runs, on Windows, until the pipe buffer is full. This does take
a few seconds.

The test suite has its own implementation of 'yes'. Modify it to produce
only a limited amount of output that is sufficient for the test suite.
The amount chosen should be sufficiently high for any test case, assuming
that future test cases will not exaggerate their demands of input from
an upstream 'yes' invocation.

[j6t: commit message]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Feb 2, 2016
1 parent 7548842 commit 6129c93
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,11 @@ yes () {
y="$*"
fi

while echo "$y"
i=0
while test $i -lt 99
do
:
echo "$y"
i=$(($i+1))
done
}

Expand Down

0 comments on commit 6129c93

Please sign in to comment.