Closed Bug 1203627 Opened 7 years ago Closed 7 years ago
mach android-emulator fails if 'emulator' in $PATH is not the Android emulator
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.
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+
(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
You need to log in before you can comment on or make changes to this bug.