Skip Menu |
 

This queue is for tickets about the IO-Pager CPAN distribution.

Report information
The Basics
Id: 130596
Status: resolved
Priority: 0/
Queue: IO-Pager

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

Bug Information
Severity: (no value)
Broken in: 0.43
Fixed in: 0.44

Attachments
IO-Pager-0.43-Skip-t-11-redirect-oo.t-of-dev-tty-cannot-be-opened.patch



Subject: t/11-redirect-oo.t fails if /dev/tty cannot be opened
Download (untitled) / with headers
text/plain 3.3k
When running tests inside a Fedora mock tool (a build system that isolates the build environment and opening /dev/tty fails because there is no TTY), t/11-redirect-oo.t test fails: t/10-close_interactive.t ........... ok Warning: something's wrong at /builddir/build/BUILD/IO-Pager-0.43/blib/lib/IO/Pager.pm line 80. /usr/bin/more at /builddir/build/BUILD/IO-Pager-0.43/blib/lib/IO/Pager.pm line 83. Use of uninitialized value in subtraction (-) at /builddir/build/BUILD/IO-Pager-0.43/blib/lib/IO/Pager/tp line 315. No such device or address at /builddir/build/BUILD/IO-Pager-0.43/blib/lib/IO/Pager/tp line 15. # Failed test 'Redirection with OO' # at t/11-redirect-oo.t line 27. # # got: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla tincidunt fringilla lectus, et vestibulum sapien consectetur nec. Mauris at auctor ipsum. Phasellus a massa non lorem vulputate lobortis. Sed rutrum, eros vitae dignissim tempor, dui odio vulputate quam, eu suscipit turpis lorem commodo risus. Nulla augue metus, dictum in hendrerit et, ullamcorper vel tortor. Praesent at risus felis. Donec iaculis felis sit amet turpis laoreet volutpat. Nam eros tortor, fermentum id tristique in, hendrerit a nulla. Aliquam tincidunt ante ac elit ultrices et hendrerit ligula rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean vehicula sollicitudin nisi, sed commodo ipsum bibendum et. Proin vehicula aliquam placerat. Nulla congue sem nec urna venenatis semper sed sed tortor. Donec ut lectus nec risus mattis egestas eget sit amet lorem. In eros lectus, porta sed placerat at, aliquam a nunc. # # Nam commodo blandit aliquet. Suspendisse a orci arcu, sed euismod nibh. Curabitur at placerat est. Maecenas rutrum lacinia leo, sit amet cursus ante porttitor eu. Morbi a nisi in justo fringilla accumsan vehicula vel ante. Aliquam porta tempus ullamcorper. Etiam ac velit justo, vitae venenatis sem. Curabitur sit amet nibh magna. Proin adipiscing, dui et varius ultricies, purus sem luctus libero, id elementum neque augue et eros. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Curabitur rutrum congue arcu vel ultricies. Mauris consectetur sodales lorem et volutpat. # # Maecenas dictum condimentum erat vel consequat. Quisque eu risus libero, non ornare quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut viverra nisl arcu, nec mollis quam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque malesuada vestibulum est, vel lacinia lorem euismod nec. Nulla massa odio, consectetur ac scelerisque at, fermentum in metus. Duis vitae ipsum lacus, id rutrum felis. Nulla dapibus est eget mauris viverra malesuada sit amet sit amet elit. Sed sodales, turpis vitae eleifend dapibus, odio magna iaculis ante, quis sagittis tellus dolor nec risus. Fusce posuere enim vel dolor lobortis rutrum. Duis in erat nunc, et egestas libero. Morbi pellentesque semper eros ac vulputate. Donec ultricies tincidunt augue. # ' # expected: '' # # Looks like you failed 1 test of 1. # t/11-redirect-oo.t ................. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests A patch that skips the test when /dev/tty cannot be opened is attached.
Subject: IO-Pager-0.43-Skip-t-11-redirect-oo.t-of-dev-tty-cannot-be-opened.patch
From 5a1325e1bce6ef74bffbae017ce336c1ce9d33c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Mon, 30 Sep 2019 13:31:45 +0200 Subject: [PATCH] Skip t/11-redirect-oo.t of /dev/tty cannot be opened MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If /dev/tty cannot be opened, lib/IO/Pager/tp dies: Use of uninitialized value in subtraction (-) at /builddir/build/BUILD/IO-Pager-0.43/blib/lib/IO/Pager/tp line 315. No such device or address at /builddir/build/BUILD/IO-Pager-0.43/blib/lib/IO/Pager/tp line 15. # Failed test 'Redirection with OO' # at t/11-redirect-oo.t line 27. # # got: 'Lorem ipsum dolor sit amet, consectetur [...] This happens when running it in a Fedora mock tool. This patch simply skip the test in that case. Signed-off-by: Petr Písař <ppisar@redhat.com> --- t/11-redirect-oo.t | 10 +++++++--- t/TestUtils.pm | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/t/11-redirect-oo.t b/t/11-redirect-oo.t index c25315b..00e2c9b 100644 --- a/t/11-redirect-oo.t +++ b/t/11-redirect-oo.t @@ -23,9 +23,13 @@ TODO:{ $slurp =~ s/\n\n\z/\n/m; } - our $txt; require './t/08-redirect.pl'; - cmp_ok($txt, 'eq', $slurp, 'Redirection with OO') || $^O =~ /MSWin32/ && - diag("If this test fails on Windows and all others pass, things are probably good. CMD appends an extra newline to redirected output."); + SKIP: { + skip_no_tty(); + + our $txt; require './t/08-redirect.pl'; + cmp_ok($txt, 'eq', $slurp, 'Redirection with OO') || $^O =~ /MSWin32/ && + diag("If this test fails on Windows and all others pass, things are probably good. CMD appends an extra newline to redirected output."); + } } diff --git a/t/TestUtils.pm b/t/TestUtils.pm index 90b9fd9..e60579d 100644 --- a/t/TestUtils.pm +++ b/t/TestUtils.pm @@ -13,6 +13,7 @@ BEGIN { skip_interactive skip_old_perl skip_no_file_which + skip_no_tty skip_not_in_path is_no is_yes @@ -34,6 +35,11 @@ sub skip_no_file_which { skip "This test requires File::Which.", 1 if not eval { require File::Which }; } +sub skip_no_tty { + skip "/dev/tty cannot be opened.", 1 if not open(my $fh, '<', '/dev/tty'); + close $fh; +} + sub skip_not_in_path { # Test that the specified executable can be found in the PATH environment # variable using File::Which. -- 2.21.0


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.