From 163f9d392927cd9902c4aec797b235e88766eacb Mon Sep 17 00:00:00 2001 From: Pablo Greco Date: Apr 01 2020 16:53:58 +0000 Subject: Fix tests for year 2020 Signed-off-by: Johnny Hughes --- diff --git a/SOURCES/perl-5.16-centos-fix-time-local-test.patch b/SOURCES/perl-5.16-centos-fix-time-local-test.patch new file mode 100644 index 0000000..f8d9e9b --- /dev/null +++ b/SOURCES/perl-5.16-centos-fix-time-local-test.patch @@ -0,0 +1,47 @@ +diff -aurp a/cpan/Time-Local/t/Local.t b/cpan/Time-Local/t/Local.t +--- a/cpan/Time-Local/t/Local.t 2013-03-04 15:16:21.000000000 +0000 ++++ b/cpan/Time-Local/t/Local.t 2020-04-01 16:16:17.707231959 +0000 +@@ -95,7 +95,7 @@ for (@time, @neg_time) { + + # Test timelocal() + { +- my $year_in = $year < 70 ? $year + 1900 : $year; ++ my $year_in = $year + 1900; + my $time = timelocal($sec,$min,$hour,$mday,$mon,$year_in); + + my($s,$m,$h,$D,$M,$Y) = localtime($time); +@@ -111,7 +111,7 @@ for (@time, @neg_time) { + + # Test timegm() + { +- my $year_in = $year < 70 ? $year + 1900 : $year; ++ my $year_in = $year + 1900; + my $time = timegm($sec,$min,$hour,$mday,$mon,$year_in); + + my($s,$m,$h,$D,$M,$Y) = gmtime($time); +@@ -129,7 +129,6 @@ for (@time, @neg_time) { + + for (@bad_time) { + my($year, $mon, $mday, $hour, $min, $sec) = @$_; +- $year -= 1900; + $mon--; + + eval { timegm($sec,$min,$hour,$mday,$mon,$year) }; +@@ -138,14 +137,14 @@ for (@bad_time) { + } + + { +- is(timelocal(0,0,1,1,0,90) - timelocal(0,0,0,1,0,90), 3600, ++ is(timelocal(0,0,1,1,0,1990) - timelocal(0,0,0,1,0,1990), 3600, + 'one hour difference between two calls to timelocal'); + +- is(timelocal(1,2,3,1,0,100) - timelocal(1,2,3,31,11,99), 24 * 3600, ++ is(timelocal(1,2,3,1,0,2000) - timelocal(1,2,3,31,11,1999), 24 * 3600, + 'one day difference between two calls to timelocal'); + + # Diff beween Jan 1, 1980 and Mar 1, 1980 = (31 + 29 = 60 days) +- is(timegm(0,0,0, 1, 2, 80) - timegm(0,0,0, 1, 0, 80), 60 * 24 * 3600, ++ is(timegm(0,0,0, 1, 2, 1980) - timegm(0,0,0, 1, 0, 1980), 60 * 24 * 3600, + '60 day difference between two calls to timegm'); + } + diff --git a/SPECS/perl.spec b/SPECS/perl.spec index bc6f0a6..c54c66e 100644 --- a/SPECS/perl.spec +++ b/SPECS/perl.spec @@ -183,6 +183,9 @@ Patch43: perl-5.16.3-Perl_my_setenv-handle-integer-wrap.patch # fixed in perl-libnet-1.23 Patch44: perl-5.16.3-Catch-timeout-condition-while-doing-an-abort.patch +# Fix 2020 test +Patch9999: perl-5.16-centos-fix-time-local-test.patch + # Update some of the bundled modules # see http://fedoraproject.org/wiki/Perl/perl.spec for instructions @@ -1987,6 +1990,8 @@ tarball from perl.org. %patch43 -p1 %patch44 -p1 +%patch9999 -p1 + %if !%{defined perl_bootstrap} # Local patch tracking perl -x patchlevel.h \