[svn r21] Make httpd_test look for apachebench more carefully.
Reviewed by Ryan.
This commit is contained in:
@@ -131,7 +131,9 @@ class TestHttpd(tests.TestCase):
|
||||
|
||||
def test_005_run_apachebench(self):
|
||||
url = 'http://localhost:12346/'
|
||||
out = processes.Process('/usr/sbin/ab', ['-c','64','-n','1024', '-k', url])
|
||||
# ab is apachebench
|
||||
out = processes.Process(tests.find_command('ab'),
|
||||
['-c','64','-n','1024', '-k', url])
|
||||
print out.read()
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ THE SOFTWARE.
|
||||
"""
|
||||
|
||||
import atexit
|
||||
import errno
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
@@ -34,3 +36,11 @@ TestCase = unittest.TestCase
|
||||
name = getattr(sys.modules['__main__'], '__name__', None)
|
||||
|
||||
main = unittest.main
|
||||
|
||||
|
||||
def find_command(command):
|
||||
for dir in os.getenv('PATH', '/usr/bin:/usr/sbin').split(os.pathsep):
|
||||
p = os.path.join(dir, command)
|
||||
if os.access(p, os.X_OK):
|
||||
return p
|
||||
raise IOError(errno.ENOENT, 'Command not found: %r' % command)
|
||||
|
||||
Reference in New Issue
Block a user