mach android-emulator fails if 'emulator' in $PATH is not the Android emulator

RESOLVED FIXED in Firefox 43

Status

Testing
General
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: gbrown, Assigned: gbrown)

Tracking

unspecified
mozilla43
Points:
---

Firefox Tracking Flags

(firefox43 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
For instance, if the b2g emulator is in $PATH:

$ mach android-emulator
 0:00.66 Fetching and installing AVD. This may take a few minutes...
 0:57.04 Starting Android emulator running Android 4.3...
WARNING: Emulator has already completed!
 1:12.11 Unable to verify that emulator is running.


I think finding 'emulator' on the $PATH is a nice feature for some, but this shows it is dangerous too. Other locations (.mozbuild, ANDROID_SDK_ROOT) should at least be used preferentially to $PATH.
(Assignee)

Comment 1

3 years ago
Created attachment 8659391 [details] [diff] [review]
change search order

I have changed the search order so that $PATH is checked last, rather than first. I think 90% of cases will find the emulator before getting to the $PATH; hopefully the remainder have the right emulator in the $PATH!

(While debugging, I noticed I also missed a required call to os.path.expanduser -- added that fix too.)
Attachment #8659391 - Flags: review?(ahalberstadt)
Comment on attachment 8659391 [details] [diff] [review]
change search order

Review of attachment 8659391 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, r+ with comment fixed.

::: testing/mozbase/mozrunner/mozrunner/devices/android_device.py
@@ +516,5 @@
>  
>          if not found:
>              # Can exe be found in the default bootstrap location?
> +            exe_path = os.path.expanduser(os.path.join(
> +                '~', '.mozbuild', 'android-sdk-linux', subdir, exe))

'~/.mozbuild' is self.statedir, should use that instead in case it changes.
Attachment #8659391 - Flags: review?(ahalberstadt) → review+
(Assignee)

Comment 3

3 years ago
(In reply to Andrew Halberstadt [:ahal] from comment #2)
> '~/.mozbuild' is self.statedir, should use that instead in case it changes.

Good idea, but statedir is <objdir>/.mozbuild. I want the avds to be cached alongside the sdk and ndk stored by bootstrap, in ~/.mozbuild. I found http://hg.mozilla.org/mozilla-central/annotate/9ed17db42e3e/python/mozboot/mozboot/debian.py#l127 -- I'll do something similar.
Oh yeah, you're right.. sorry. I think you can access it from a MachCommand by doing:
self._mach_context.state_dir
https://hg.mozilla.org/mozilla-central/rev/ce840d7632ba
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox43: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.