"./mach help mochitest" gives an error if $MOZCONFIG sets an objdir that's not currently built

RESOLVED FIXED in Firefox 53

Status

RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: dbaron, Unassigned)

Tracking

Trunk
mozilla53
Points:
---

Firefox Tracking Flags

(firefox53 fixed)

Details

Attachments

(1 attachment)

If I have my $MOZCONFIG set to a .mozconfig file whose MOZ_OBJDIR setting is a tree that's not currently built, then instead of giving a useful error message, "./mach help mochitest" says:

Error running mach:

    ['help', 'mochitest']

The error occurred in mach itself. This is likely a bug in mach itself or a
fundamental problem with a loaded module.

Please consider filing a bug against mach by going to the URL:

    https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=mach


If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

IOError: [Errno 2] No such file or directory: u'/hdd/builds/build-mozilla-central/obj/firefox-debugopt/_tests/testing/mochitest/runtests.py'

  File "/hdd/builds/build-mozilla-central/mozilla/python/mach/mach/main.py", line 343, in run
    return self._run(argv)
  File "/hdd/builds/build-mozilla-central/mozilla/python/mach/mach/main.py", line 395, 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 "/hdd/builds/build-mozilla-central/mozilla/python/mach/mach/dispatcher.py", line 106, in __call__
    self._handle_command_help(parser, args[0])
  File "/hdd/builds/build-mozilla-central/mozilla/python/mach/mach/dispatcher.py", line 332, in _handle_command_help
    if handler.parser:
  File "/hdd/builds/build-mozilla-central/mozilla/python/mach/mach/decorators.py", line 77, in parser
    self._parser = self._parser()
  File "/hdd/builds/build-mozilla-central/mozilla/testing/mochitest/mach_commands.py", line 315, in setup_argument_parser
    with open(path, 'r') as fh:

Comment 1

2 years ago
There's another bug floating around that would disable the various testing commands unless we're able to run tests. I'm tempted to say this is a dupe.

But the fact that `mach help mochitest` doesn't work without a build feels like a bug on its own right.
Component: mach → Mochitest
Product: Core → Testing
Comment hidden (mozreview-request)

Comment 3

2 years ago
mozreview-review
Comment on attachment 8822017 [details]
Bug 1299944 - use default runtests.py if objdir doesn't exists.

https://reviewboard.mozilla.org/r/101086/#review101670

This LGTM.

TBH, I'm not sure why we don't just always load runtests.py from the source directory. But that's for another bug and day. Will land this for you.
Attachment #8822017 - Flags: review?(gps) → review+

Comment 4

2 years ago
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f5cef370a457
use default runtests.py if objdir doesn't exists. r=gps
(In reply to Gregory Szorc [:gps] from comment #3)
> Comment on attachment 8822017 [details]
> Bug 1299944 - use default runtests.py if objdir doesn't exists.
> 
> https://reviewboard.mozilla.org/r/101086/#review101670
> 
> This LGTM.
> 
> TBH, I'm not sure why we don't just always load runtests.py from the source
> directory. But that's for another bug and day. Will land this for you.

I was wondering this the other day in bug 1312739 and looked into it but found there are things that use __file__ to find other things in the objdir. It shouldn't be terribly hard to fix mochitest to not do this though.

Comment 6

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/f5cef370a457
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox53: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
status-firefox51: affected → ---
You need to log in before you can comment on or make changes to this bug.