Fix t/fileevent2.t failure with /dev/null on stdin

This commit is contained in:
Petr Písař 2014-09-15 10:20:27 +02:00
parent a0f6e2739a
commit 191d83c0a2
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,47 @@
From 2ac8da8459e36d0a5479d9a86855ab3925ce8789 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 15 Sep 2014 10:14:11 +0200
Subject: [PATCH] Use pipe instead of stdin in t/fileevent2.t
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
t/fileevent2.t fails if standard input is not a blocking descriptor
without read events. E.g. /dev/null. This patch uses a private pipe
instead of relying on stdin which can be anything.
CPAN RT#98891
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
t/fileevent2.t | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/t/fileevent2.t b/t/fileevent2.t
index 825ec31..ad22198 100755
--- a/t/fileevent2.t
+++ b/t/fileevent2.t
@@ -21,7 +21,7 @@ BEGIN {
}
}
-plan tests => 1;
+plan tests => 2;
my @fh;
my $callback_called = 0;
@@ -35,8 +35,10 @@ $mw->idletasks;
#
# tclUnixNotify.c used to do bit-handling for the select() mask
# itself, but this was broken for 64bit machines.
+my ($rpipe, $wpipe);
+ok(pipe($rpipe, $wpipe), 'create blocking descriptors');
for (1..100) {
- open my $dup, "<&", \*STDIN or die "Can't dup STDIN: $!";
+ open my $dup, "<&", $rpipe or die "Can't dup rpipe: $!";
push @fh, $dup;
$mw->fileevent($dup, "readable", sub { $callback_called++ });
}
--
1.9.3

View File

@ -28,6 +28,9 @@ Patch5: Tk-804.032-test-case-for-Tk-MainWindow-Create-without-args.patch
Patch6: Tk-804.032-update-comment-about-freetype.h-location.patch
# Fix race in tests
Patch7: Tk-804.032-fix-race-condition-in-errordialog.t.patch
# Fix t/fileevent2.t failure with /dev/null on stdin, bug #1141117,
# CPAN RT#98891
Patch8: Tk-804.032-Use-pipe-instead-of-stdin-in-t-fileevent2.t.patch
# Versions before this have Unicode issues
@ -150,6 +153,8 @@ chmod -x pod/Popup.pod Tixish/lib/Tk/balArrow.xbm
%patch6 -p1
# test race
%patch7 -p1
# t/fileevent2.t failure
%patch8 -p1
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor X11LIB=%{_libdir} XFT=1
@ -202,6 +207,7 @@ find __demos/ -type f -exec chmod -x {} \;
- Fix creating a window with perl 5.20 (bug #1141117)
- Enable X11 tests
- Specify all dependencies
- Fix t/fileevent2.t failure with /dev/null on stdin (bug #1141117)
* Tue Aug 26 2014 Jitka Plesnikova <jplesnik@redhat.com> - 804.032-3
- Perl 5.20 rebuild