Closed Bug 1526431 Opened 7 years ago Closed 6 years ago

|mach mochitest| on Android device fails with "ADBRootError: Can not run command test -d /storage/sdcard0 as root"

Categories

(Firefox for Android Graveyard :: Testing, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: botond, Unassigned)

Details

I recently got a new Android phone for development purposes. (A Moto G5, also the reference device for our performance testing.)

When I try to run a mochitest on it, I get:

ADBRootError: Can not run command test -d /storage/sdcard0 as root

Full output:

$ ./mach mochitest --keep-open=false  gfx/layers/apz/test/mochitest/test_interrupted_reflow.html
 0:00.20 adb INFO Using adb 1.0.40
 0:00.76 adb INFO adbd not restarted as root
 0:01.21 adb INFO /system/bin/ls -1A supported
 0:01.32 adb INFO Native cp support: True
 0:01.43 adb INFO Native chmod -R support: True
 0:01.54 adb INFO Native chown -R support: True
 0:01.66 adb INFO Setting SELinux Permissive
 0:01.66 adb WARNING Unable to set SELinux Permissive due to Can not run command setenforce Permissive as root!.
 0:01.89 adb INFO Native pidof support: True
 0:03.25 adb INFO Using adb 1.0.40
 0:03.59 adb INFO adbd not restarted as root
 0:04.04 adb INFO /system/bin/ls -1A supported
 0:04.16 adb INFO Native cp support: True
 0:04.27 adb INFO Native chmod -R support: True
 0:04.38 adb INFO Native chown -R support: True
 0:04.50 adb INFO Setting SELinux Permissive
 0:04.50 adb WARNING Unable to set SELinux Permissive due to Can not run command setenforce Permissive as root!.
 0:04.73 adb INFO Native pidof support: True
Android device's IP address: 10.242.26.92
Granting important runtime permissions to org.mozilla.fennec_botond
using e10s=False for non-geckoview app
 0:11.64 adb INFO Using adb 1.0.40
 0:12.09 adb INFO adbd not restarted as root
 0:12.54 adb INFO /system/bin/ls -1A supported
 0:12.65 adb INFO Native cp support: True
 0:12.76 adb INFO Native chmod -R support: True
 0:12.87 adb INFO Native chown -R support: True
 0:12.98 adb INFO Setting SELinux Permissive
 0:12.98 adb WARNING Unable to set SELinux Permissive due to Can not run command setenforce Permissive as root!.
 0:13.21 adb INFO Native pidof support: True
Error running mach:

    ['mochitest', '--keep-open=false', 'gfx/layers/apz/test/mochitest/test_interrupted_reflow.html']

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:

ADBRootError: Can not run command test -d /storage/sdcard0 as root!

  File "/home/botond/dev/mozilla/central/testing/mochitest/mach_commands.py", line 478, in run_mochitest_general
    **harness_args)
  File "/home/botond/dev/mozilla/central/testing/mochitest/mach_commands.py", line 185, in run_android_test
    return runtestsremote.run_test_harness(parser, options)
  File "/home/botond/dev/mozilla/out-of-tree-objdirs/central-android-arm/_tests/testing/mochitest/runtestsremote.py", line 361, in run_test_harness
    mochitest = MochiRemote(options)
  File "/home/botond/dev/mozilla/out-of-tree-objdirs/central-android-arm/_tests/testing/mochitest/runtestsremote.py", line 49, in __init__
    options.remoteTestRoot = self.device.test_root
  File "/home/botond/dev/mozilla/central/testing/mozbase/mozdevice/mozdevice/adb.py", line 992, in test_root
    if self._try_test_root(test_root):
  File "/home/botond/dev/mozilla/central/testing/mozbase/mozdevice/mozdevice/adb.py", line 1008, in _try_test_root
    if not self.is_dir(base_path, root=self._require_root):
  File "/home/botond/dev/mozilla/central/testing/mozbase/mozdevice/mozdevice/adb.py", line 1941, in is_dir
    return self._test_path('d', path, timeout, root)
  File "/home/botond/dev/mozilla/central/testing/mozbase/mozdevice/mozdevice/adb.py", line 1900, in _test_path
    timeout=timeout, root=root)
  File "/home/botond/dev/mozilla/central/testing/mozbase/mozdevice/mozdevice/adb.py", line 1424, in shell_bool
    timeout=timeout, root=root)
  File "/home/botond/dev/mozilla/central/testing/mozbase/mozdevice/mozdevice/adb.py", line 1334, in shell
    raise ADBRootError('Can not run command %s as root!' % cmd)

Bebe has some recent experience with rooting g5s. Can you help out?

Flags: needinfo?(fstrugariu)

So, just to confirm, rooting the device is required to run mochitests?

Is there a way to avoid this requirement?

Not at the moment. See bug 1486004 and bug 1525661 comment 7

I sent a email to :botond on how to root the device.

If you have any issues please contact me

Flags: needinfo?(fstrugariu)
Priority: -- → P3

Recent failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=245394375&repo=autoland&lineNumber=80

Connecting to Android device HT7B21A02889
2019-05-08 19:27:22,910 INFO Using adb 1.0.40
2019-05-08 19:27:23,223 INFO adbd not restarted as root
2019-05-08 19:27:23,639 INFO /system/bin/ls -1A supported
2019-05-08 19:27:23,744 INFO Native cp support: True
2019-05-08 19:27:23,848 INFO Native chmod -R support: True
2019-05-08 19:27:23,951 INFO Native chown -R support: True
2019-05-08 19:27:24,055 INFO Setting SELinux Permissive
2019-05-08 19:27:24,056 WARNING Unable to set SELinux Permissive due to Can not run command setenforce Permissive as root!.
2019-05-08 19:27:24,261 INFO Native pidof support: True
Traceback (most recent call last):
File "/builds/taskcluster/script.py", line 160, in <module>
sys.exit(main())
File "/builds/taskcluster/script.py", line 114, in main
device.rm('/data/local/tests', recursive=True, force=True, root=True)
File "/usr/local/lib/python2.7/dist-packages/mozdevice/adb.py", line 2276, in rm
self.shell_output("%s %s" % (cmd, path), timeout=timeout, root=root)
File "/usr/local/lib/python2.7/dist-packages/mozdevice/adb.py", line 1445, in shell_output
timeout=timeout, root=root)
File "/usr/local/lib/python2.7/dist-packages/mozdevice/adb.py", line 1322, in shell
raise ADBRootError('Can not run command %s as root!' % cmd)
mozdevice.adb.ADBRootError: Can not run command rm -r /data/local/tests as root!
[taskcluster 2019-05-08T19:27:24.486Z] Exit Code: 1
[taskcluster 2019-05-08T19:27:24.486Z] User Time: 99.411ms
[taskcluster 2019-05-08T19:27:24.486Z] Kernel Time: 91.541ms
[taskcluster 2019-05-08T19:27:24.486Z] Wall Time: 4.635898203s
[taskcluster 2019-05-08T19:27:24.486Z] Result: FAILED
[taskcluster 2019-05-08T19:27:24.486Z] === Task Finished ===
[taskcluster 2019-05-08T19:27:24.486Z] Task Duration: 4.636415933s
[taskcluster:error] Uploading error artifact public/test/ from file artifacts/public with message "Could not read directory '/builds/task_1557343636/artifacts/public'", reason "file-missing-on-worker" and expiry 2020-05-07T17:05:11.252Z
[taskcluster:error] TASK FAILURE during artifact upload: file-missing-on-worker: Could not read directory '/builds/task_1557343636/artifacts/public'
[taskcluster:error] Uploading error artifact public/logs/ from file workspace/logs with message "Could not read directory '/builds/task_1557343636/workspace/logs'", reason "file-missing-on-worker" and expiry 2020-05-07T17:05:11.252Z
[taskcluster:error] TASK FAILURE during artifact upload: file-missing-on-worker: Could not read directory '/builds/task_1557343636/workspace/logs'
[taskcluster:error] Uploading error artifact public/test_info/ from file workspace/build/blobber_upload_dir with message "Could not read directory '/builds/task_1557343636/workspace/build/blobber_upload_dir'", reason "file-missing-on-worker" and expiry 2020-05-07T17:05:11.252Z
[taskcluster:error] TASK FAILURE during artifact upload: file-missing-on-worker: Could not read directory '/builds/task_1557343636/workspace/build/blobber_upload_dir'
[taskcluster 2019-05-08T19:27:26.434Z] Uploading redirect artifact public/logs/live.log to URL https://queue.taskcluster.net/v1/task/BVEbhkPoSl-oG16Fz4UNaQ/runs/0/artifacts/public/logs/live_backing.log with mime type "text/plain; charset=utf-8" and expiry 2020-05-07T17:05:11.252Z
[taskcluster:error] exit status 1
[taskcluster:error] file-missing-on-worker: Could not read directory '/builds/task_1557343636/artifacts/public'
[taskcluster:error] file-missing-on-worker: Could not read directory '/builds/task_1557343636/workspace/logs'
[taskcluster:error] file-missing-on-worker: Could not read directory '/builds/task_1557343636/workspace/build/blobber_upload_dir'

(In reply to Andreea Pavel [:apavel] from comment #5)

apavel: This bug is about the general requirement for rooted devices. It appears you may have run into a situation with a new device at bitbar which is not rooted which is a separate issue.

aerickson: ping?

Flags: needinfo?(aerickson)

That is device pixel2-41. I've quarantined it and will reach out to Bitbar.

Flags: needinfo?(aerickson)

Closing this ticket as the original issue has been resolved and the recent failures are relatively unrelated.

We're working with #sheriffs to get these new devices fixed up.

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED

Sorry about that. Initially I did not notice the actual issue, however Andrew cleared that up.

Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.