[perl-Cache-Cache] Fix race between adding two key sets in tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit e5b1262b2fb6caece67fdb8c32d3ff80126e6631
Author: Petr Písař <ppisar@xxxxxxxxxx>
Date:   Wed Aug 13 12:06:54 2014 +0200

    Fix race between adding two key sets in tests

 ...che-1.06-Make-tests-aware-of-running-time.patch |   29 +++++++++++++-------
 perl-Cache-Cache.spec                              |    5 +++-
 2 files changed, 23 insertions(+), 11 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 6fbe9f1..370817e 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 53b0e5405595a8a9b87b53dea1464584237f4dc7 Mon Sep 17 00:00:00 2001
+From 847184c72a9e76612cd76e97b676af85202be27c Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@xxxxxxxxxx>
 Date: Thu, 26 Jun 2014 13:43:09 +0200
 Subject: [PATCH] Make tests aware of running time
@@ -16,8 +16,8 @@ CPAN RT#88418
 Signed-off-by: Petr Písař <ppisar@xxxxxxxxxx>
 ---
  lib/Cache/CacheTester.pm          | 30 ++++++++++++++++++++++++------
- lib/Cache/SizeAwareCacheTester.pm | 19 +++++++++++++++----
- 2 files changed, 39 insertions(+), 10 deletions(-)
+ lib/Cache/SizeAwareCacheTester.pm | 25 +++++++++++++++++++++----
+ 2 files changed, 45 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..1cf744f 100644
+index 1a660f7..b2bcb79 100644
 --- a/lib/Cache/SizeAwareCacheTester.pm
 +++ b/lib/Cache/SizeAwareCacheTester.pm
 @@ -110,6 +110,7 @@ sub _test_two
@@ -98,7 +98,11 @@ index 1a660f7..1cf744f 100644
    $cache->set( $first_key, $value, $first_expires_in );
  
    my $first_size = $cache->size( );
-@@ -132,8 +133,13 @@ sub _test_two
+@@ -129,11 +130,17 @@ sub _test_two
+ 
+     $cache->set( $key, $value, $second_expires_in );
+   }
++  my $second_inserted = time;
  
    my $second_size = $cache->size( );
  
@@ -114,18 +118,23 @@ index 1a660f7..1cf744f 100644
  
    my $size_limit = $first_size;
  
-@@ -146,8 +152,13 @@ sub _test_two
+@@ -146,8 +153,18 @@ sub _test_two
  
    my $first_value = $cache->get( $first_key );
  
 -  ( $first_value eq $value ) ?
 -    $self->ok( ) : $self->not_ok( '$first_value eq $value' );
-+  if (time - $start < $first_expires_in ) {
-+    ( $first_value eq $value ) ?
-+      $self->ok( ) : $self->not_ok( '$first_value eq $value' );
-+  } else {
++  if (time - $start >= $first_expires_in) {
 +    $self->skip( '$first_value eq $value (not finished in ' .
 +      $first_expires_in . ' s)');
++  } elsif ($second_inserted + $second_expires_in >=
++      $start + $first_expires_in) {
++    $self->skip( '$first_value eq $value (second key insterted to late, ' .
++     'so first key had expiration time before the second one, ' .
++     'thus the first key was removed when limit cache size');
++  } else {
++    ( $first_value eq $value ) ?
++      $self->ok( ) : $self->not_ok( '$first_value eq $value' );
 +  }
  
  }
diff --git a/perl-Cache-Cache.spec b/perl-Cache-Cache.spec
index c9b5885..20f0b27 100644
--- a/perl-Cache-Cache.spec
+++ b/perl-Cache-Cache.spec
@@ -1,6 +1,6 @@
 Name:           perl-Cache-Cache
 Version:        1.06
-Release:        17%{?dist}
+Release:        18%{?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@xxxxxxxxxx> - 1.06-18
+- Fix race between adding two key sets in tests (bug #1128792)
+
 * Wed Aug 13 2014 Petr Pisar <ppisar@xxxxxxxxxx> - 1.06-17
 - Fix other time race in tests (bug #1112553)
 
--
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





[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux