Bug 647482 - jstests looks for config/autoconf.mk in the wrong place (rs=nnethercote)
authorPaul Biggar <pbiggar@mozilla.com>
Sat, 02 Apr 2011 15:32:00 -0700
changeset 67912 43f70a7294fcf9184095286bd15e8bceca98a33b
parent 67911 f89b07ec09e2c9c35b21dee3b86412441b93808d
child 67913 b0f4398a0657c3919b32859f46499f6c8b56ceee
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnnethercote
bugs647482
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 647482 - jstests looks for config/autoconf.mk in the wrong place (rs=nnethercote)
js/src/tests/manifest.py
--- a/js/src/tests/manifest.py
+++ b/js/src/tests/manifest.py
@@ -2,16 +2,24 @@
 #
 # This includes classes for representing and parsing JS manifests.
 
 import os, re, sys
 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
         self.os = os
         self.isdebug = isdebug
 
     def as_js(self):
         """Return JS that when executed sets up variables so that JS expression
@@ -24,27 +32,29 @@ class XULInfo:
             self.os == "Android")
 
     @classmethod
     def create(cls, jsdir):
         """Create a XULInfo based on the current platform's characteristics."""
 
         # 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*(.*)')
         kw = {}
         for line in open(path):
             m = val_re.match(line)
             if m:
                 key, val = m.groups()