From 2510e877e65e7a207b2d3b692896b9e3231c0737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 22 Aug 2017 09:54:15 +0200 Subject: [PATCH] Fix unreliable Time-HiRes tests --- ...-unreliable-t-usleep.t-and-t-utime.t.patch | 73 +++++++++++++++++++ perl.spec | 10 ++- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 perl-5.26.0-Time-HiRes-Fix-unreliable-t-usleep.t-and-t-utime.t.patch diff --git a/perl-5.26.0-Time-HiRes-Fix-unreliable-t-usleep.t-and-t-utime.t.patch b/perl-5.26.0-Time-HiRes-Fix-unreliable-t-usleep.t-and-t-utime.t.patch new file mode 100644 index 0000000..206aeea --- /dev/null +++ b/perl-5.26.0-Time-HiRes-Fix-unreliable-t-usleep.t-and-t-utime.t.patch @@ -0,0 +1,73 @@ +From 8985b12868f07d9ef501580d600e49fe8f230eb4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 22 Aug 2017 09:49:42 +0200 +Subject: [PATCH] Time-HiRes: Fix unreliable t/usleep.t and t/utime.t +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Ported from Time-HiRes-1.9746. + +The tests randomly failed on loaded machines because a CPU scheduler +could add unpredictable delays. + +CPAN RT#122819 + +Signed-off-by: Petr Písař +--- + dist/Time-HiRes/t/usleep.t | 4 ++-- + dist/Time-HiRes/t/utime.t | 9 +++++---- + 2 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/dist/Time-HiRes/t/usleep.t b/dist/Time-HiRes/t/usleep.t +index 9322458..bb66cbe 100644 +--- a/dist/Time-HiRes/t/usleep.t ++++ b/dist/Time-HiRes/t/usleep.t +@@ -32,7 +32,7 @@ SKIP: { + Time::HiRes::usleep(500_000); + my $f2 = Time::HiRes::time(); + my $d = $f2 - $f; +- ok $d > 0.4 && $d < 0.9 or print("# slept $d secs $f to $f2\n"); ++ ok $d > 0.49 or print("# slept $d secs $f to $f2\n"); + } + + SKIP: { +@@ -40,7 +40,7 @@ SKIP: { + my $r = [ Time::HiRes::gettimeofday() ]; + Time::HiRes::sleep( 0.5 ); + my $f = Time::HiRes::tv_interval $r; +- ok $f > 0.4 && $f < 0.9 or print("# slept $f instead of 0.5 secs.\n"); ++ ok $f > 0.49 or print("# slept $f instead of 0.5 secs.\n"); + } + + SKIP: { +diff --git a/dist/Time-HiRes/t/utime.t b/dist/Time-HiRes/t/utime.t +index 22fd48e..c5c7e55 100644 +--- a/dist/Time-HiRes/t/utime.t ++++ b/dist/Time-HiRes/t/utime.t +@@ -106,17 +106,18 @@ print "# utime undef sets time to now\n"; + my ($fh2, $filename2) = tempfile( "Time-HiRes-utime-XXXXXXXXX", UNLINK => 1 ); + + my $now = Time::HiRes::time; ++ sleep(1); + is Time::HiRes::utime(undef, undef, $filename1, $fh2), 2, "Two files changed"; + + { + my ($got_atime, $got_mtime) = ( Time::HiRes::stat($fh1) )[8, 9]; +- cmp_ok abs( $got_atime - $now), '<', 0.1, "File 1 atime set correctly"; +- cmp_ok abs( $got_mtime - $now), '<', 0.1, "File 1 mtime set correctly"; ++ cmp_ok $got_atime, '>=', $now, "File 1 atime set correctly"; ++ cmp_ok $got_mtime, '>=', $now, "File 1 mtime set correctly"; + } + { + my ($got_atime, $got_mtime) = ( Time::HiRes::stat($filename2) )[8, 9]; +- cmp_ok abs( $got_atime - $now), '<', 0.1, "File 2 atime set correctly"; +- cmp_ok abs( $got_mtime - $now), '<', 0.1, "File 2 mtime set correctly"; ++ cmp_ok $got_atime, '>=', $now, "File 2 atime set correctly"; ++ cmp_ok $got_mtime, '>=', $now, "File 2 mtime set correctly"; + } + }; + +-- +2.9.5 + diff --git a/perl.spec b/perl.spec index 28ab3a9..d62e515 100644 --- a/perl.spec +++ b/perl.spec @@ -79,7 +79,7 @@ License: GPL+ or Artistic Epoch: %{perl_epoch} Version: %{perl_version} # release number must be even higher, because dual-lived modules will be broken otherwise -Release: 398%{?dist} +Release: 399%{?dist} Summary: Practical Extraction and Report Language Url: http://www.perl.org/ Source0: http://www.cpan.org/src/5.0/perl-%{perl_version}.tar.bz2 @@ -228,6 +228,9 @@ Patch56: perl-5.27.2-EU-Constant-avoid-uninit-warning.patch # in upstream after 5.27.2 Patch57: perl-5.27.2-Configure-check-for-GCC-6-and-7.patch +# Fix unreliable Time-HiRes tests, CPAN RT#122819, in Time-HiRes-1.9746 +Patch58: perl-5.26.0-Time-HiRes-Fix-unreliable-t-usleep.t-and-t-utime.t.patch + # Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048 Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch @@ -2815,6 +2818,7 @@ Perl extension for Version Objects %patch55 -p1 %patch56 -p1 %patch57 -p1 +%patch58 -p1 %patch200 -p1 %patch201 -p1 @@ -2857,6 +2861,7 @@ perl -x patchlevel.h \ 'Fedora Patch55: Fix compiler warnings in code generated by ExtUtils::Constant (CPAN RT#63832)' \ 'Fedora Patch56: Fix compiler warnings in code generated by ExtUtils::Constant (CPAN RT#101487)' \ 'Fedora Patch57: Fix GCC version detection for -D_FORTIFY_SOURCE override (RT#131809)' \ + 'Fedora Patch58: Fix unreliable Time-HiRes tests (CPAN RT#122819)' \ 'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \ 'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \ %{nil} @@ -5140,6 +5145,9 @@ popd # Old changelog entries are preserved in CVS. %changelog +* Tue Aug 22 2017 Petr Pisar - 4:5.26.0-399 +- Fix unreliable Time-HiRes tests (CPAN RT#122819) + * Tue Aug 08 2017 Petr Pisar - 4:5.26.0-398 - Fix reporting malformed UTF-8 character (RT#131646) - Fix File::Glob rt131211.t test random failures