ppisar pushed to perl-Log-Dispatch-Config (f21). "Adjust tests to changes in Log-Dispatch-2.47"

notifications at fedoraproject.org notifications at fedoraproject.org
Wed Sep 2 12:17:40 UTC 2015


From 4711ecc024f2e90f6fcc6413acb5c70977a63df3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
Date: Wed, 2 Sep 2015 13:57:22 +0200
Subject: Adjust tests to changes in Log-Dispatch-2.47


diff --git a/Log-Dispatch-Config-1.04-Adjust-tests-to-Log-Dispatch-2.47.patch b/Log-Dispatch-Config-1.04-Adjust-tests-to-Log-Dispatch-2.47.patch
new file mode 100644
index 0000000..4e3d1f5
--- /dev/null
+++ b/Log-Dispatch-Config-1.04-Adjust-tests-to-Log-Dispatch-2.47.patch
@@ -0,0 +1,173 @@
+From e6b25b4fcacd10f6832a8fa6686817f905d0deec Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Wed, 2 Sep 2015 13:52:04 +0200
+Subject: [PATCH] Adjust tests to Log-Dispatch-2.47
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Since Log-Dispatch-2.47, Log::Dispatch::Screen logs into file
+handle associated with STDERR. This overloading STDERR's I/O methods
+by tying to IO::Scalar does not work anymore.
+
+This patch replaces the IO::Scalar capturing by regular forked process
+using IPC::Run3.
+
+CPAN RT#106746
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ Makefile.PL      |  2 +-
+ t/02_log.t       | 21 ++++++++++++---------
+ t/03_reload.t    |  1 -
+ t/04_nolog.t     |  1 -
+ t/08_datetime.t  | 16 +++++++++++-----
+ t/11_no_watch.t  |  1 -
+ t/13_do_reload.t |  1 -
+ 7 files changed, 24 insertions(+), 19 deletions(-)
+
+diff --git a/Makefile.PL b/Makefile.PL
+index 3074d07..1044eb7 100644
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -20,7 +20,7 @@ WriteMakefile(
+ 	Test::More => 0.32,
+ 	Log::Dispatch => 2.00,
+ 	AppConfig => 1.52,
+-	IO::Scalar => 0,
++	IPC::Run3 => 0,
+ 	File::Temp => 0.12,
+     },
+ );
+diff --git a/t/02_log.t b/t/02_log.t
+index 857bb31..0e1bd6c 100644
+--- a/t/02_log.t
++++ b/t/02_log.t
+@@ -1,9 +1,8 @@
+ use strict;
+-use Test::More tests => 4;
++use Test::More tests => 5;
+ 
+-use Log::Dispatch::Config;
+ use FileHandle;
+-use IO::Scalar;
++use IPC::Run3 ();
+ use File::Spec;
+ 
+ sub slurp {
+@@ -16,18 +15,22 @@ my $log;
+ BEGIN { $log = 't/log.out'; unlink $log if -e $log }
+ END   { unlink $log if -e $log }
+ 
++my $code =<<'CODE';
++use Log::Dispatch::Config;
+ Log::Dispatch::Config->configure('t/log.cfg');
+ 
++my $disp = Log::Dispatch::Config->instance;
++$disp->debug('debug');
++$disp->alert('alert');
++CODE
++
+ my $err;
+ {
+-    tie *STDERR, 'IO::Scalar', \$err;
+-
+-    my $disp = Log::Dispatch::Config->instance;
+-    $disp->debug('debug');
+-    $disp->alert('alert');
++    my $retval = IPC::Run3::run3([$^X, '-e' , $code], \undef, \undef, \$err);
++    ok (($retval and $? == 0), 'Code executed successfully');
+ }
+ 
+-my $filename = __FILE__;
++my $filename = '-e line ';
+ my $file = slurp $log;
+ like $file, qr(debug at \Q$filename\E), 'debug';
+ like $file, qr(alert at \Q$filename\E), 'alert';
+diff --git a/t/03_reload.t b/t/03_reload.t
+index 62fc906..60b778d 100644
+--- a/t/03_reload.t
++++ b/t/03_reload.t
+@@ -5,7 +5,6 @@ use Log::Dispatch::Config;
+ use FileHandle;
+ use File::Copy;
+ use File::Temp qw(tempfile);
+-use IO::Scalar;
+ 
+ if( $^O eq 'MSWin32' ) {
+     plan skip_all => 'These tests fail in Win32 for silly reasons';
+diff --git a/t/04_nolog.t b/t/04_nolog.t
+index 4cf7f20..5162618 100644
+--- a/t/04_nolog.t
++++ b/t/04_nolog.t
+@@ -4,7 +4,6 @@ use Test::More tests => 1;
+ use Log::Dispatch::Config;
+ use FileHandle;
+ use File::Temp qw(tempfile);
+-use IO::Scalar;
+ 
+ sub writefile {
+     my $fh = FileHandle->new(">" . shift) or die $!;
+diff --git a/t/08_datetime.t b/t/08_datetime.t
+index 21e1165..98f64d9 100644
+--- a/t/08_datetime.t
++++ b/t/08_datetime.t
+@@ -1,20 +1,26 @@
+ use strict;
+-use Test::More tests => 3;
++use Test::More tests => 4;
+ 
+-use IO::Scalar;
++use IPC::Run3 ();
+ 
++my $code=<<'CODE';
+ use Log::Dispatch::Config;
+ Log::Dispatch::Config->configure('t/date.cfg');
+ 
+ my $disp = Log::Dispatch::Config->instance;
+-isa_ok $disp->{outputs}->{screen}, 'Log::Dispatch::Screen';
++print $disp->{outputs}->{screen}->isa('Log::Dispatch::Screen');
++
++$disp->debug('debug');
++CODE
+ 
+ {
+     my($mday, $mon, $year) = (localtime(time))[3..5];
+     my $today = sprintf '%04s%02d%02d', $year + 1900, $mon + 1, $mday;
+ 
+-    tie *STDERR, 'IO::Scalar', \my $err;
+-    $disp->debug('debug');
++    my ($out, $err);
++    my $retval = IPC::Run3::run3([$^X, '-e' , $code], \undef, \$out, \$err);
++    ok (($retval and $? == 0), 'Code executed successfully');
++    is ($out, '1', q{dispatcher's class matched});
+ 
+     like $err, qr/$today/, $err;
+     like $err, qr/debug/, $err;
+diff --git a/t/11_no_watch.t b/t/11_no_watch.t
+index 041378d..b3f2009 100644
+--- a/t/11_no_watch.t
++++ b/t/11_no_watch.t
+@@ -5,7 +5,6 @@ use Log::Dispatch::Config;
+ use FileHandle;
+ use File::Copy;
+ use File::Temp qw(tempfile);
+-use IO::Scalar;
+ 
+ my($fh, $file) = tempfile;
+ copy("t/foo.cfg", $file);
+diff --git a/t/13_do_reload.t b/t/13_do_reload.t
+index 340e193..62125ee 100644
+--- a/t/13_do_reload.t
++++ b/t/13_do_reload.t
+@@ -5,7 +5,6 @@ use Log::Dispatch::Config;
+ use FileHandle;
+ use File::Copy;
+ use File::Temp qw(tempfile);
+-use IO::Scalar;
+ 
+ my($fh, $file) = tempfile;
+ copy("t/foo.cfg", $file);
+-- 
+2.4.3
+
diff --git a/perl-Log-Dispatch-Config.spec b/perl-Log-Dispatch-Config.spec
index 418d558..7deec87 100644
--- a/perl-Log-Dispatch-Config.spec
+++ b/perl-Log-Dispatch-Config.spec
@@ -1,11 +1,13 @@
 Name:           perl-Log-Dispatch-Config
 Summary:        Log4j for Perl        
 Version:        1.04
-Release:        7%{?dist}
+Release:        8%{?dist}
 License:        GPL+ or Artistic        
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Log-Dispatch-Config
 Source0:        http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/Log-Dispatch-Config-%{version}.tar.gz 
+# Adjust tests to changes in Log-Dispatch-2.47, bug #1258920, CPAN RT#106746
+Patch0:         Log-Dispatch-Config-1.04-Adjust-tests-to-Log-Dispatch-2.47.patch
 BuildArch:      noarch
 BuildRequires:  perl(ExtUtils::MakeMaker)
 # Run-time
@@ -19,7 +21,7 @@ BuildRequires:  perl(POSIX)
 BuildRequires:  perl(FileHandle)
 BuildRequires:  perl(File::Copy)
 BuildRequires:  perl(File::Temp) >= 0.12
-BuildRequires:  perl(IO::Scalar)
+BuildRequires:  perl(IPC::Run3)
 BuildRequires:  perl(Test::More) >= 0.32
 Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
 Requires:       perl(AppConfig) >= 1.52
@@ -35,6 +37,7 @@ format).
 
 %prep
 %setup -q -n Log-Dispatch-Config-%{version}
+%patch0 -p1
 
 %build
 %{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
@@ -57,6 +60,9 @@ make test
 
 
 %changelog
+* Wed Sep 02 2015 Petr Pisar <ppisar at redhat.com> - 1.04-8
+- Adjust tests to changes in Log-Dispatch-2.47 (bug #1258920)
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.04-7
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/perl-Log-Dispatch-Config.git/commit/?h=f21&id=4711ecc024f2e90f6fcc6413acb5c70977a63df3


More information about the perl-devel mailing list