Closed Bug 1733312 Opened 3 years ago Closed 3 years ago

Cannot run mochitest on Android: AttributeError: 'CommandContext' object has no attribute 'substs'

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: robwu, Assigned: robwu)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

With MOZCONFIG configured to develop on Android, I started the emulator and tried to run a mochitest on the Android emulator, as follows:

$ ./mach mochitest toolkit/components/extensions/test/mochitest/test_ext_cookies.html

Instead of running the tests, mach exits with the error below.
This appears to be a regression of bug 1696251.

Error running mach:

    ['mochitest', 'toolkit/components/extensions/test/mochitest/test_ext_cookies.html']

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 mochitest| 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:

AttributeError: 'CommandContext' object has no attribute 'substs'

  File "/path/to/gecko/testing/mochitest/mach_commands.py", line 496, in run_mochitest_general
    result = run_mochitest(
  File "/path/to/gecko/testing/mochitest/mach_commands.py", line 166, in run_android_test
    kwargs["adbPath"] = get_adb_path(command_context)
  File "/path/to/gecko/testing/mozbase/mozrunner/mozrunner/devices/android_device.py", line 525, in get_adb_path
    return _find_sdk_exe(build_obj.substs, "adb", False)
  File "/path/to/gecko/python/mach/mach/main.py", line 169, in __getattribute__
    raise e
  File "/path/to/gecko/python/mach/mach/main.py", line 162, in __getattribute__
    return getattr(object.__getattribute__(self, "_context"), key)

Sentry event ID: f08b205dd302407d95d2f6ac4cc12032

get_adb_path did not work because the input command_context to
run_android_test was actually command_context._mach_context,
which does not have a substs member.

The get_adb_path function however requires the object to have a
substs member to find the adb path.

Assignee: nobody → rob
Status: NEW → ASSIGNED

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

Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/dba61344c849
Fix mach_commands.py to run mochitests on Android again r=mhentges
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
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: