# HG changeset patch # User Maxim Dounin # Date 1347293885 -14400 # Node ID 1a5574d8491742bbde5c52c32af54f6f4cbe5b96 # Parent 4c43b3a0117c61561866d887c7beb81a0b0d48da Tests: tweak various timeouts and replace sleep() with select(). Hopefully this will result in less spurious test failures, in particular on our Solaris VM. diff --git a/proxy_cache.t b/proxy_cache.t --- a/proxy_cache.t +++ b/proxy_cache.t @@ -101,7 +101,7 @@ like(http_get_range('/t.html', 'Range: b like(http_get('/empty.html'), qr/HTTP/, 'empty get first'); like(http_get('/empty.html'), qr/HTTP/, 'empty get second'); -sleep(2); +select(undef, undef, undef, 1.1); unlink $t->testdir() . '/t.html'; like(http_gzip_request('/t.html'), qr/HTTP.*1c\x0d\x0a.{28}\x0d\x0a0\x0d\x0a\x0d\x0a\z/s, diff --git a/proxy_cache_lock.t b/proxy_cache_lock.t --- a/proxy_cache_lock.t +++ b/proxy_cache_lock.t @@ -56,7 +56,7 @@ http { proxy_cache NAME; proxy_cache_lock on; - proxy_cache_lock_timeout 300ms; + proxy_cache_lock_timeout 200ms; } location /nolock { @@ -137,7 +137,7 @@ sub http_start { eval { local $SIG{ALRM} = sub { die "timeout\n" }; local $SIG{PIPE} = sub { die "sigpipe\n" }; - alarm(2); + alarm(3); $s = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => '127.0.0.1:8080' @@ -161,7 +161,7 @@ sub http_end { eval { local $SIG{ALRM} = sub { die "timeout\n" }; local $SIG{PIPE} = sub { die "sigpipe\n" }; - alarm(2); + alarm(3); local $/; $reply = $s->getline(); log_in($reply); @@ -204,7 +204,7 @@ sub http_fake_daemon { next unless $uri; - sleep(1); + select(undef, undef, undef, 0.5); $num++; print $client <<"EOF"; diff --git a/proxy_store.t b/proxy_store.t --- a/proxy_store.t +++ b/proxy_store.t @@ -83,13 +83,13 @@ ok(!-e $t->testdir() . '/store-index-nos ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files'); http_get('/store-index-big.html', aborted => 1, sleep => 0.1); -sleep(1); +select(undef, undef, undef, 0.5); ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files after aborted request'); http_get('/ssi.html', aborted => 1, sleep => 0.1); -sleep(1); +select(undef, undef, undef, 0.5); ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files after aborted ssi');