diff --git a/js/src/tests/manifest.py b/js/src/tests/manifest.py index 03add5244bb..0603e208200 100644 --- a/js/src/tests/manifest.py +++ b/js/src/tests/manifest.py @@ -7,6 +7,14 @@ from subprocess import * from tests import TestCase + +def split_path_into_dirs(path): + dirs = [] + while path != "/": + path = os.path.dirname(path) + dirs.append(path) + return dirs + class XULInfo: def __init__(self, abi, os, isdebug): self.abi = abi @@ -29,17 +37,19 @@ class XULInfo: # Our strategy is to find the autoconf.mk generated for the build and # read the values from there. - + # Find config/autoconf.mk. - dir = jsdir - while True: - path = os.path.join(dir, 'config/autoconf.mk') - if os.path.isfile(path): - break - if os.path.dirname(dir) == dir: - print "Can't find config/autoconf.mk on a directory containing the JS shell (searched from %s)"%jsdir - sys.exit(1) - dir = os.path.dirname(dir) + dirs = split_path_into_dirs(os.getcwd()) + split_path_into_dirs(jsdir) + + path = None + for dir in dirs: + path = os.path.join(dir, 'config/autoconf.mk') + if os.path.isfile(path): + break + + if path == None: + print "Can't find config/autoconf.mk on a directory containing the JS shell (searched from %s)"%jsdir + sys.exit(1) # Read the values. val_re = re.compile(r'(TARGET_XPCOM_ABI|OS_TARGET|MOZ_DEBUG)\s*=\s*(.*)')