From: Jonathan Nieder <jrnieder@gmail.com>
To: Thomas Rast <trast@student.ethz.ch>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: [PATCH] tests: skip terminal output tests on OS X
Date: Thu, 17 Feb 2011 06:38:52 -0600 [thread overview]
Message-ID: <20110217123852.GD7740@elie> (raw)
In-Reply-To: <201102091538.46594.trast@student.ethz.ch>
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>
---
Thanks for a reminder.
I'd be interested to hear whether this happens on other BSDs, too.
It's possible that test_terminal should be using a select() loop
to wait for input to be ready or the child to die instead of
waiting on one while the other happens.
t/lib-terminal.sh | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/t/lib-terminal.sh b/t/lib-terminal.sh
index c383b57..58d911d 100644
--- a/t/lib-terminal.sh
+++ b/t/lib-terminal.sh
@@ -1,8 +1,24 @@
#!/bin/sh
-test_expect_success 'set up terminal for tests' '
- if
- test_have_prereq PERL &&
+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
--
1.7.4.1
prev parent reply other threads:[~2011-02-17 12:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-09 14:38 t7006 sometimes hangs in cronjobs on OS X Thomas Rast
2011-02-09 18:30 ` Ben Walton
2011-02-09 19:09 ` Jeff King
2011-02-09 19:16 ` Thomas Rast
2011-02-09 20:22 ` Thomas Rast
2011-02-09 20:50 ` Jeff King
2011-02-12 2:03 ` Jonathan Nieder
2011-02-12 2:05 ` Jonathan Nieder
2011-02-12 5:12 ` Jeff King
2011-02-12 8:37 ` Jonathan Nieder
2011-02-13 5:31 ` Jonathan Nieder
2011-02-17 12:38 ` Jonathan Nieder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110217123852.GD7740@elie \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).