about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/helper.rb12
-rw-r--r--test/test_output_buffering.rb1
2 files changed, 13 insertions, 0 deletions
diff --git a/test/helper.rb b/test/helper.rb
index 73cde51..634f63e 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -147,6 +147,18 @@ class DieIfUsed
   end
 end
 
+# tricky to test output buffering behavior across different OSes
+def skip_skb_mem
+  return if ENV['YAHNS_TEST_FORCE']
+  skip "linux-only test" unless RUBY_PLATFORM =~ /linux/
+  [ [ '/proc/sys/net/ipv4/tcp_rmem', "4096        87380        6291456\n" ],
+    [ '/proc/sys/net/ipv4/tcp_wmem', "4096        16384        4194304\n" ]
+  ].each do |file, expect|
+    val = IO.read(file)
+    val == expect or skip "#{file} had: #{val}expected: #{expect}"
+  end
+end
+
 require 'yahns'
 
 # needed for parallel (MT) tests)
diff --git a/test/test_output_buffering.rb b/test/test_output_buffering.rb
index ba3e94a..e1a23b7 100644
--- a/test/test_output_buffering.rb
+++ b/test/test_output_buffering.rb
@@ -219,6 +219,7 @@ class TestOutputBuffering < Testcase
 
   def test_client_timeout
     err = @err
+    skip_skb_mem
     apperr = tmpfile(%w(app .err))
     cfg = Yahns::Config.new
     size = RAND.size * NR