diff --git a/test/test.py b/test/test.py index 73aae168..36b4fcbb 100644 --- a/test/test.py +++ b/test/test.py @@ -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") @@ -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 @@ -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)