author | Malini Das <mdas@mozilla.com> |
Wed, 26 Sep 2012 12:32:02 -0400 | |
changeset 108151 | 0450cb4ef66ab6d4f23cb6868de8c87d0e08b783 |
parent 108150 | 5ebf745a3a40d1c489fab9fe95ad65fef8d18daf |
child 108152 | f341fc58f595ccb66760e03908057b9f538252dc |
push id | 23539 |
push user | ryanvm@gmail.com |
push date | Wed, 26 Sep 2012 22:55:55 +0000 |
treeherder | autoland@ec079fd92224 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | wlach |
bugs | 792084 |
milestone | 18.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
testing/mozbase/mozdevice/mozdevice/devicemanager.py | file | annotate | diff | comparison | revisions |
--- a/testing/mozbase/mozdevice/mozdevice/devicemanager.py +++ b/testing/mozbase/mozdevice/mozdevice/devicemanager.py @@ -44,16 +44,37 @@ class DeviceManager: timeout is specified in seconds, and if no timeout is given, we will run until the script returns returns: success: Return code from command failure: None """ + def shellCheckOutput(self, cmd, env=None, cwd=None, timeout=None, root=False): + """ + executes shell command on device (with root privileges if + specified) and returns the the output + + timeout is specified in seconds, and if no timeout is given, + we will run until the script returns + returns: + success: Returns output of shell command + failure: DMError will be raised + """ + buf = StringIO.StringIO() + retval = self.shell(cmd, buf, env=env, cwd=cwd, timeout=timeout, root=root) + output = str(buf.getvalue()[0:-1]).rstrip() + buf.close() + if retval is None: + raise DMError("Did not successfully run command %s (output: '%s', retval: 'None')" % (cmd, output)) + if retval != 0: + raise DMError("Non-zero return code for command: %s (output: '%s', retval: '%i')" % (cmd, output, retval)) + return output + @abstractmethod def pushFile(self, localname, destname): """ external function returns: success: True failure: False """