STR: 1. empty env, 2. clone mozilla-unified, update to central 3. run ./mach bootstrap, pick option 3 (android artifact) 4. ./mach build && ./mach mochitest --flavor plain dom/base/test/ ER: it works AR: when it comes to running the test, it first checks for adb stuff: 0:01.68 adb INFO adbd running as root 0:01.80 adb INFO su -c supported 0:01.91 adb INFO su 0 supported 0:02.33 adb INFO /system/bin/ls -a supported 0:02.45 adb INFO Native cp support: True 0:02.56 adb INFO Native chmod -R support: True and then it fails: Error running mach: ['mochitest', '--flavor', 'plain', 'dom/base/test'] 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 should consider filing a bug for this issue. If filing a bug, please include the full output of mach, including this error message. The details of the failure are as follows: ADBError: [Errno 2] No such file or directory: adb is not executable. File "/Users/gkruitbosch/dev/firefox-unified/testing/mochitest/mach_commands.py", line 428, in run_mochitest_general **harness_args) File "/Users/gkruitbosch/dev/firefox-unified/testing/mochitest/mach_commands.py", line 180, in run_android_test return runtestsremote.run_test_harness(parser, options) File "/Users/gkruitbosch/dev/builds/android/_tests/testing/mochitest/runtestsremote.py", line 341, in run_test_harness mochitest = MochiRemote(options) File "/Users/gkruitbosch/dev/builds/android/_tests/testing/mochitest/runtestsremote.py", line 46, in __init__ verbose=verbose) File "/Users/gkruitbosch/dev/firefox-unified/testing/mozbase/mozdevice/mozdevice/adb_android.py", line 84, in __init__ device_ready_retry_attempts=device_ready_retry_attempts) File "/Users/gkruitbosch/dev/firefox-unified/testing/mozbase/mozdevice/mozdevice/adb.py", line 560, in __init__ timeout=timeout, verbose=verbose) File "/Users/gkruitbosch/dev/firefox-unified/testing/mozbase/mozdevice/mozdevice/adb.py", line 179, in __init__ raise ADBError('%s: %s is not executable.' % (exc, adb)) It seems the second time it tries to find adb in $PATH. Adding its dir to $PATH fixes the error and makes it run the same adb stuff a second time. I dunno why it needs to run twice, but it'd be nice if the user didn't have to figure out the error themselves (or even have to manually tweak $PATH themselves).
Summary: ./mach should use `adb` from `.mozbuild` as setup through ./mach bootstrap, not try to find it in $PATH and fail with cryptic error messages → ./mach should use `adb` from `.mozbuild` as setup through ./mach bootstrap, not try to find it in $PATH and fail with cryptic error messages (ADBError: [Errno 2] No such file or directory: adb is not executable.)
Looks like this is failing in the test harness. The mach command should be passing adb_path to the harnesses.
Assignee: nobody → gbrown
Component: Build Config → Testing
Product: Toolkit → Firefox for Android
In mach, when --adbpath is specified, mach should use that and instruct the test harness should use that. In mach, when --adbpath is not specified, mach should query the build system to find adb, then mach and the test harness should use that. When --adbpath is not specified to a test harness, the harness should use 'adb' to try to pick up adb from the $PATH, as a last resort. On treeherder, mach is not used and mozharness typically does not specify --adbpath, so the fallback to $PATH is normally relied on. This behavior was broken (slightly, quietly) by patches in bug 1440714, which changed the --adbpath defaults for most harnesses from None to 'adb'. With the new defaults, most mach checks for adbpath mistakenly believe --adbpath has been specified, causing failures when adb is not in $PATH and not actually specified by --adbpath.
Change the harness adb-path option defaults to None, so that mach can detect when a path is not specified: https://dxr.mozilla.org/mozilla-central/rev/7ff499dfcd51cf4a95ebf0db506b415bf7bb27c3/testing/mochitest/mach_commands.py#169-170 Then change the path used for ADBAndroid initialization to use 'adb' as a last resort -- options.adbPath or 'adb' -- in case the harness is running outside mach and --adb-path is not specified. I tested this locally with mach and adb not in my $PATH -- all's well. https://treeherder.mozilla.org/#/jobs?repo=try&revision=eff217ce18a3cf96732f9d227ead7071ec4e0b7e
Attachment #8968294 - Flags: review?(jmaher)
Comment on attachment 8968294 [details] [diff] [review] change --adb_path defaults so mach test commands do not rely on $PATH Review of attachment 8968294 [details] [diff] [review]: ----------------------------------------------------------------- nice!
Attachment #8968294 - Flags: review?(jmaher) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/mozilla-inbound/rev/a064cecfa429 Pass adb path from Android mach commands to test harnesses; r=jmaher
You need to log in before you can comment on or make changes to this bug.