[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):
|
def test_005_run_apachebench(self):
|
||||||
url = 'http://localhost:12346/'
|
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()
|
print out.read()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ THE SOFTWARE.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
|
import errno
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@@ -34,3 +36,11 @@ TestCase = unittest.TestCase
|
|||||||
name = getattr(sys.modules['__main__'], '__name__', None)
|
name = getattr(sys.modules['__main__'], '__name__', None)
|
||||||
|
|
||||||
main = unittest.main
|
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