Closed Bug 902645 Opened 8 years ago Closed 8 years ago
Android xpcshell tests may fail to create /data/local/xpcb due to directory permissions
remotexpcshelltests.py pushes xpcshell and related files to a directory which it creates, /data/local/xpcb. It does so through devicemanager.shellCheckOutput(["mkdir", ...]) which typically results in mkdir being run without root privileges. When run via sut on pandaboards, sut does not have permission to create a directory in /data/local, and the tests fail: see bug 881293. The same problem exists on the android x86 emulator.
remotexpcshelltests.py does not otherwise need root, so I first try to create xpcb without root permissions and only retry with root if needed. This way it is possible that xpcshell tests can still run on non-rooted devices, as long as /data/local is writable. If the non-privileged attempt throws a DMError, this patch retries with root. If that succeeds, there is a good chance that the new directory will not be world writable, so future non-privileged operations will fail. To avoid that, I also chmod 777 the new directory as root. Tested on the x86 emulator -- works fine for me. This should not affect the tegras, but just in case...https://tbpl.mozilla.org/?tree=Try&rev=9b516b9c8240
Attachment #787145 - Flags: review?(jmaher)
Comment on attachment 787145 [details] [diff] [review] modify remotexpcshelltests.py to use root if needed when creating xpcb Review of attachment 787145 [details] [diff] [review]: ----------------------------------------------------------------- this moves us forward! ::: testing/xpcshell/remotexpcshelltests.py @@ +97,5 @@ > + self.device.shellCheckOutput(["mkdir", self.remoteBinDir]); > + except devicemanager.DMError: > + # Might get a permission error; try again as root, if available > + self.device.shellCheckOutput(["mkdir", self.remoteBinDir], root=True); > + self.device.shellCheckOutput(["chmod", "777", self.remoteBinDir], root=True); does this error out by terminating the script with traceback if shellCheckOutput fails? I only ask because of running the same command in the except clause. I noticed on my device that root=True wasn't helpful via SUT all the time on my nexus s which is rooted technically, but obviously not the same as we would expect.
Attachment #787145 - Flags: review?(jmaher) → review+
(In reply to Joel Maher (:jmaher) from comment #2) > does this error out by terminating the script with traceback if > shellCheckOutput fails? Yes, if the second shellCheckOutput (inside the except) fails, the new exception is uncaught and you get a traceback, just like before.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
This change was unintentionally clobbered by bug 887054. Re-landed: https://hg.mozilla.org/integration/mozilla-inbound/rev/e7f8f355829e
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 8 years ago → 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.