Bug 869635 - Eliminate the xpcshell master manifest, r=gps.

This commit is contained in:
Joshua Cranmer 2013-06-12 07:27:17 -05:00
Родитель 5ac0591ef9
Коммит fa0044a326
7 изменённых файлов: 37 добавлений и 190 удалений

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

@ -13,17 +13,6 @@ import os
from glob import glob
import manifestparser
class srcManifestParser(manifestparser.ManifestParser):
def __init__(self, manifests=(), defaults=None, strict=True, testroot=None):
self.testroot = testroot
manifestparser.ManifestParser.__init__(self, manifests, defaults, strict)
def getRelativeRoot(self, here):
if self.testroot is None:
return manifestparser.ManifestParser.getRelativeRoot(self, self.rootdir)
return self.testroot
def getIniTests(testdir):
mp = manifestparser.ManifestParser(strict=False)
mp.read(os.path.join(testdir, 'xpcshell.ini'))
@ -72,29 +61,13 @@ def verifyIniFile(initests, directory):
print >>sys.stderr, "TEST-UNEXPECTED-FAIL | xpccheck | found %s in xpcshell.ini and not in directory '%s'" % (name, directory)
sys.exit(1)
def verifyMasterIni(mastername, topsrcdir, directory):
mp = srcManifestParser(strict=False, testroot=topsrcdir)
mp.read(mastername)
tests = mp.tests
found = False
for test in tests:
if test['manifest'] == os.path.abspath(os.path.join(directory, 'xpcshell.ini')):
found = True
break
if not found:
print >>sys.stderr, "TEST-UNEXPECTED-FAIL | xpccheck | directory %s is missing from master xpcshell.ini file %s" % (directory, mastername)
sys.exit(1)
if __name__ == '__main__':
if len(sys.argv) < 4:
print >>sys.stderr, "Usage: xpccheck.py <topsrcdir> <path/master.ini> <directory> [<directory> ...]"
if len(sys.argv) < 3:
print >>sys.stderr, "Usage: xpccheck.py <topsrcdir> <directory> [<directory> ...]"
sys.exit(1)
topsrcdir = sys.argv[1]
for d in sys.argv[3:]:
for d in sys.argv[2:]:
# xpcshell-unpack is a copy of xpcshell sibling directory and in the Makefile
# we copy all files (including xpcshell.ini from the sibling directory.
if d.endswith('toolkit/mozapps/extensions/test/xpcshell-unpack'):
@ -103,6 +76,3 @@ if __name__ == '__main__':
initests = getIniTests(d)
verifyDirectory(initests, d)
verifyIniFile(initests, d)
verifyMasterIni(sys.argv[2], topsrcdir, d)

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

@ -31,7 +31,6 @@ libs-xpcshell-tests:
ifndef NO_XPCSHELL_MANIFEST_CHECK #{
$(PYTHON) $(MOZILLA_DIR)/build/xpccheck.py \
$(topsrcdir) \
$(topsrcdir)/testing/xpcshell/xpcshell.ini \
$(addprefix $(MOZILLA_DIR)/$(relativesrcdir)/,$(XPCSHELL_TESTS))
endif #} NO_XPCSHELL_MANIFEST_CHECK

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

@ -31,7 +31,6 @@ libs-xpcshell-tests:
ifndef NO_XPCSHELL_MANIFEST_CHECK #{
$(PYTHON) $(MOZILLA_DIR)/build/xpccheck.py \
$(topsrcdir) \
$(topsrcdir)/testing/xpcshell/xpcshell.ini \
$(addprefix $(MOZILLA_DIR)/$(relativesrcdir)/,$(XPCSHELL_TESTS))
endif #} NO_XPCSHELL_MANIFEST_CHECK

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

@ -122,6 +122,8 @@ class RecursiveMakeBackend(BuildBackend):
self.summary.backend_detailed_summary = types.MethodType(detailed,
self.summary)
self.xpcshell_manifests = []
self.backend_input_files.add(os.path.join(self.environment.topobjdir,
'config', 'autoconf.mk'))
@ -167,7 +169,7 @@ class RecursiveMakeBackend(BuildBackend):
self._process_program(obj.program, backend_file)
elif isinstance(obj, XpcshellManifests):
self._process_xpcshell_manifests(obj.xpcshell_manifests, backend_file)
self._process_xpcshell_manifests(obj, backend_file)
self._backend_files[obj.srcdir] = backend_file
@ -238,6 +240,18 @@ class RecursiveMakeBackend(BuildBackend):
self._update_from_avoid_write(backend_deps.close())
self.summary.managed_count += 1
# Make the master xpcshell.ini file
self.xpcshell_manifests.sort()
if len(self.xpcshell_manifests) > 0:
mastermanifest = FileAvoidWrite(os.path.join(
self.environment.topobjdir, 'testing', 'xpcshell', 'xpcshell.ini'))
mastermanifest.write(
'; THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY BY HAND.\n\n')
for manifest in self.xpcshell_manifests:
mastermanifest.write("[include:%s]\n" % manifest)
self._update_from_avoid_write(mastermanifest.close())
self.summary.managed_count += 1
def _process_directory_traversal(self, obj, backend_file):
"""Process a data.DirectoryTraversal instance."""
fh = backend_file.fh
@ -303,5 +317,9 @@ class RecursiveMakeBackend(BuildBackend):
def _process_program(self, program, backend_file):
backend_file.write('PROGRAM = %s\n' % program)
def _process_xpcshell_manifests(self, manifest, backend_file, namespace=""):
def _process_xpcshell_manifests(self, obj, backend_file, namespace=""):
manifest = obj.xpcshell_manifests
backend_file.write('XPCSHELL_TESTS += %s\n' % os.path.dirname(manifest))
if obj.relativedir != '':
manifest = '%s/%s' % (obj.relativedir, manifest)
self.xpcshell_manifests.append(manifest)

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

@ -233,5 +233,17 @@ class TestRecursiveMakeBackend(BackendTester):
expected = ('aa', 'bb', 'cc', 'dd', 'valid_val')
self.assertEqual(xpclines, ["XPCSHELL_TESTS += %s" % val for val in expected])
def test_xpcshell_master_manifest(self):
"""Ensure that the master xpcshell manifest is written out correctly."""
env = self._consume('xpcshell_manifests', RecursiveMakeBackend)
manifest_path = os.path.join(env.topobjdir,
'testing', 'xpcshell', 'xpcshell.ini')
lines = [l.strip() for l in open(manifest_path, 'rt').readlines()]
expected = ('aa', 'bb', 'cc', 'dd', 'valid_val')
self.assertEqual(lines, [
'; THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY BY HAND.',
''] + ['[include:%s/xpcshell.ini]' % x for x in expected])
if __name__ == '__main__':
main()

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

@ -49,10 +49,10 @@ MOZINFO_FILES := \
PKG_STAGE = $(DIST)/test-package-stage
libs::
$(INSTALL) $(srcdir)/xpcshell.ini $(DEPTH)/_tests/xpcshell
$(INSTALL) xpcshell.ini $(DEPTH)/_tests/xpcshell
$(INSTALL) $(srcdir)/xpcshell_b2g.ini $(DEPTH)/_tests/xpcshell
$(INSTALL) $(srcdir)/xpcshell_android.ini $(DEPTH)/_tests/xpcshell
cp $(srcdir)/xpcshell.ini $(DEPTH)/_tests/xpcshell/all-test-dirs.list
cp $(DEPTH)/_tests/xpcshell/xpcshell.ini $(DEPTH)/_tests/xpcshell/all-test-dirs.list
# Run selftests
check::

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

@ -1,151 +0,0 @@
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
[include:chrome/test/unit/xpcshell.ini]
[include:intl/locale/tests/unit/xpcshell.ini]
[include:netwerk/cookie/test/unit/xpcshell.ini]
[include:modules/libjar/zipwriter/test/unit/xpcshell.ini]
[include:uriloader/exthandler/tests/unit/xpcshell.ini]
[include:parser/xml/test/unit/xpcshell.ini]
[include:image/test/unit/xpcshell.ini]
[include:dom/activities/tests/unit/xpcshell.ini]
[include:dom/apps/tests/unit/xpcshell.ini]
[include:dom/encoding/test/unit/xpcshell.ini]
[include:dom/plugins/test/unit/xpcshell.ini]
[include:dom/mobilemessage/tests/xpcshell.ini]
[include:dom/wappush/tests/xpcshell.ini]
[include:dom/network/tests/unit/xpcshell.ini]
[include:dom/network/tests/unit_ipc/xpcshell.ini]
[include:dom/network/tests/unit_stats/xpcshell.ini]
[include:dom/payment/tests/unit/xpcshell.ini]
[include:dom/permission/tests/unit/xpcshell.ini]
[include:dom/src/json/test/unit/xpcshell.ini]
[include:dom/system/gonk/tests/xpcshell.ini]
[include:dom/tests/unit/xpcshell.ini]
[include:dom/indexedDB/test/unit/xpcshell.ini]
[include:docshell/test/unit/xpcshell.ini]
[include:docshell/test/unit_ipc/xpcshell.ini]
[include:embedding/tests/unit/xpcshell.ini]
[include:toolkit/components/commandlines/test/unit/xpcshell.ini]
[include:toolkit/components/contentprefs/tests/unit/xpcshell.ini]
[include:toolkit/components/contentprefs/tests/unit_cps2/xpcshell.ini]
[include:toolkit/devtools/server/tests/unit/xpcshell.ini]
[include:toolkit/devtools/apps/tests/unit/xpcshell.ini]
[include:toolkit/devtools/sourcemap/tests/unit/xpcshell.ini]
[include:toolkit/components/passwordmgr/test/unit/xpcshell.ini]
# Bug 676989: tests hang on Android
skip-if = os == "android"
[include:toolkit/components/places/tests/migration/xpcshell.ini]
[include:toolkit/components/places/tests/autocomplete/xpcshell.ini]
[include:toolkit/components/places/tests/inline/xpcshell.ini]
[include:toolkit/components/places/tests/expiration/xpcshell.ini]
[include:toolkit/components/places/tests/favicons/xpcshell.ini]
[include:toolkit/components/places/tests/sync/xpcshell.ini]
[include:toolkit/components/places/tests/bookmarks/xpcshell.ini]
[include:toolkit/components/places/tests/queries/xpcshell.ini]
[include:toolkit/components/places/tests/unit/xpcshell.ini]
[include:toolkit/components/places/tests/network/xpcshell.ini]
[include:toolkit/components/urlformatter/tests/unit/xpcshell.ini]
[include:toolkit/components/ctypes/tests/unit/xpcshell.ini]
[include:toolkit/components/autocomplete/tests/unit/xpcshell.ini]
[include:toolkit/components/satchel/test/unit/xpcshell.ini]
[include:toolkit/components/downloads/test/unit/xpcshell.ini]
[include:toolkit/components/downloads/test/schema_migration/xpcshell.ini]
[include:toolkit/components/jsdownloads/test/unit/xpcshell.ini]
[include:toolkit/components/startup/tests/unit/xpcshell.ini]
[include:toolkit/components/telemetry/tests/unit/xpcshell.ini]
[include:toolkit/components/social/test/xpcshell/xpcshell.ini]
[include:toolkit/components/mediasniffer/test/unit/xpcshell.ini]
[include:toolkit/forgetaboutsite/test/unit/xpcshell.ini]
[include:toolkit/content/tests/unit/xpcshell.ini]
[include:toolkit/identity/tests/unit/xpcshell.ini]
[include:toolkit/modules/tests/xpcshell/xpcshell.ini]
[include:toolkit/mozapps/downloads/tests/unit/xpcshell.ini]
[include:toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini]
[include:toolkit/mozapps/extensions/test/xpcshell-unpack/xpcshell.ini]
[include:toolkit/mozapps/update/test_timermanager/unit/xpcshell.ini]
[include:toolkit/mozapps/update/test_svc/unit/xpcshell.ini]
[include:toolkit/mozapps/update/test/unit/xpcshell.ini]
[include:security/manager/ssl/tests/unit/xpcshell.ini]
[include:testing/xpcshell/example/unit/xpcshell.ini]
[include:xpcom/tests/unit/xpcshell.ini]
[include:modules/libpref/test/unit/xpcshell.ini]
[include:intl/strres/tests/unit/xpcshell.ini]
[include:intl/unicharutil/tests/unit/xpcshell.ini]
[include:intl/uconv/tests/unit/xpcshell.ini]
[include:netwerk/test/unit/xpcshell.ini]
[include:netwerk/test/httpserver/test/xpcshell.ini]
[include:js/ductwork/debugger/tests/xpcshell.ini]
[include:js/jsd/test/xpcshell.ini]
[include:js/xpconnect/tests/unit/xpcshell.ini]
[include:modules/libjar/test/unit/xpcshell.ini]
[include:extensions/cookie/test/unit/xpcshell.ini]
[include:storage/test/unit/xpcshell.ini]
[include:rdf/tests/unit/xpcshell.ini]
[include:gfx/tests/unit/xpcshell.ini]
[include:widget/tests/unit/xpcshell.ini]
[include:content/base/test/unit/xpcshell.ini]
[include:content/test/unit/xpcshell.ini]
[include:toolkit/components/url-classifier/tests/unit/xpcshell.ini]
[include:services/common/tests/unit/xpcshell.ini]
[include:services/crypto/tests/unit/xpcshell.ini]
[include:services/crypto/components/tests/unit/xpcshell.ini]
[include:services/datareporting/tests/xpcshell/xpcshell.ini]
[include:services/healthreport/tests/xpcshell/xpcshell.ini]
[include:services/metrics/tests/xpcshell/xpcshell.ini]
[include:services/sync/tests/unit/xpcshell.ini]
[include:browser/components/dirprovider/tests/unit/xpcshell.ini]
[include:browser/components/downloads/test/unit/xpcshell.ini]
[include:browser/components/feeds/test/unit/xpcshell.ini]
[include:browser/components/migration/tests/unit/xpcshell.ini]
[include:browser/components/places/tests/unit/xpcshell.ini]
[include:browser/components/privatebrowsing/test/unit/xpcshell.ini]
[include:browser/components/sessionstore/test/unit/xpcshell.ini]
[include:browser/components/shell/test/unit/xpcshell.ini]
[include:browser/devtools/shared/test/unit/xpcshell.ini]
[include:browser/metro/base/tests/unit/xpcshell.ini]
[include:browser/modules/test/unit/xpcshell.ini]
[include:extensions/spellcheck/hunspell/tests/unit/xpcshell.ini]
[include:toolkit/components/search/tests/xpcshell/xpcshell.ini]
[include:toolkit/components/osfile/tests/xpcshell/xpcshell.ini]
[include:toolkit/mozapps/shared/test/unit/xpcshell.ini]
[include:services/crypto/component/tests/unit/xpcshell.ini]
[include:layout/tools/layout-debug/tests/unit/xpcshell.ini]
skip-if = !debug
[include:toolkit/crashreporter/test/unit/xpcshell.ini]
skip-if = !crashreporter
[include:toolkit/crashreporter/test/unit_ipc/xpcshell.ini]
skip-if = !crashreporter
#XXX: we don't actually set os = maemo
[include:toolkit/crashreporter/client/maemo-unit/xpcshell.ini]
run-if = os == "maemo"
[include:toolkit/components/commandlines/test/unit_win/xpcshell.ini]
skip-if = os != "win"
[include:toolkit/components/commandlines/test/unit_unix/xpcshell.ini]
skip-if = os == "win" || os == "mac" || os == "os2"
[include:content/base/test/unit_ipc/xpcshell.ini]
[include:chrome/test/unit_ipc/xpcshell.ini]
[include:extensions/cookie/test/unit_ipc/xpcshell.ini]
[include:ipc/testshell/tests/xpcshell.ini]
[include:modules/libpref/test/unit_ipc/xpcshell.ini]
[include:netwerk/test/unit_ipc/xpcshell.ini]
[include:netwerk/cookie/test/unit_ipc/xpcshell.ini]
[include:toolkit/components/contentprefs/tests/unit_ipc/xpcshell.ini]
[include:addon-sdk/test/unit/xpcshell.ini]
[include:uriloader/exthandler/tests/unit_ipc/xpcshell.ini]
[include:modules/libmar/tests/unit/xpcshell.ini]
skip-if = os == "android"
[include:b2g/components/test/unit/xpcshell.ini]
[include:tools/profiler/tests/xpcshell.ini]
[include:toolkit/components/captivedetect/test/unit/xpcshell.ini]