Bug 863445 - Part 2: Specify Robocop APK on runtestsremote.py command line. r=jmaher
☠☠ backed out by 8739db2431d0 ☠ ☠
authorNick Alexander <nalexander@mozilla.com>
Sat, 11 May 2013 16:53:48 -0700
changeset 142606 611c81436abea784c03905f66711a14ca8e914b5
parent 142605 2d5c2f19192085903b3d024e3f8530596bd61d18
child 142607 dac51812454af7591eb140d3cf73a01d566f79fe
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs863445
milestone23.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 863445 - Part 2: Specify Robocop APK on runtestsremote.py command line. r=jmaher This deprecates --robocop in favour of --robocop-ini, and --robocopPath in favour of --robocop-apk.
testing/mochitest/runtestsremote.py
testing/testsuite-targets.mk
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -75,24 +75,34 @@ class RemoteOptions(MochitestOptions):
                     help = "ssl port of the remote web server")
         defaults["sslPort"] = automation.DEFAULT_SSL_PORT
 
         self.add_option("--pidfile", action = "store",
                     type = "string", dest = "pidFile",
                     help = "name of the pidfile to generate")
         defaults["pidFile"] = ""
 
+        self.add_option("--robocop-ini", action = "store",
+                    type = "string", dest = "robocopIni",
+                    help = "name of the .ini file containing the list of tests to run")
+        defaults["robocopIni"] = ""
+
         self.add_option("--robocop", action = "store",
                     type = "string", dest = "robocop",
-                    help = "name of the .ini file containing the list of tests to run")
+                    help = "name of the .ini file containing the list of tests to run. [DEPRECATED- please use --robocop-ini")
         defaults["robocop"] = ""
 
+        self.add_option("--robocop-apk", action = "store",
+                    type = "string", dest = "robocopApk",
+                    help = "name of the Robocop APK to use for ADB test running")
+        defaults["robocopApk"] = ""
+
         self.add_option("--robocop-path", action = "store",
                     type = "string", dest = "robocopPath",
-                    help = "Path to the folder where robocop.apk is located at.  Primarily used for ADB test running")
+                    help = "Path to the folder where robocop.apk is located at.  Primarily used for ADB test running. [DEPRECATED- please use --robocop-apk]")
         defaults["robocopPath"] = ""
 
         self.add_option("--robocop-ids", action = "store",
                     type = "string", dest = "robocopIds",
                     help = "name of the file containing the view ID map (fennec_ids.txt)")
         defaults["robocopIds"] = ""
 
         self.add_option("--remoteTestRoot", action = "store",
@@ -153,32 +163,47 @@ class RemoteOptions(MochitestOptions):
             else:
                 options.xrePath = options.utilityPath
 
         if (options.pidFile != ""):
             f = open(options.pidFile, 'w')
             f.write("%s" % os.getpid())
             f.close()
 
-        # Robocop specific options
-        if options.robocop != "":
-            if not os.path.exists(options.robocop):
-                print "ERROR: Unable to find specified manifest '%s'" % options.robocop
+        # Robocop specific deprecated options.
+        if options.robocop:
+            if options.robocopIni:
+                print "ERROR: can not use deprecated --robocop and replacement --robocop-ini together"
+                return None
+            options.robocopIni = options.robocop
+            del options.robocop
+
+        if options.robocopPath:
+            if options.robocopApk:
+                print "ERROR: can not use deprecated --robocop-path and replacement --robocop-apk together"
                 return None
-            options.robocop = os.path.abspath(options.robocop)
+            options.robocopApk = os.path.join(options.robocopPath, 'robocop.apk')
+            del options.robocopPath
 
-        if options.robocopPath != "":
-            if not os.path.exists(os.path.join(options.robocopPath, 'robocop.apk')):
-                print "ERROR: Unable to find robocop.apk in path '%s'" % options.robocopPath
+        # Robocop specific options
+        if options.robocopIni != "":
+            if not os.path.exists(options.robocopIni):
+                print "ERROR: Unable to find specified robocop .ini manifest '%s'" % options.robocopIni
                 return None
-            options.robocopPath = os.path.abspath(options.robocopPath)
+            options.robocopIni = os.path.abspath(options.robocopIni)
+
+        if options.robocopApk != "":
+            if not os.path.exists(options.robocopApk):
+                print "ERROR: Unable to find robocop APK '%s'" % options.robocopApk
+                return None
+            options.robocopApk = os.path.abspath(options.robocopApk)
 
         if options.robocopIds != "":
             if not os.path.exists(options.robocopIds):
-                print "ERROR: Unable to find specified IDs file '%s'" % options.robocopIds
+                print "ERROR: Unable to find specified robocop IDs file '%s'" % options.robocopIds
                 return None
             options.robocopIds = os.path.abspath(options.robocopIds)
 
         # allow us to keep original application around for cleanup while running robocop via 'am'
         options.remoteappname = options.app
         return options
 
     def verifyOptions(self, options, mochitest):
@@ -303,17 +328,17 @@ class MochiRemote(Mochitest):
     def buildProfile(self, options):
         if self.localProfile:
             options.profilePath = self.localProfile
         manifest = Mochitest.buildProfile(self, options)
         self.localProfile = options.profilePath
         self._dm.removeDir(self.remoteProfile)
 
         # we do not need this for robotium based tests, lets save a LOT of time
-        if options.robocop:
+        if options.robocopIni:
             shutil.rmtree(os.path.join(options.profilePath, 'webapps'))
             shutil.rmtree(os.path.join(options.profilePath, 'extensions', 'staged', 'mochikit@mozilla.org'))
             shutil.rmtree(os.path.join(options.profilePath, 'extensions', 'staged', 'worker-test@mozilla.org'))
             shutil.rmtree(os.path.join(options.profilePath, 'extensions', 'staged', 'workerbootstrap-test@mozilla.org'))
             os.remove(os.path.join(options.profilePath, 'userChrome.css'))
             if os.path.exists(os.path.join(options.profilePath, 'tests.jar')):
                 os.remove(os.path.join(options.profilePath, 'tests.jar'))
             if os.path.exists(os.path.join(options.profilePath, 'tests.manifest')):
@@ -330,17 +355,17 @@ class MochiRemote(Mochitest):
     
     def buildURLOptions(self, options, env):
         self.localLog = options.logFile
         options.logFile = self.remoteLog
         options.profilePath = self.localProfile
         env["MOZ_HIDE_RESULTS_TABLE"] = "1"
         retVal = Mochitest.buildURLOptions(self, options, env)
 
-        if not options.robocop:
+        if not options.robocopIni:
             #we really need testConfig.js (for browser chrome)
             try:
                 self._dm.pushDir(options.profilePath, self.remoteProfile)
             except devicemanager.DMError:
                 print "Automation Error: Unable to copy profile to device."
                 raise
 
         options.profilePath = self.remoteProfile
@@ -485,16 +510,17 @@ class MochiRemote(Mochitest):
         return browserEnv
 
         
 def main():
     scriptdir = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
     auto = RemoteAutomation(None, "fennec")
     parser = RemoteOptions(auto, scriptdir)
     options, args = parser.parse_args()
+
     if (options.dm_trans == "adb"):
         if (options.deviceIP):
             dm = droid.DroidADB(options.deviceIP, options.devicePort, deviceRoot=options.remoteTestRoot)
         else:
             dm = droid.DroidADB(deviceRoot=options.remoteTestRoot)
     else:
          dm = droid.DroidSUT(options.deviceIP, options.devicePort, deviceRoot=options.remoteTestRoot)
     auto.setDeviceManager(dm)
@@ -521,22 +547,22 @@ def main():
     auto.setServerInfo(options.webServer, options.httpPort, options.sslPort)
 
     print dm.getInfo()
 
     procName = options.app.split('/')[-1]
     if (dm.processExist(procName)):
         dm.killProcess(procName)
 
-    if options.robocop != "":
+    if options.robocopIni != "":
         # sut may wait up to 300 s for a robocop am process before returning
         dm.default_timeout = 320
         mp = manifestparser.TestManifest(strict=False)
         # TODO: pull this in dynamically
-        mp.read(options.robocop)
+        mp.read(options.robocopIni)
         robocop_tests = mp.active_tests(exists=False)
         tests = []
         my_tests = tests
         for test in robocop_tests:
             tests.append(test['name'])
 
         if options.totalChunks:
             tests_per_chunk = math.ceil(len(tests) / (options.totalChunks * 1.0))
@@ -554,18 +580,18 @@ def main():
             fennec_ids = options.robocopIds
         dm.pushFile(fennec_ids, os.path.join(deviceRoot, "fennec_ids.txt"))
         options.extraPrefs.append('robocop.logfile="%s/robocop.log"' % deviceRoot)
         options.extraPrefs.append('browser.search.suggest.enabled=true')
         options.extraPrefs.append('browser.search.suggest.prompted=true')
         options.extraPrefs.append('browser.viewport.scaleRatio=100')
         options.extraPrefs.append('browser.chrome.dynamictoolbar=false')
 
-        if (options.dm_trans == 'adb' and options.robocopPath):
-          dm._checkCmd(["install", "-r", os.path.join(options.robocopPath, "robocop.apk")])
+        if (options.dm_trans == 'adb' and options.robocopApk):
+          dm._checkCmd(["install", "-r", options.robocopApk])
 
         retVal = None
         for test in robocop_tests:
             if options.testPath and options.testPath != test['name']:
                 continue
 
             if not test['name'] in my_tests:
                 continue
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -61,19 +61,19 @@ RUN_MOCHITEST_REMOTE = \
     --console-level=INFO --log-file=./$@.log --file-level=INFO $(DM_FLAGS) --dm_trans=$(DM_TRANS) \
     --app=$(TEST_PACKAGE_NAME) --deviceIP=${TEST_DEVICE} --xre-path=${MOZ_HOST_BIN} \
     --testing-modules-dir=$(call core_abspath,_tests/modules) \
     $(SYMBOLS_PATH) $(TEST_PATH_ARG) $(EXTRA_TEST_ARGS)
 
 RUN_MOCHITEST_ROBOTIUM = \
   rm -f ./$@.log && \
   $(PYTHON) _tests/testing/mochitest/runtestsremote.py \
-    --robocop-path=$(DIST) \
+    --robocop-apk=$(DIST)/robocop.apk \
     --robocop-ids=$(DIST)/fennec_ids.txt \
-    --robocop=$(DEPTH)/build/mobile/robocop/robocop.ini \
+    --robocop-ini=$(DEPTH)/build/mobile/robocop/robocop.ini \
     --console-level=INFO --log-file=./$@.log --file-level=INFO $(DM_FLAGS) --dm_trans=$(DM_TRANS) \
     --app=$(TEST_PACKAGE_NAME) --deviceIP=${TEST_DEVICE} --xre-path=${MOZ_HOST_BIN} \
     $(SYMBOLS_PATH) $(TEST_PATH_ARG) $(EXTRA_TEST_ARGS)
 
 ifndef NO_FAIL_ON_TEST_ERRORS
 define check_test_error_internal
   @errors=`grep "TEST-UNEXPECTED-" $@.log` ;\
   if test "$$errors" ; then \