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
Родитель 463101f265
Коммит 7b72748474
2 изменённых файлов: 28 добавлений и 7 удалений

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

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

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

@ -76,10 +76,10 @@ RUN_MOCHITEST_REMOTE = \
RUN_MOCHITEST_ROBOTIUM = \ RUN_MOCHITEST_ROBOTIUM = \
rm -f ./$@.log && \ 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 \ --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} \ --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 ifndef NO_FAIL_ON_TEST_ERRORS
define CHECK_TEST_ERROR define CHECK_TEST_ERROR