Bug 710445 - Add support for packaging tests in a specific directory. r=gbrown

This commit is contained in:
Joel Maher 2012-01-07 18:41:08 -05:00
parent bf6761d74e
commit 5d75016d73
2 changed files with 28 additions and 7 deletions

View File

@ -109,9 +109,14 @@ class RemoteOptions(MochitestOptions):
self.add_option("--robocop", action = "store",
type = "string", dest = "robocop",
help = "use when running robotium tests on native UI")
help = "name of the .ini file containing the list of tests to run")
defaults["robocop"] = ""
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")
defaults["robocopPath"] = ""
defaults["remoteTestRoot"] = None
defaults["logFile"] = "mochitest.log"
defaults["autorun"] = True
@ -170,6 +175,19 @@ 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
return None
options.robocop = os.path.abspath(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
return None
options.robocopPath = os.path.abspath(options.robocopPath)
return options
def verifyOptions(self, options, mochitest):
@ -356,10 +374,10 @@ def main():
if (dm.processExist(procName)):
dm.killProcess(procName)
if (options.robocop):
if options.robocop != "":
mp = manifestparser.TestManifest(strict=False)
# TODO: pull this in dynamically
mp.read('robocop.ini')
mp.read(options.robocop)
robocop_tests = mp.active_tests(exists=False)
fHandle = open("robotium.config", "w")
@ -373,11 +391,14 @@ def main():
dm.pushFile(os.path.abspath(options.robocop + "/fennec_ids.txt"), "/sdcard/fennec_ids.txt")
options.extraPrefs.append('robocop.logfile="%s/robocop.log"' % deviceRoot)
if (options.dm_trans == 'adb'):
dm.checkCmd(["install", "-r", os.path.join(options.robocop, "robocop.apk")])
if (options.dm_trans == 'adb' and options.robocopPath):
dm.checkCmd(["install", "-r", os.path.join(options.robocopPath, "robocop.apk")])
appname = options.app
for test in robocop_tests:
if options.testPath and options.testPath != test['name']:
continue
options.app = "am"
options.browserArgs = ["instrument", "-w", "-e", "class"]
options.browserArgs.append("%s.tests.%s" % (appname, test['name']))

View File

@ -76,10 +76,10 @@ RUN_MOCHITEST_REMOTE = \
RUN_MOCHITEST_ROBOTIUM = \
rm -f ./$@.log && \
$(PYTHON) _tests/testing/mochitest/runtestsremote.py --robocop ../../../build/mobile/robocop \
$(PYTHON) _tests/testing/mochitest/runtestsremote.py --robocop-path build/mobile/robocop \
--console-level=INFO --log-file=./$@.log --file-level=INFO $(DM_FLAGS) --dm_trans=adb \
--app=$(TEST_PACKAGE_NAME) --deviceIP=${TEST_DEVICE} --xre-path=${MOZ_HOST_BIN} \
$(SYMBOLS_PATH) $(TEST_PATH_ARG) $(EXTRA_TEST_ARGS)
--robocop build/mobile/robocop/robocop.ini $(SYMBOLS_PATH) $(TEST_PATH_ARG) $(EXTRA_TEST_ARGS)
ifndef NO_FAIL_ON_TEST_ERRORS
define CHECK_TEST_ERROR