commit 1c213f17bb8371f86c86a56fe3759f7219e69f13 Author: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@xxxxxxxxxx> Date: Fri Dec 17 11:08:02 2010 +0100 Some tests failed on probability basis. ...ndom-0.05-Check-if-_to_secs-returns-undef.patch | 81 ++++++++++++++++++++ perl-Data-Random.spec | 7 ++- 2 files changed, 87 insertions(+), 1 deletions(-) --- diff --git a/perl-Data-Random-0.05-Check-if-_to_secs-returns-undef.patch b/perl-Data-Random-0.05-Check-if-_to_secs-returns-undef.patch new file mode 100644 index 0000000..078ff4f --- /dev/null +++ b/perl-Data-Random-0.05-Check-if-_to_secs-returns-undef.patch @@ -0,0 +1,81 @@ +From 7dcdfa9edfc632609b3fc99aabb46a40b0083875 Mon Sep 17 00:00:00 2001 +From: Niko Tyni <ntyni@xxxxxx> +Date: Fri, 17 Dec 2010 10:35:33 +0100 +Subject: [PATCH] Check if _to_secs() returns undef + +t/rand_time.t fails when rand_time() returns "00:00:00", since +_to_secs() then returns 0 which evaluates to false. This happens with a +probability of about 7 % and was found in an automatic build of the Debian +packaged version of Data::Random. + +https://rt.cpan.org/Public/Bug/Display.html?id=27392 +--- + t/rand_datetime.t | 10 +++++----- + t/rand_time.t | 2 +- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/t/rand_datetime.t b/t/rand_datetime.t +index b7a2118..00d8993 100755 +--- a/t/rand_datetime.t ++++ b/t/rand_datetime.t +@@ -35,7 +35,7 @@ SKIP: { + + $pass = 0 + unless $delta >= 0 && $delta <= $max_days +- && _to_secs( ( split ( / /, $date ) )[1] ); ++ && defined( _to_secs( ( split ( / /, $date ) )[1] ) ); + + $i++; + } +@@ -59,7 +59,7 @@ SKIP: { + + $pass = 0 + unless $delta >= 0 && $delta <= $max_days +- && _to_secs( ( split ( / /, $date ) )[1] ); ++ && defined( _to_secs( ( split ( / /, $date ) )[1] ) ); + + $i++; + } +@@ -89,7 +89,7 @@ SKIP: { + + $pass = 0 + unless $delta >= 0 && $delta <= $max_days +- && _to_secs( ( split ( / /, $date ) )[1] ); ++ && defined( _to_secs( ( split ( / /, $date ) )[1] ) ); + + $i++; + } +@@ -121,7 +121,7 @@ SKIP: { + + $pass = 0 + unless $delta >= 0 && $delta <= $max_days +- && _to_secs( ( split ( / /, $date ) )[1] ); ++ && defined( _to_secs( ( split ( / /, $date ) )[1] ) ); + + $i++; + } +@@ -139,7 +139,7 @@ SKIP: { + + $pass = 0 + unless $new_year == $year && $new_month == $month && $new_day == $day +- && _to_secs( ( split ( / /, $date ) )[1] ); ++ && defined( _to_secs( ( split ( / /, $date ) )[1] ) ); + + ok($pass); + } +diff --git a/t/rand_time.t b/t/rand_time.t +index 1f9b656..3592c7e 100755 +--- a/t/rand_time.t ++++ b/t/rand_time.t +@@ -16,7 +16,7 @@ use Data::Random qw( rand_time ); + while ( $pass && $i < $max_secs ) { + my $time = rand_time(); + +- $pass = 0 unless _to_secs($time); ++ $pass = 0 unless defined( _to_secs($time) ); + + $i++; + } +-- +1.7.3.3 + diff --git a/perl-Data-Random.spec b/perl-Data-Random.spec index 91fa1bf..4e6280a 100644 --- a/perl-Data-Random.spec +++ b/perl-Data-Random.spec @@ -1,11 +1,12 @@ Name: perl-Data-Random Version: 0.05 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Perl module to generate random data License: GPL+ or Artistic Group: Development/Libraries URL: http://search.cpan.org/dist/Data-Random/ Source0: http://www.cpan.org/authors/id/A/AD/ADEO/Data-Random-%{version}.tar.gz +Patch0: perl-Data-Random-0.05-Check-if-_to_secs-returns-undef.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: perl(Date::Calc) @@ -21,6 +22,7 @@ A module used to generate random data. Useful mostly for test programs. %prep %setup -q -n Data-Random-%{version} +%patch0 -p1 -b .test chmod 644 Random.pm README.linux.words README2.linux.words Random/WordList.pm %build @@ -50,6 +52,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man3/* %changelog +* Fri Dec 17 2010 Petr Pisar <ppisar@xxxxxxxxxx> - 0.05-4 +- Fix tests per RT#27392 + * Thu Dec 16 2010 Marcela Maslanova <mmaslano@xxxxxxxxxx> - 0.05-3 - 661697 rebuild for fixing problems with vendorach/lib -- Fedora Extras Perl SIG http://www.fedoraproject.org/wiki/Extras/SIGs/Perl perl-devel mailing list perl-devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/perl-devel