summaryrefslogtreecommitdiff
path: root/t/expirations.t
diff options
context:
space:
mode:
authorBrad Fitzpatrick <brad@danga.com>2006-09-09 19:49:36 +0000
committerBrad Fitzpatrick <brad@danga.com>2006-09-09 19:49:36 +0000
commit934dea2ad671bfa2ca93d4f9dccc76e0aec12706 (patch)
tree9158eec9026e409236a2ea7dcca42c850f021b77 /t/expirations.t
parent15cc2578074115100df4bb222d05967452dde345 (diff)
downloadmemcached-934dea2ad671bfa2ca93d4f9dccc76e0aec12706.tar.gz
potential race
git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@385 b0b603af-a30f-0410-a34e-baf09ae79d0b
Diffstat (limited to 't/expirations.t')
-rwxr-xr-xt/expirations.t14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/expirations.t b/t/expirations.t
index 5ce6641..fd7561e 100755
--- a/t/expirations.t
+++ b/t/expirations.t
@@ -10,6 +10,20 @@ my $server = new_memcached();
my $sock = $server->sock;
my $expire;
+sub wait_for_early_second {
+ use Time::HiRes ();
+ my $tsh = Time::HiRes::time();
+ my $ts = int($tsh); # in case time was overloaded to be hires.
+ return if ($tsh - $ts) < 0.5;
+ while (1) {
+ my $t = int(time());
+ return if $t != $ts;
+ select undef, undef, undef, 0.10; # 1/10th of a second sleeps until time changes.
+ }
+}
+
+wait_for_early_second();
+
print $sock "set foo 0 1 6\r\nfooval\r\n";
is(scalar <$sock>, "STORED\r\n", "stored foo");