[perl-Cache-Cache] Fix other time race in tests
Petr Pisar
ppisar at fedoraproject.org
Wed Aug 13 07:43:53 UTC 2014
commit 4e4be5f230d7dff04cc4d506e27c5b6b52e71ca5
Author: Petr Písař <ppisar at redhat.com>
Date: Wed Aug 13 09:41:28 2014 +0200
Fix other time race in tests
...che-1.06-Make-tests-aware-of-running-time.patch | 28 +++++++++++++++----
perl-Cache-Cache.spec | 5 +++-
2 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/Cache-Cache-1.06-Make-tests-aware-of-running-time.patch b/Cache-Cache-1.06-Make-tests-aware-of-running-time.patch
index de8900d..6fbe9f1 100644
--- a/Cache-Cache-1.06-Make-tests-aware-of-running-time.patch
+++ b/Cache-Cache-1.06-Make-tests-aware-of-running-time.patch
@@ -1,4 +1,4 @@
-From 79b3decdb39c6a12261bb9a5f5bbada5ceec39eb Mon Sep 17 00:00:00 2001
+From 53b0e5405595a8a9b87b53dea1464584237f4dc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
Date: Thu, 26 Jun 2014 13:43:09 +0200
Subject: [PATCH] Make tests aware of running time
@@ -7,7 +7,7 @@ Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some tests could fail if they run slower then the tested time limits
-because then caches entries expired on different place expected. This
+because then caches entries expired on different place than expected. This
patch skips such tests if the running time is not shorter than
expected.
@@ -16,8 +16,8 @@ CPAN RT#88418
Signed-off-by: Petr Písař <ppisar at redhat.com>
---
lib/Cache/CacheTester.pm | 30 ++++++++++++++++++++++++------
- lib/Cache/SizeAwareCacheTester.pm | 10 ++++++++--
- 2 files changed, 32 insertions(+), 8 deletions(-)
+ lib/Cache/SizeAwareCacheTester.pm | 19 +++++++++++++++----
+ 2 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/lib/Cache/CacheTester.pm b/lib/Cache/CacheTester.pm
index 8f64577..1cd6f82 100644
@@ -87,7 +87,7 @@ index 8f64577..1cd6f82 100644
sleep( $EXPIRES_DELAY + 1 );
diff --git a/lib/Cache/SizeAwareCacheTester.pm b/lib/Cache/SizeAwareCacheTester.pm
-index 1a660f7..1a36c48 100644
+index 1a660f7..1cf744f 100644
--- a/lib/Cache/SizeAwareCacheTester.pm
+++ b/lib/Cache/SizeAwareCacheTester.pm
@@ -110,6 +110,7 @@ sub _test_two
@@ -98,7 +98,23 @@ index 1a660f7..1a36c48 100644
$cache->set( $first_key, $value, $first_expires_in );
my $first_size = $cache->size( );
-@@ -146,8 +147,13 @@ sub _test_two
+@@ -132,8 +133,13 @@ sub _test_two
+
+ my $second_size = $cache->size( );
+
+- ( $second_size > $first_size ) ?
+- $self->ok( ) : $self->not_ok( '$second_size > $first_size' );
++ if (time - $start < $first_expires_in ) {
++ ( $second_size > $first_size ) ?
++ $self->ok( ) : $self->not_ok( '$second_size > $first_size' );
++ } else {
++ $self->skip( '$second_size > $first_size (not finished in ' .
++ $first_expires_in . ' s)');
++ }
+
+ my $size_limit = $first_size;
+
+@@ -146,8 +152,13 @@ sub _test_two
my $first_value = $cache->get( $first_key );
diff --git a/perl-Cache-Cache.spec b/perl-Cache-Cache.spec
index 2e5a663..c9b5885 100644
--- a/perl-Cache-Cache.spec
+++ b/perl-Cache-Cache.spec
@@ -1,6 +1,6 @@
Name: perl-Cache-Cache
Version: 1.06
-Release: 16%{?dist}
+Release: 17%{?dist}
Summary: Generic cache interface and implementations
License: GPL+ or Artistic
Group: Development/Libraries
@@ -58,6 +58,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/*
%changelog
+* Wed Aug 13 2014 Petr Pisar <ppisar at redhat.com> - 1.06-17
+- Fix other time race in tests (bug #1112553)
+
* Thu Jun 26 2014 Petr Pisar <ppisar at redhat.com> - 1.06-16
- Fix time races in tests (bug #1112553)
More information about the perl-devel
mailing list