From 0578b95651cdf95863a1fb9b25c182af914d0b53 Mon Sep 17 00:00:00 2001 From: William Lachance Date: Fri, 18 Jul 2014 14:19:33 -0400 Subject: [PATCH] Bug 1026710 - Fix errors in output handling in devicemanagerADB. r=armenzg --- .../mozdevice/mozdevice/devicemanagerADB.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py b/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py index 32ad683fa2e..ec32b08d9bd 100644 --- a/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py +++ b/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py @@ -201,8 +201,8 @@ class DeviceManagerADB(DeviceManager): retryLimit=retryLimit) def mkDir(self, name): - result = str(self._runCmd(["shell", "mkdir", name]).output) - if 'read-only file system' in result.lower(): + result = self._runCmd(["shell", "mkdir", name]).output + if len(result) and 'read-only file system' in result[0].lower(): raise DMError("Error creating directory: read only file system") def pushDir(self, localDir, remoteDir, retryLimit=None, timeout=None): @@ -222,7 +222,7 @@ class DeviceManagerADB(DeviceManager): self.pushFile(localZip, remoteZip, retryLimit=retryLimit, createDir=False) mozfile.remove(localZip) data = self._runCmd(["shell", "unzip", "-o", remoteZip, - "-d", remoteDir]).output + "-d", remoteDir]).output[0] self._checkCmd(["shell", "rm", remoteZip], retryLimit=retryLimit, timeout=timeout) if re.search("unzip: exiting", data) or re.search("Operation not permitted", data): @@ -486,9 +486,9 @@ class DeviceManagerADB(DeviceManager): def getInfo(self, directive=None): ret = {} if (directive == "id" or directive == "all"): - ret["id"] = self._runCmd(["get-serialno"]).output + ret["id"] = self._runCmd(["get-serialno"]).output[0] if (directive == "os" or directive == "all"): - ret["os"] = self._runCmd(["shell", "getprop", "ro.build.display.id"]).output + ret["os"] = self._runCmd(["shell", "getprop", "ro.build.display.id"]).output[0] if (directive == "uptime" or directive == "all"): utime = self._runCmd(["shell", "uptime"]).output[0] if (not utime): @@ -503,13 +503,12 @@ class DeviceManagerADB(DeviceManager): if (directive == "process" or directive == "all"): ret["process"] = self._runCmd(["shell", "ps"]).output if (directive == "systime" or directive == "all"): - ret["systime"] = self._runCmd(["shell", "date"]).output + ret["systime"] = self._runCmd(["shell", "date"]).output[0] self._logger.info(ret) return ret def uninstallApp(self, appName, installPath=None): - data = self._runCmd(["uninstall", appName]).output.strip() - status = data.split('\n')[0].strip() + status = self._runCmd(["uninstall", appName]).output[0].strip() if status != 'Success': raise DMError("uninstall failed for %s. Got: %s" % (appName, status)) @@ -638,7 +637,7 @@ class DeviceManagerADB(DeviceManager): if retcode is None: # still not terminated, kill proc.kill() - data = proc.output + data = proc.output[0] if data.find('uid=0(root)') >= 0: self._haveSu = True