about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2013-12-27 23:50:01 +0000
committerEric Wong <e@80x24.org>2013-12-27 23:50:01 +0000
commit4fe625b9a42b003e31329edd45d087b9c47ef5ed (patch)
treecebd74bf737d710f11eef92197405c32780273c1 /test
parent9a3d58a96b32b50000e590d4432e8e2031ee7b82 (diff)
downloadyahns-4fe625b9a42b003e31329edd45d087b9c47ef5ed.tar.gz
ab(1) is less common than our other dependencies, so allow tests
to run without it.
Diffstat (limited to 'test')
-rw-r--r--test/helper.rb8
-rw-r--r--test/test_client_expire.rb2
2 files changed, 10 insertions, 0 deletions
diff --git a/test/helper.rb b/test/helper.rb
index ae22e7f..a841f20 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -119,6 +119,14 @@ def cloexec_pipe
   IO.pipe.each { |io| io.close_on_exec = true }
 end
 
+def require_exec(cmd)
+  ENV["PATH"].split(/:/).each do |path|
+    return true if File.executable?("#{path}/#{cmd}")
+  end
+  skip "#{cmd} not found in PATH"
+  false
+end
+
 require 'yahns'
 
 # needed for parallel (MT) tests)
diff --git a/test/test_client_expire.rb b/test/test_client_expire.rb
index 6436c7c..bdf0cb4 100644
--- a/test/test_client_expire.rb
+++ b/test/test_client_expire.rb
@@ -32,6 +32,7 @@ class TestClientExpire < Testcase
   end
 
   def test_client_expire
+    require_exec "ab"
     nr = 32
     err = @err
     cfg = Yahns::Config.new
@@ -74,6 +75,7 @@ class TestClientExpire < Testcase
 
   # test EMFILE handling
   def test_client_expire_desperate
+    require_exec "ab"
     err = @err
     cfg = Yahns::Config.new
     host, port = @srv.addr[3], @srv.addr[1]