Skip to content

Commit

Permalink
Changed unit test for global_lock to use either ab or ab2. If neither is
Browse files Browse the repository at this point in the history
found the test is skipped.
  • Loading branch information
jgallacher committed Nov 16, 2005
1 parent bf98575 commit 6561881
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions test/test.py
Expand Up @@ -135,8 +135,6 @@
TESTHOME = testconf.TESTHOME
MOD_PYTHON_SO = testconf.MOD_PYTHON_SO
LIBEXECDIR = testconf.LIBEXECDIR
AB = os.path.join(os.path.split(HTTPD)[0], "ab")

SERVER_ROOT = TESTHOME
CONFIG = os.path.join(TESTHOME, "conf", "test.conf")
DOCUMENT_ROOT = os.path.join(TESTHOME, "htdocs")
Expand Down Expand Up @@ -164,6 +162,17 @@ def findUnusedPort():

return port

def get_ab_path():
""" Find the location of the ab (apache benchmark) program """
ab = None
for name in ['ab', 'ab2']:
path = quoteIfSpace(os.path.join(os.path.split(HTTPD)[0], name))
if os.path.exists(path):
ab = path
break

return ab

def quoteIfSpace(s):

# Windows doesn't like quotes when there are
Expand Down Expand Up @@ -1728,9 +1737,13 @@ def test_global_lock(self):
self.fail(`rsp`)

# if the mutex works, this test will take at least 5 secs
ab = get_ab_path()
if not ab:
print " Can't find ab. Skipping _global_lock test"
return

t1 = time.time()
print " ", time.ctime()
ab = quoteIfSpace(AB)
if os.name == "nt":
cmd = '%s -c 5 -n 5 http://127.0.0.1:%s/tests.py > NUL:' \
% (ab, PORT)
Expand Down

0 comments on commit 6561881

Please sign in to comment.