Closed Bug 2072855 Opened 2 months ago Closed 1 month ago

mach mochitest doesn't work for Android emulator

Categories

(Firefox Build System :: Android Studio and Gradle Integration, defect)

defect

Tracking

(firefox160 fixed)

RESOLVED FIXED
160 Branch
Tracking Status
firefox160 --- fixed

People

(Reporter: hiro, Assigned: ahochheiden)

References

Details

Attachments

(1 file, 1 external file)

Attached file A log —

I am quite unsure this component is the right component for this issue. Anyway, whenever I run mach mochitest, it fails with an weird error message.

Attaching file contains the error message.

The mach mochitest command tries to build then fails to find C compiler.

Oddly mach build can find the proper C compiler:

 0:01.24 checking whether the target C compiler can be used... yes
 0:01.24 checking for the target C++ compiler... /home/hiro/.mozbuild/clang/bin/clang++
 0:01.25 checking whether the target C++ compiler can be used... yes

My local mozconfig just has:

 mk_add_options MOZ_PARALLEL_BUILD=20
 mk_add_options AUTOCLOBBER=1
 ac_add_options --enable-project=mobile/android
 ac_add_options --enable-debug

The severity field is not set for this bug.
:florian, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(florian)
Attachment #9643764 - Attachment mime type: application/octet-stream → text/plain
Flags: needinfo?(florian)

(In reply to Hiroyuki Ikezoe (:hiro) from comment #0)

I am quite unsure this component is the right component for this issue.

Tentatively moving to the android build system component.

Component: Mochitest → Android Studio and Gradle Integration
Product: Testing → Firefox Build System

The severity field is not set for this bug.
:polly, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(polly)

GypProcessor set CC and CFLAGS in os.environ of the calling process (for NSS's gyp, which shells out to $CC). When mach mochitest (via moztest's BuildBackendLoader, "Test configuration changed. Regenerating backend.") regenerates the build backend in-process, those variables then stay set for the rest of the mach invocation. The subsequent mach android install-geckoview-test_runner gradle run inherits CC, and MachTasksPlugin's normalizedMachEnv rewrites it from the list-valued CC subst as "/path/clang,--target=x86_64-linux-android26", making the reentrant configure in :machBuildFaster fail with "Cannot find the target C compiler".

Gyp files are loaded in ProcessPoolExecutor workers, so set those variables in the worker (in load_gyp) and leave the parent's environment alone.

Separately, the gradle plugin comma-joining every list-valued subst that also exists as an env var (meant for GRADLE_MAVEN_REPOSITORIES) is fragile for things like CC. It may be worth limiting that to the substs that really are comma-separated options.

i intended to get hackbot to triage this but it seems to have submitted a fix (:
given that the entire proposed fix is outside the android gradle area, i will try and find a more suitable component to expose this to the required expertise to progress it

Flags: needinfo?(polly)
Component: Android Studio and Gradle Integration → General
Assignee: nobody → ahochheiden
Status: NEW → ASSIGNED
Attachment #9654838 - Attachment description: Bug 2072855 - Don't leak CC/CFLAGS into the environment of the process reading gyp files → Bug 2072855 - Don't leak `CC` and `CFLAGS` into the environment of the process reading gyp files r?#build

The Bugbug bot thinks this bug should belong to the 'Firefox Build System::Android Studio and Gradle Integration' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: General → Android Studio and Gradle Integration
Duplicate of this bug: 2082266
Pushed by ahochheiden@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/83d58d1452be https://hg.mozilla.org/integration/autoland/rev/dc54f9b04468 Don't leak `CC` and `CFLAGS` into the environment of the process reading gyp files r=firefox-build-system-reviewers,nalexander
Pushed by pstanciu@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/8ebf8edf59a5 https://hg.mozilla.org/integration/autoland/rev/511cca8bf0f2 Revert "Bug 2072855 - Don't leak `CC` and `CFLAGS` into the environment of the process reading gyp files r=firefox-build-system-reviewers,nalexander" for causing doc generate fails
Flags: needinfo?(ahochheiden)

I'll take care of it.

Flags: needinfo?(ahochheiden)
Pushed by ahochheiden@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/426e4f1e0763 https://hg.mozilla.org/integration/autoland/rev/0d65c67af78d Don't leak `CC` and `CFLAGS` into the environment of the process reading gyp files r=firefox-build-system-reviewers,nalexander
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: