mirror of
https://github.com/git/git.git
synced 2024-10-30 13:57:54 +01:00
339e5638b0
On Mac OS X 10.5.0, test_terminal gets stuck reading from the pty master every once in a while. To reproduce the problem: perl -MIO::Pty -MFile::Copy -e ' for (my $i = 0;; $i++) { my $master = new IO::Pty; my $slave = $master->slave; if (fork == 0) { close $master or die "close: $!"; open STDOUT, ">&", $slave or die "dup2: $!"; close $slave or die "close: $!"; exec("echo", "hi", $i) or die "exec: $!"; } close $slave or die "close: $!"; copy($master, \*STDOUT) or die "copy: $!"; close $master or die "close: $!"; wait; } ' It blocks after 7000 iterations or so in sysread(). The relevant sysread() call is the second call by the parent, which presumably executes before the child dies but after the parent has read all output from there. Since this is an intermitent problem, the quick check of terminal support in lib-terminal doesn't catch it. Skip these tests on the Mac for now. Noticed-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
35 lines
777 B
Bash
35 lines
777 B
Bash
#!/bin/sh
|
|
|
|
test_expect_success PERL 'set up terminal for tests' '
|
|
# Reading from the pty master seems to get stuck _sometimes_
|
|
# on Mac OS X 10.5.0, using Perl 5.10.0 or 5.8.9.
|
|
#
|
|
# Reproduction recipe: run
|
|
#
|
|
# i=0
|
|
# while ./test-terminal.perl echo hi $i
|
|
# do
|
|
# : $((i = $i + 1))
|
|
# done
|
|
#
|
|
# After 2000 iterations or so it hangs.
|
|
# https://rt.cpan.org/Ticket/Display.html?id=65692
|
|
#
|
|
if test "$(uname -s)" = Darwin
|
|
then
|
|
:
|
|
elif
|
|
"$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl \
|
|
sh -c "test -t 1 && test -t 2"
|
|
then
|
|
test_set_prereq TTY &&
|
|
test_terminal () {
|
|
if ! test_declared_prereq TTY
|
|
then
|
|
echo >&4 "test_terminal: need to declare TTY prerequisite"
|
|
return 127
|
|
fi
|
|
"$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl "$@"
|
|
}
|
|
fi
|
|
'
|