From e86802a1f3f7ac34d32483f9d5de7e627e984db7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 8 Feb 2014 03:18:26 -0500 Subject: test_client_expire: add delays for non-Linux OSes Not all TCP stacks behave the same with timing-sensitive tests. Fortunately these timing differences aren't very critical over real networks. --- test/test_client_expire.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_client_expire.rb b/test/test_client_expire.rb index bdf0cb4..4f20803 100644 --- a/test/test_client_expire.rb +++ b/test/test_client_expire.rb @@ -149,9 +149,17 @@ class TestClientExpire < Testcase Process.waitpid2(_pid) end end + + # this seems to be needed in Debian GNU/kFreeBSD + linux = !!(RUBY_PLATFORM =~ /linux/) + sleep(1) unless linux + [ f, s ].each do |io| assert_raises(Errno::EPIPE,Errno::ECONNRESET) do - req.each_byte { |b| io.write(b.chr) } + req.each_byte do |b| + io.write(b.chr) + sleep(0.01) unless linux + end end io.close end -- cgit v1.2.3-24-ge0c7