Closed Bug 679602 Opened 13 years ago Closed 13 years ago

Improve robustness of devicemanagerADB: check for adb, remote cp

Categories

(Testing :: General, defect)

x86_64
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla9

People

(Reporter: gbrown, Assigned: gbrown)

Details

(Whiteboard: [mobile-testing][xpcshell])

Attachments

(1 file, 1 obsolete file)

Recent attempts to run xpcshell tests on Android have run into some problems that we can handle better: - If adb cannot be executed (SDK not installed or not in PATH), devicemanagerADB can report this issue explicitly. - If cp cannot be executed on device (not installed, no permissions for shell and/or fennec user), devicemanagerADB can attempt to push files directly rather than pushing to a temporary location and copying them.
Assignee: nobody → gbrown
Whiteboard: [mobile][xpcshell]
Whiteboard: [mobile][xpcshell] → [mobile-testing][xpcshell]
Attached patch patch for review (obsolete) — Splinter Review
Explicitly check for ability to execute adb and report appropriate error. Also check for cp on device and avoid run-as trick when cp is not available. When run-as and cp are available, devicemanager pushes files to a temp location, then uses run-as cp to copy them to their final destinations. This allows files to be owned by the uid associated with the fennec package, more closely resembling a production install of fennec. However, some devices do not have cp installed, or cp is installed but cannot be executed by non-privileged users; in these cases, devicemanager just pushes files to their final destinations, and they are owned by shell (or root). As long as chmod successfully grants full permissions on the files, this is sufficient to run a broad range of tests (the full set of xpcshell tests works for me this way).
Attachment #553853 - Flags: review?(jmaher)
Comment on attachment 553853 [details] [diff] [review] patch for review Review of attachment 553853 [details] [diff] [review]: ----------------------------------------------------------------- I don't see anything wrong with this patch as it and it helps solve some problems with adb and automation, so r+. I would like to ensure that we can do a: 'runas {packageName} cp x y' Maybe we could do a: * create tempfile on local host * push tempfile to testroot/tmp * runas packagename mkdir testroot/sanity * runas packagename cp testroot/tmp/tmpfile testroot/sanity/testfile * verify file exists * runas packagename rmdir testroot/sanity That would be a bit more comprehensive. Thoughts?
Attachment #553853 - Flags: review?(jmaher) → review+
Attached patch patch for reviewSplinter Review
I agree: A more comprehensive test is warranted. I have implemented just a slight modification on the operations suggested.
Attachment #553853 - Attachment is obsolete: true
Attachment #554282 - Flags: review?(jmaher)
From the try run: Connecting to: 10.250.49.19 reconnecting socket unable to connect socket reconnecting socket unable to connect socket reconnecting socket unable to connect socket reconnecting socket unable to connect socket reconnecting socket unable to connect socket reconnecting socket unable to connect socket devroot None /builds/tegra-032/test/../error.flg Remote Device Error: devRoot from devicemanager [None] is not correct program finished with exit code 1 Did my change cause this?
this is a problem that pops up every now and then, if this happens on all runs, you have a problem, but this code that you are running shouldn't even be executing on tinderbox.
Comment on attachment 554282 [details] [diff] [review] patch for review Review of attachment 554282 [details] [diff] [review]: ----------------------------------------------------------------- ::: build/mobile/devicemanagerADB.py @@ +548,5 @@ > + if (not self.dirExists(self.tmpDir)): > + self.mkDir(self.tmpDir) > + self.checkCmd(["shell", "run-as", packageName, "mkdir", devroot + "/sanity"]) > + self.checkCmd(["push", os.path.abspath(sys.argv[0]), self.tmpDir + "/tmpfile"]) > + self.checkCmd(["shell", "run-as", packageName, "cp", self.tmpDir + "/tmpfile", devroot + "/sanity"]) where is '/tmpfile' created at? otherwise this looks good.
Attachment #554282 - Flags: review?(jmaher) → review+
os.path.abspath(sys.argv[0]) gives the full path to the .py file that is being executed. So, for example, if remotexpcshelltests.py is using devicemanagerADB, then remotexpcshelltests.py is pushed as the tmpfile. This way we do not risk a local file creation failure.
Keywords: checkin-needed
In my queue, which is being sent to try and then presuming green, I'll land on inbound later today.
Status: NEW → ASSIGNED
Keywords: checkin-needed
Version: unspecified → Trunk
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: