Bug 1037642 - Fix assumption that we will be able to send all data in devicemanagerSUT in one shot. r=mcote
authorWilliam Lachance <wlachance@mozilla.com>
Tue, 15 Jul 2014 14:09:04 -0400
changeset 194315 1442aaf7977037a4dd00eff81e35b11b9a5d4575
parent 194314 48c77bd996de0c92ea2b9442daf9be89d31ea0e8
child 194316 fa8fa1827ea9c213e99be7b380c11c1f14d02ae7
push id27143
push usercbook@mozilla.com
push dateWed, 16 Jul 2014 13:54:56 +0000
treeherdermozilla-central@f6e46d1fc903 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcote
bugs1037642
milestone33.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
Bug 1037642 - Fix assumption that we will be able to send all data in devicemanagerSUT in one shot. r=mcote
testing/mozbase/mozdevice/mozdevice/devicemanagerSUT.py
--- a/testing/mozbase/mozdevice/mozdevice/devicemanagerSUT.py
+++ b/testing/mozbase/mozdevice/mozdevice/devicemanagerSUT.py
@@ -195,20 +195,23 @@ class DeviceManagerSUT(DeviceManager):
             cmdline = '%s\r\n' % cmd['cmd']
 
             try:
                 sent = self._sock.send(cmdline)
                 if sent != len(cmdline):
                     raise DMError("Remote Device Error: our cmd was %s bytes and we "
                                   "only sent %s" % (len(cmdline), sent))
                 if cmd.get('data'):
-                    sent = self._sock.send(cmd['data'])
-                    if sent != len(cmd['data']):
-                        raise DMError("Remote Device Error: we had %s bytes of data to send, but "
-                                      "only sent %s" % (len(cmd['data']), sent))
+                    totalsent = 0
+                    while totalsent < len(cmd['data']):
+                        sent = self._sock.send(cmd['data'][totalsent:])
+                        self._logger.debug("sent %s bytes of data payload" % sent)
+                        if sent == 0:
+                            raise DMError("Socket connection broken when sending data")
+                        totalsent += sent
 
                 self._logger.debug("sent cmd: %s" % cmd['cmd'])
             except socket.error, msg:
                 self._sock.close()
                 self._sock = None
                 self._logger.error("Remote Device Error: Error sending data"\
                         " to socket. cmd=%s; err=%s" % (cmd['cmd'], msg))
                 return False