Bug 1477276 - Fix regression preventing |mach help| without an objdir r=bhearsum
Differential Revision:
https://phabricator.services.mozilla.com/D2267
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -15,17 +15,21 @@ import shutil
from mach.decorators import (
CommandArgument,
CommandProvider,
Command,
SettingsProvider,
)
-from mozbuild.base import MachCommandBase, MachCommandConditions as conditions
+from mozbuild.base import (
+ BuildEnvironmentNotFoundException,
+ MachCommandBase,
+ MachCommandConditions as conditions,
+)
from moztest.resolve import TEST_SUITES
from argparse import ArgumentParser
UNKNOWN_TEST = '''
I was unable to find tests from the given argument(s).
You should specify a test directory, filename, test suite name, or
abbreviation. If no arguments are given, there must be local file
@@ -331,17 +335,21 @@ class CheckSpiderMonkeyCommand(MachComma
all_passed = jittest_result and jstest_result and jsapi_tests_result and \
check_js_msg_result
return all_passed
def has_js_binary(binary):
def has_binary(cls):
- name = binary + cls.substs['BIN_SUFFIX']
+ try:
+ name = binary + cls.substs['BIN_SUFFIX']
+ except BuildEnvironmentNotFoundException:
+ return False
+
path = os.path.join(cls.topobjdir, 'dist', 'bin', name)
has_binary.__doc__ = """
`{}` not found in <objdir>/dist/bin. Make sure you aren't using an artifact build
and try rebuilding with `ac_add_options --enable-js-shell`.
""".format(name).lstrip()
return os.path.isfile(path)