Closed Bug 1730778 Opened 3 years ago Closed 3 years ago

mach gtest fails with KeyError: "priority '' not in ['idle', 'less', 'normal', 'more', 'high']"

Categories

(Firefox Build System :: Mach Core, defect)

defect

Tracking

(firefox-esr78 unaffected, firefox-esr91 unaffected, firefox92 unaffected, firefox93 unaffected, firefox94 fixed)

RESOLVED FIXED
94 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox-esr91 --- unaffected
firefox92 --- unaffected
firefox93 --- unaffected
firefox94 --- fixed

People

(Reporter: jbauman, Assigned: mhentges)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Despite having just pulled central and running a successful bootstrap, I'm getting failures when I try to run any mach gtest after this change:

$ MOZCONFIG=~/mozconfig-rel-opt ./mach gtest --list-tests
Error running mach:

    ['gtest', '--list-tests']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file gtest| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.

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

The details of the failure are as follows:

KeyError: "priority '' not in ['idle', 'less', 'normal', 'more', 'high']"

  File "/Users/jbauman/src/mozilla-unified/python/mozbuild/mozbuild/mach_commands.py", line 678, in gtest
    res = command_context._mach_context.commands.dispatch(
  File "/Users/jbauman/src/mozilla-unified/python/mach/mach/registrar.py", line 161, in dispatch
    return self._run_command_handler(handler, context, **kwargs)
  File "/Users/jbauman/src/mozilla-unified/python/mach/mach/registrar.py", line 107, in _run_command_handler
    result = fn(instance, **kwargs)
  File "/Users/jbauman/src/mozilla-unified/python/mozbuild/mozbuild/build_commands.py", line 169, in build
    if not _set_priority(priority, verbose):
  File "/Users/jbauman/src/mozilla-unified/python/mozbuild/mozbuild/build_commands.py", line 39, in _set_priority
    raise KeyError(f"priority '{priority}' not in {list(PRIO_CLASS_BY_KEY)}")

Sentry event ID: f6874d2ef61c4dae933952d43a5187f8
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

commands.dispatch(...) don't respect command argument defaults set up
in decorators. Instead, it falls back to the python parameter default,
which is essentially unset.

The solution in this case is to duplicate the default value.

Assignee: nobody → mhentges
Status: NEW → ASSIGNED

I've attached a stopgap solution, but this could be solved in a more complete way in the future in various ways:

  • Only allow specifying a default via the Python argument, not in the decorator.
  • Make commands.dispatch(...) respect decorator defaults
  • Remove commands.dispatch(...), since it's only used a ~dozen times and adds a lot of Mach complexity.

This works for now, though.

Pushed by jgilbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9037646e0cd9
Fix "./mach gtest" build priority error r=jgilbert

The Bugbug bot thinks this bug should belong to the 'Firefox Build System::Mach Core' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: General → Mach Core
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch

Set release status flags based on info from the regressing bug 1730253

Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: