diff options
Diffstat (limited to 'test/test_client_expire.rb')
-rw-r--r-- | test/test_client_expire.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/test_client_expire.rb b/test/test_client_expire.rb index b2f932b..b6dec1a 100644 --- a/test/test_client_expire.rb +++ b/test/test_client_expire.rb @@ -99,6 +99,14 @@ class TestClientExpire < Testcase end stderr_path err.path end + + # 1024 is common on old systems, but nowadays Jessie seems to be 65536 + nr = Process.getrlimit(:NOFILE)[0] + if nr >= 1024 + nr = 1024 + do_rlimit = true + end + pid = mkserver(cfg) do keep = { $stderr => true, $stdout => true, $stdin => true, @srv => true } ObjectSpace.each_object(IO) do |obj| @@ -108,7 +116,9 @@ class TestClientExpire < Testcase rescue IOError # could be uninitialized end end + Process.setrlimit(:NOFILE, nr) if do_rlimit end + f = get_tcp_client(host, port) f.write "G" s = get_tcp_client(host, port) @@ -119,10 +129,9 @@ class TestClientExpire < Testcase assert_match(%r{keep-alive}, str) sleep 1 - # ignore errors, just beat the crap out of the process - nr = Process.getrlimit(:NOFILE)[0] # 1024 is common assert_operator nr, :>, 666, "increase RLIM_NOFILE (ulimit -n)" nr -= 50 + # ignore errors, just beat the crap out of the process opts = { out: "/dev/null", err: "/dev/null", close_others: true } begin pids = 2.times.map do |