about summary refs log tree commit homepage
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
parent9a3d58a96b32b50000e590d4432e8e2031ee7b82 (diff)
downloadyahns-4fe625b9a42b003e31329edd45d087b9c47ef5ed.tar.gz
ab(1) is less common than our other dependencies, so allow tests
to run without it.
-rw-r--r--HACKING1
-rw-r--r--test/helper.rb8
-rw-r--r--test/test_client_expire.rb2
3 files changed, 11 insertions, 0 deletions
diff --git a/HACKING b/HACKING
index a58c7e8..99cd3c3 100644
--- a/HACKING
+++ b/HACKING
@@ -4,6 +4,7 @@ development dependencies
 * minitest RubyGem (version 4 or 5, standard in Ruby 2.0+)
 * curl - http://curl.haxx.se/ - we don't trust our own Ruby abilities :>
 * dd(1) - standard POSIX tool - to feed curl
+* ab - http://httpd.apache.org - for concurrent testing
 * GNU make - https://www.gnu.org/software/make/
 * git - http://www.git-scm.com/
 * ruby - http://www.ruby-lang.org/
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]