Open Bug 1209248 Opened 5 years ago Updated 3 years ago

Trying to run tests without a build should fail with a better description

Categories

(Firefox Build System :: Mach Core, enhancement)

35 Branch
enhancement
Not set
normal

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned)

Details

When you run `./mach reftest` or any other kind of test without having done a build before, mach will fail with the following unhelpful exception:

IOError: [Errno 2] No such file or directory: u'/mozilla/code/obj/debug/_tests/testing/mochitest/runtests.py'

  File "/mozilla/code/gecko/python/mach/mach/main.py", line 336, in run
    return self._run(argv)
  File "/mozilla/code/gecko/python/mach/mach/main.py", line 382, in _run
    args = parser.parse_args(argv)
  File "/usr/lib/python2.7/argparse.py", line 1701, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python2.7/argparse.py", line 1733, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python2.7/argparse.py", line 1942, in _parse_known_args
    stop_index = consume_positionals(start_index)
  File "/usr/lib/python2.7/argparse.py", line 1898, in consume_positionals
    take_action(action, args)
  File "/usr/lib/python2.7/argparse.py", line 1807, in take_action
    action(self, namespace, argument_values, option_string)
  File "/mozilla/code/gecko/python/mach/mach/dispatcher.py", line 185, in __call__
    if handler.parser:
  File "/mozilla/code/gecko/python/mach/mach/decorators.py", line 77, in parser
    self._parser = self._parser()
  File "/mozilla/code/gecko/testing/mochitest/mach_commands.py", line 417, in setup_argument_parser
    with open(path, 'r') as fh:

It would be good to display more help in pointing the user to build first.
Running in --verbose mode actually gives a better message:

Exception: config.status not available. Run configure.

  File "/mozilla/code/gecko/layout/tools/reftest/mach_commands.py", line 239, in run_reftest
    return self._run_reftest(**kwargs)
  File "/mozilla/code/gecko/layout/tools/reftest/mach_commands.py", line 281, in _run_reftest
    return reftest.run_desktop_test(**kwargs)
  File "/mozilla/code/gecko/layout/tools/reftest/mach_commands.py", line 213, in run_desktop_test
    rv = runreftest.run(**kwargs)
  File "/mozilla/code/gecko/layout/tools/reftest/runreftest.py", line 716, in run
    parser.validate(options, reftest)
  File "/mozilla/code/gecko/layout/tools/reftest/reftestcommandline.py", line 327, in validate
    self.build_obj and self.build_obj.substs[
  File "/mozilla/code/gecko/python/mozbuild/mozbuild/base.py", line 273, in substs
    return self.config_environment.substs
  File "/mozilla/code/gecko/python/mozbuild/mozbuild/base.py", line 260, in config_environment
    raise Exception('config.status not available. Run configure.')
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.