Bug 1027842 - Make jit_test.py search in PATH to find the js shell command. r=terrence

This commit is contained in:
Dan Gohman 2014-06-19 18:50:09 -07:00
parent 9954937cf1
commit 954885e61c

View File

@ -19,6 +19,18 @@ add_libdir_to_path()
import jittests
from tests import TBPL_FLAGS
# Python 3.3 added shutil.which, but we can't use that yet.
def which(name):
if name.find(os.path.sep) != -1:
return os.path.abspath(name)
for path in os.environ["PATH"].split(os.pathsep):
full = os.path.join(path, name)
if os.path.exists(full):
return os.path.abspath(full)
return name
def main(argv):
# If no multiprocessing is available, fallback to serial test execution
@ -201,7 +213,7 @@ def main(argv):
new_test.jitflags.extend(jitflags)
job_list.append(new_test)
prefix = [os.path.abspath(args[0])] + shlex.split(options.shell_args)
prefix = [which(args[0])] + shlex.split(options.shell_args)
prolog = os.path.join(jittests.LIB_DIR, 'prolog.js')
if options.remote:
prolog = posixpath.join(options.remote_test_root, 'jit-tests', 'jit-tests', 'lib', 'prolog.js')