Bug 759664 - Register testing-only JS modules with mochitests; r=ted

This commit is contained in:
Gregory Szorc 2012-08-06 14:22:09 -07:00
Родитель 95206f4816
Коммит 847a1eba29
3 изменённых файлов: 59 добавлений и 15 удалений

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

@ -8,6 +8,10 @@ Components.utils.import("resource://gre/modules/NetUtil.jsm");
function test() {
waitForExplicitFinish();
// We overload this test to include verifying that httpd.js is
// importable as a testing-only JS module.
Components.utils.import("resource://testing-common/httpd.js", {});
nextTest();
}

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

@ -208,6 +208,12 @@ class MochitestOptions(optparse.OptionParser):
"This directory will be deleted after the tests are finished")
defaults["profilePath"] = tempfile.mkdtemp()
self.add_option("--testing-modules-dir", action = "store",
type = "string", dest = "testingModulesDir",
help = "Directory where testing-only JS modules are "
"located.")
defaults["testingModulesDir"] = None
self.add_option("--use-vmware-recording",
action = "store_true", dest = "vmwareRecording",
help = "enables recording while the application is running "
@ -324,6 +330,34 @@ See <http://mochikit.com/doc/html/MochiKit/Logging.html> for details on the logg
if options.webapprtContent and options.webapprtChrome:
self.error("Only one of --webapprt-content and --webapprt-chrome may be given.")
# Try to guess the testing modules directory.
# This somewhat grotesque hack allows the buildbot machines to find the
# modules directory without having to configure the buildbot hosts. This
# code should never be executed in local runs because the build system
# should always set the flag that populates this variable. If buildbot ever
# passes this argument, this code can be deleted.
if options.testingModulesDir is None:
possible = os.path.join(os.getcwd(), os.path.pardir, 'modules')
if os.path.isdir(possible):
options.testingModulesDir = possible
# Even if buildbot is updated, we still want this, as the path we pass in
# to the app must be absolute and have proper slashes.
if options.testingModulesDir is not None:
options.testingModulesDir = os.path.normpath(options.testingModulesDir)
if not os.path.isabs(options.testingModulesDir):
options.testingModulesDir = os.path.abspath(testingModulesDir)
if not os.path.isdir(options.testingModulesDir):
self.error('--testing-modules-dir not a directory: %s' %
options.testingModulesDir)
options.testingModulesDir = options.testingModulesDir.replace('\\', '/')
if options.testingModulesDir[-1] != '/':
options.testingModulesDir += '/'
return options
@ -806,6 +840,10 @@ toolbar#nav-bar {
chrometestDir = "file:///" + chrometestDir.replace("\\", "/")
manifestFile.write("content mochitests %s contentaccessible=yes\n" % chrometestDir)
if options.testingModulesDir is not None:
manifestFile.write("resource testing-common file:///%s\n" %
options.testingModulesDir)
# Call installChromeJar().
jarDir = "mochijar"
if not os.path.isdir(os.path.join(self.SCRIPT_DIRECTORY, jarDir)):

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

@ -28,25 +28,27 @@ TEST_PACKAGE_NAME := $(ANDROID_PACKAGE_NAME)
endif
RUN_MOCHITEST = \
rm -f ./$@.log && \
$(PYTHON) _tests/testing/mochitest/runtests.py --autorun --close-when-done \
--console-level=INFO --log-file=./$@.log --file-level=INFO \
--failure-file=$(call core_abspath,_tests/testing/mochitest/makefailures.json) \
$(SYMBOLS_PATH) $(TEST_PATH_ARG) $(EXTRA_TEST_ARGS)
rm -f ./$@.log && \
$(PYTHON) _tests/testing/mochitest/runtests.py --autorun --close-when-done \
--console-level=INFO --log-file=./$@.log --file-level=INFO \
--failure-file=$(call core_abspath,_tests/testing/mochitest/makefailures.json) \
--testing-modules-dir=$(call core_abspath,_tests/modules) \
$(SYMBOLS_PATH) $(TEST_PATH_ARG) $(EXTRA_TEST_ARGS)
RERUN_MOCHITEST = \
rm -f ./$@.log && \
$(PYTHON) _tests/testing/mochitest/runtests.py --autorun --close-when-done \
--console-level=INFO --log-file=./$@.log --file-level=INFO \
--run-only-tests=makefailures.json \
$(SYMBOLS_PATH) $(TEST_PATH_ARG) $(EXTRA_TEST_ARGS)
rm -f ./$@.log && \
$(PYTHON) _tests/testing/mochitest/runtests.py --autorun --close-when-done \
--console-level=INFO --log-file=./$@.log --file-level=INFO \
--run-only-tests=makefailures.json \
--testing-modules-dir=$(call core_abspath,_tests/modules) \
$(SYMBOLS_PATH) $(TEST_PATH_ARG) $(EXTRA_TEST_ARGS)
RUN_MOCHITEST_REMOTE = \
rm -f ./$@.log && \
$(PYTHON) _tests/testing/mochitest/runtestsremote.py --autorun --close-when-done \
--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)
rm -f ./$@.log && \
$(PYTHON) _tests/testing/mochitest/runtestsremote.py --autorun --close-when-done \
--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)
RUN_MOCHITEST_ROBOTIUM = \
rm -f ./$@.log && \