Bug 819482 - Remove retry code from b2g automation now that devicemanager handles it, r=ahal
authorMihnea Dobrescu-Balaur <mihneadb@gmail.com>
Fri, 04 Jan 2013 14:07:48 -0500
changeset 126762 e75caf89e1f97ec23c961d518b053a1f11006037
parent 126761 6e251f2906f5a280e40d9098330e39ea246a8ed7
child 126763 9d119006ec646ca2279d6f5a36295172e70512e2
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersahal
bugs819482
milestone20.0a1
Bug 819482 - Remove retry code from b2g automation now that devicemanager handles it, r=ahal
testing/marionette/client/marionette/emulator.py
testing/xpcshell/remotexpcshelltests.py
testing/xpcshell/runtestsb2g.py
--- a/testing/marionette/client/marionette/emulator.py
+++ b/testing/marionette/client/marionette/emulator.py
@@ -424,26 +424,19 @@ waitFor(
             exc = exc.replace('Traceback', '_traceback')
             print exc
 
             raise InstallGeckoError("unable to restart B2G after installing gecko")
 
     def install_busybox(self, busybox):
         self._run_adb(['remount'])
 
-        push_attempts = 10
         remote_file = "/system/bin/busybox"
-        for retry in range(1, push_attempts+1):
-            print 'pushing', remote_file, '(attempt %s of %s)' % (retry, push_attempts)
-            try:
-                self.dm.pushFile(busybox, remote_file)
-                break
-            except DMError:
-                if retry == push_attempts:
-                    raise
+        print 'pushing %s' % remote_file
+        self.dm.pushFile(busybox, remote_file, retryLimit=10)
         self._run_adb(['shell', 'cd /system/bin; chmod 555 busybox; for x in `./busybox --list`; do ln -s ./busybox $x; done'])
         self.dm._verifyZip()
 
     def rotate_log(self, srclog, index=1):
         """ Rotate a logfile, by recursively rotating logs further in the sequence,
             deleting the last file if necessary.
         """
         destlog = os.path.join(self.logcat_dir, 'emulator-%d.%d.log' % (self.port, index))
--- a/testing/xpcshell/remotexpcshelltests.py
+++ b/testing/xpcshell/remotexpcshelltests.py
@@ -146,25 +146,18 @@ class XPCShellRemote(xpcshell.XPCShellTe
                 remoteFile = self.remoteJoin(self.remoteBinDir, file)
                 self.device.pushFile(os.path.join(root, file), remoteFile)
 
     def setupModules(self):
         if self.testingModulesDir:
             self.device.pushDir(self.testingModulesDir, self.remoteModulesDir)
 
     def setupTestDir(self):
-        push_attempts = 10
-        for retry in range(1, push_attempts+1):
-            print 'pushing', self.xpcDir, '(attempt %s of %s)' % (retry, push_attempts)
-            try:
-                self.device.pushDir(self.xpcDir, self.remoteScriptsDir)
-                break
-            except DMError:
-                if retry == push_attempts:
-                    raise
+        print 'pushing %s' % self.xpcDir
+        self.device.pushDir(self.xpcDir, self.remoteScriptsDir, retryLimit=10)
 
     def buildTestList(self):
         xpcshell.XPCShellTests.buildTestList(self)
         uniqueTestPaths = set([])
         for test in self.alltests:
           uniqueTestPaths.add(test['here'])
         for testdir in uniqueTestPaths:
           abbrevTestDir = os.path.relpath(testdir, self.xpcDir)
--- a/testing/xpcshell/runtestsb2g.py
+++ b/testing/xpcshell/runtestsb2g.py
@@ -32,29 +32,22 @@ class B2GXPCShellRemote(XPCShellRemote):
         print >>sys.stderr, "\nCleaning files from previous run.."
         self.device.removeDir(self.options.remoteTestRoot)
 
     # Overriden
     def setupTestDir(self):
         if self.device._useZip:
             return XPCShellRemote.setupTestDir(self)
 
-        push_attempts = 10
         for root, dirs, files in os.walk(self.xpcDir):
             for filename in files:
                 rel_path = os.path.relpath(os.path.join(root, filename), self.xpcDir)
                 test_file = os.path.join(self.remoteScriptsDir, rel_path)
-                for retry in range(1, push_attempts+1):
-                    print 'pushing', test_file, '(attempt %s of %s)' % (retry, push_attempts)
-                    try:
-                        self.device.pushFile(os.path.join(root, filename), test_file)
-                        break
-                    except DMError:
-                        if retry == push_attempts:
-                            raise
+                print 'pushing %s' % test_file
+                self.device.pushFile(os.path.join(root, filename), test_file, retryLimit=10)
 
     # Overridden
     def pushLibs(self):
         if not self.options.use_device_libs:
             XPCShellRemote.pushLibs(self)
 
     # Overridden
     def setLD_LIBRARY_PATH(self, env):