Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 98891
Status: resolved
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 804.032
Fixed in: 804.032_500

Attachments
Tk-804.032-Use-pipe-instead-of-stdin-in-t-fileevent2.t.patch



Subject: 'Fileevent callback should never be called' t/fileevent2.t test fails if stdin is not a tty
t/fileevent2.t is fails if standard input is not a TTY: $ xvfb-run -a prove -b t/fileevent2.t t/fileevent2.t .. ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.04 usr 0.02 sys + 0.11 cusr 0.05 csys = 0.22 CPU) Result: PASS $ xvfb-run -a prove -b t/fileevent2.t </dev/null t/fileevent2.t .. 1/1 # Failed test 'Fileevent callback should never be called' # at t/fileevent2.t line 50. # got: '109300' # expected: '0' This is especially true for automated headless test, e.g. when building the software. The reported number looks like a count of callback invocation the system manages in 300 time units ($mw->after(300,...)). The callback is invoked because the file reached end of file.
Subject: Re: [rt.cpan.org #98891] AutoReply: 'Fileevent callback should never be called' t/fileevent2.t test fails if stdin is not a tty
Date: Mon, 15 Sep 2014 10:22:36 +0200
To: Bugs in Tk via RT <bug-Tk [...] rt.cpan.org>
From: Petr Pisar <ppisar [...] redhat.com>
On Mon, Sep 15, 2014 at 03:44:23AM -0400, Bugs in Tk via RT wrote: Show quoted text
> > t/fileevent2.t is fails if standard input is not a TTY:
Attached patch fixes it. -- Petr
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
Download (untitled)
application/pgp-signature 213b

Message body not shown because it is not plain text.

On 2014-09-15 04:22:49, ppisar wrote: Show quoted text
> On Mon, Sep 15, 2014 at 03:44:23AM -0400, Bugs in Tk via RT wrote:
> > > > t/fileevent2.t is fails if standard input is not a TTY:
> > Attached patch fixes it. > > -- Petr
Thanks, applied in commit 31c08a9be4f04a2affacd213dedef43d49b9bd65