This change add the ability to yield the output as it is produced, by
creating a thread responsible for killing the process if it takes too
long.
This way we can loop with blocking I/O on stdout in python, while the
process is running concurrently. The loop ends when the process exit
either by itself or after being killed by the timeout.
Differential Revision: https://phabricator.services.mozilla.com/D105037
- We make `pidof` public and we change it to guarantee that its resulting list
of pids consists of integers.
- We update `forward` and its dependencies to return the value of the port
that was assigned by `adb` so that clients may learn which port to use when
forwarding from `'tcp:0'`
Differential Revision: https://phabricator.services.mozilla.com/D94381
remoteautomation.py is an old collection of code used by android mochitest and android reftest;
it survived the removal of automation.py. This patch removes remoteautomation.py, moving the
majority of the functionality to a new class in mozdevice. Some features are simplified or
removed, and the remainder moved into the remote mochitest/reftest harnesses.
Differential Revision: https://phabricator.services.mozilla.com/D102239
Add ACCESS_WIFI_STATE to the gve manifest, same as androidTest.
Remove ACCESS_WIFI_STATE from the list of pm grants, since it is not of
type dangerous.
Differential Revision: https://phabricator.services.mozilla.com/D100727
* temporarily turn off verbose during get_top_activity to prevent spamming logs.
* Update version_codes with R/30.
* Do not attempt to use su or run-as with builtin commands.
* Do not clean the test root during ADBDeviceFactory initialization
if test_root was not specified.
* Make ADBDevice.package_dir a read-only property determined
solely by the value of the internal ADBDevice._run_as_package
property.
* Use new internal method ADBDevice._try_test_root_candidates to
centralize checking if one of a list of test root candidates can be
used.
* Use new method ADBDevice.is_package_debuggable to check if
a package is debuggable and cache the result.
* run_as_package setter changes:
When setting the ADBDevice.run_as_package property to None, make
sure both the old and new values of the test root are cleaned.
If the package is not debuggable, attempt to use one of
/storage/emulated/0/Android/data/<app_name>/test_root,
/sdcard/test_root or /mnt/sdcard/test_root regardless of whether
secure storage is in effect for the version of Android. If neither
is permitted, this will result in an ADBError which will be easily
diagnosable.
* test_root getter
When first attempting to access ADBDevice.test_root, attempt to use
/data/local/tmp/test_root as the test root. If the device is not
rooted, also include /sdcard/test_root, /storage/sdcard/test_root
and /mnt/sdcard/test_root in the set of paths to check.
* test_root setter
Cache the detected test root in _initial_test_root so it can be
restored without re-running _try_test_root.
Differential Revision: https://phabricator.services.mozilla.com/D100392
Add the permission to the geckoview manifest, as previously attempted. Also disable failing tests
to enable a green test run. Add permission to adb.py grants list for good measure.
Differential Revision: https://phabricator.services.mozilla.com/D98809
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.
5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.
5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
As a ride-along, I've included a fix to convert the verbose logging output of the adb process stdout during
the ADBDevice.shell method.
Differential Revision: https://phabricator.services.mozilla.com/D86957
Make the caller responsible for any desired type conversion, so that binary data can be
retrieved. This just works in py2. 'mach gtest' is the only py3 caller, and it already calls
ensure_str on the returned file contents. mochitest/reftest (via remoteautomation.py) may
require additional consideration when they are converted to py3 (coming soon!?).
Differential Revision: https://phabricator.services.mozilla.com/D86437
On a local Pixel 2 running Android 10, launching Geckoview test app via the
shell with the profile on external storage hangs and causes an ADBTimeoutError.
Using a profile in /data/local/tests does not exhibit this behavior.
In addition, attempting to push a directory tree directly to internal
storage can fail with "remote secure_mkdirs failed" errors when pushing
directories containing subdirectories to internal storage on /data.
The subdirectories were created with insufficient permissions for the
contents of the directories to be pushed. We can work around this problem
by catching the failure and falling back to using adb push to push the
source directory tree to a temporary location on the sdcard which does
not exhibit the error and then copying the temporary location to the
desired final destination.
These changes are necessary due to the change in Scoped Storage [1]
in Android 10 and later.
Since storing profiles on the sdcard is no longer supported the choices
for possible test roots has been reduced to using internal storage.
Since geckoview expects to be able to store content under /data/local/tmp
the default test root has been changed to /data/local/tmp/tests.
By default, the test root will be shared by all instances of ADBDevice
unless the share_test_root argument is set to False in the initializer.
This allows the test root to be defined globally with out requiring
each instance of ADBDevice to be modified.
The test_root default initial value should be None, not empty string.
The ADBDevice.test_root property is now read/write to support the new
shared test_root functionality.
Android emulators have exhibited an intermittent failure to clear logcat.
A ride-along change to retry the log clearing is included.
adb pull can fail if not all of the files have permission to be read.
This situation can appear when a profile is located on internal storage
and an app such as geckoview writes files to it. They will be readable
only by the app until the permissions are changed. Work around this
by calling chmod -R on any thing that is to be pulled from the device.
Bump mozdevice version to 3.1.2.
[1] https://developer.android.com/training/data-storage#scoped-storage
Differential Revision: https://phabricator.services.mozilla.com/D71722
Minor version bumps in preparation for new pypi releases of modules now requiring mozlog 6.0 and/or mozcrash 2.0.
Differential Revision: https://phabricator.services.mozilla.com/D66116
--HG--
extra : moz-landing-system : lando
Major version number bump for both mozlog and mozcrash + requirements update.
This is very much like the previous mozlog major bump - see bug 1591384.
This patch does not update testing/web-platform/tests/tools/wptrunner/requirements.txt;
I expect that will be automatically updated by the pyup.io bot once mozlog is re-released.
Differential Revision: https://phabricator.services.mozilla.com/D65135
--HG--
extra : moz-landing-system : lando
To work around the lack of Exception.message in Python 3, I've switched adb.py to using str(e) instead of e.message where we either output or check for a substring in the exception message. This doesn't not work for cases where we want to do an equality comparison but fortunately adb.py does not use exact comparisons.
Differential Revision: https://phabricator.services.mozilla.com/D59130
--HG--
extra : moz-landing-system : lando
Simple addition of one item to list of granted permissions, for Android P+; see bug 1553515.
Differential Revision: https://phabricator.services.mozilla.com/D55561
--HG--
extra : moz-landing-system : lando
This is needed to release a new mozlog with the PRECONDITION_FAILED
test and subtest status for use in web-platform-tests.
Update all in-tree dependencies on mozlog to >=5.0. These were found
with `hg grep 'mozlog.*[0-9]'`.
Only testing/web-platform/tests/tools/wptrunner/requirements.txt
remains on 4.2.0, and it will be updated in upstream wpt after mozlog
5.0 has been released.
Differential Revision: https://phabricator.services.mozilla.com/D50456
--HG--
extra : moz-landing-system : lando
Bug 1572563 wanted to be extra sure that `ls` could be found. To do
that it tries to run various `ls` variants in a loop until one such
variant exits with exit code 0. However, `ls` can be present and
functional and still exit with code 1. For many unrooted devices, bare
`ls` will exit with code 1 because there are files and directories for
which the shell user doesn't have read permission.
This works around by trying to list only the file that the loop is
trying to execute.
Differential Revision: https://phabricator.services.mozilla.com/D45770
--HG--
extra : moz-landing-system : lando
This API returns the data from get_info() along with a handful
list of dumpsys services data.
Differential Revision: https://phabricator.services.mozilla.com/D45317
--HG--
extra : moz-landing-system : lando