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.
This commit is contained in:
Nick Alexander 2013-05-11 16:53:48 -07:00
Родитель 59c2e95f0d
Коммит 0edfd46374
2 изменённых файлов: 46 добавлений и 20 удалений

Просмотреть файл

@ -80,14 +80,24 @@ class RemoteOptions(MochitestOptions):
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",
@ -158,22 +168,37 @@ class RemoteOptions(MochitestOptions):
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.robocop = os.path.abspath(options.robocop)
options.robocopIni = options.robocop
del options.robocop
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
if options.robocopPath:
if options.robocopApk:
print "ERROR: can not use deprecated --robocop-path and replacement --robocop-apk together"
return None
options.robocopPath = os.path.abspath(options.robocopPath)
options.robocopApk = os.path.join(options.robocopPath, 'robocop.apk')
del 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.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)
@ -308,7 +333,7 @@ class MochiRemote(Mochitest):
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'))
@ -335,7 +360,7 @@ class MochiRemote(Mochitest):
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)
@ -490,6 +515,7 @@ def main():
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)
@ -526,12 +552,12 @@ def main():
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
@ -559,8 +585,8 @@ def main():
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:

Просмотреть файл

@ -66,9 +66,9 @@ RUN_MOCHITEST_REMOTE = \
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)