From 4fe625b9a42b003e31329edd45d087b9c47ef5ed Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 27 Dec 2013 23:50:01 +0000 Subject: tests: document and check for ab(1) dependency ab(1) is less common than our other dependencies, so allow tests to run without it. --- test/helper.rb | 8 ++++++++ test/test_client_expire.rb | 2 ++ 2 files changed, 10 insertions(+) (limited to 'test') 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] -- cgit v1.2.3-24-ge0c7