Backed out 2 changesets (bug 1283919) for being the wrong way to fix this a=backout

Backed out changeset a328778db08d (bug 1283919)
Backed out changeset 7e1f25f59298 (bug 1283919)
This commit is contained in:
Wes Kocher 2016-09-07 14:22:21 -07:00
parent a66df0b0c2
commit 4c4ea87ae0
8 changed files with 121 additions and 83 deletions

View File

@ -6,6 +6,8 @@
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
MARIONETTE_UNIT_MANIFESTS += ['tests/marionette/manifest.ini']
JAR_MANIFESTS += ['jar.mn']
XPIDL_SOURCES += [

View File

@ -204,6 +204,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
FINAL_LIBRARY = 'xul'
BROWSER_CHROME_MANIFESTS += ['tests/browser.ini']
MARIONETTE_LAYOUT_MANIFESTS += ['tests/marionette/manifest.ini']
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini']

View File

@ -16,9 +16,6 @@ import os
import sys
import time
from manifestparser import TestManifest
from reftest import ReftestManifest
from mozbuild.util import ensureParentDir
from mozpack.files import FileFinder
from mozpack.mozjar import JarWriter
@ -96,35 +93,6 @@ ARCHIVE_FILES = {
'base': '_tests',
'pattern': 'modules/**',
},
{
'source': buildconfig.topsrcdir,
'base': 'testing/marionette',
'patterns': [
'client/**',
'mach_test_package_commands.py',
],
'dest': 'marionette',
},
{
'source': buildconfig.topsrcdir,
'base': 'testing/marionette/harness',
'pattern': '**',
'dest': 'marionette',
'ignore': [
'marionette/tests'
]
},
{
'source': buildconfig.topsrcdir,
'base': '',
'manifests': [
'testing/marionette/harness/marionette/tests/unit-tests.ini',
'testing/marionette/harness/marionette/tests/webapi-tests.ini',
],
# We also need the manifests and harness_unit tests
'pattern': 'testing/marionette/harness/marionette/tests/**',
'dest': 'marionette/tests',
},
{
'source': buildconfig.topobjdir,
'base': '_tests',
@ -347,15 +315,6 @@ ARCHIVE_FILES = {
'pattern': 'mozinfo.json',
'dest': 'reftest',
},
{
'source': buildconfig.topsrcdir,
'base': '',
'manifests': [
'layout/reftests/reftest.list',
'testing/crashtest/crashtests.list',
],
'dest': 'reftest/tests',
}
],
'talos': [
{
@ -455,28 +414,15 @@ for k, v in ARCHIVE_FILES.items():
def find_files(archive):
for entry in ARCHIVE_FILES[archive]:
source = entry['source']
dest = entry.get('dest')
base = entry.get('base', '')
pattern = entry.get('pattern')
patterns = entry.get('patterns', [])
if pattern:
patterns.append(pattern)
manifest = entry.get('manifest')
manifests = entry.get('manifests', [])
if manifest:
manifests.append(manifest)
if manifests:
dirs = find_manifest_dirs(buildconfig.topsrcdir, manifests)
patterns.extend({'{}/**'.format(d) for d in dirs})
dest = entry.get('dest')
ignore = list(entry.get('ignore', []))
ignore.extend([
'**/.flake8',
'**/.mkdir.done',
'**/*.pyc',
])
ignore.append('**/.mkdir.done')
ignore.append('**/*.pyc')
common_kwargs = {
'find_executables': False,
@ -493,29 +439,14 @@ def find_files(archive):
yield p, f
def find_manifest_dirs(topsrcdir, manifests):
"""Routine to retrieve directories specified in a manifest, relative to topsrcdir.
def find_reftest_dirs(topsrcdir, manifests):
from reftest import ReftestManifest
It does not recurse into manifests, as we currently have no need for that.
"""
dirs = set()
for p in manifests:
p = os.path.join(topsrcdir, p)
if p.endswith('.ini'):
test_manifest = TestManifest()
test_manifest.read(p)
dirs |= set([os.path.dirname(m) for m in test_manifest.manifests()])
elif p.endswith('.list'):
m = ReftestManifest()
m.load(p)
dirs |= m.dirs
else:
raise Exception('"{}" is not a supported manifest format.'.format(
os.path.splitext(p)[1]))
m = ReftestManifest()
m.load(os.path.join(topsrcdir, p))
dirs |= m.dirs
dirs = {mozpath.normpath(d[len(topsrcdir):]).lstrip('/') for d in dirs}
@ -536,6 +467,27 @@ def find_manifest_dirs(topsrcdir, manifests):
return sorted(seen)
def insert_reftest_entries(entries):
"""Reftests have their own mechanism for defining tests and locations.
This function is called when processing the reftest archive to process
reftest test manifests and insert the results into the existing list of
archive entries.
"""
manifests = (
'layout/reftests/reftest.list',
'testing/crashtest/crashtests.list',
)
for base in find_reftest_dirs(buildconfig.topsrcdir, manifests):
entries.append({
'source': buildconfig.topsrcdir,
'base': '',
'pattern': '%s/**' % base,
'dest': 'reftest/tests',
})
def main(argv):
parser = argparse.ArgumentParser(
description='Produce test archives')
@ -547,6 +499,11 @@ def main(argv):
if not args.outputfile.endswith('.zip'):
raise Exception('expected zip output file')
# Adjust reftest entries only if processing reftests (because it is
# unnecessary overhead otherwise).
if args.archive == 'reftest':
insert_reftest_entries(ARCHIVE_FILES['reftest'])
file_count = 0
t_start = time.time()
ensureParentDir(args.outputfile)
@ -558,8 +515,8 @@ def main(argv):
with JarWriter(fileobj=fh, optimize=False, compress_level=5) as writer:
res = find_files(args.archive)
for p, f in res:
writer.add(p.encode('utf-8'), f.read(), mode=f.mode, skip_duplicates=True)
file_count += 1
writer.add(p.encode('utf-8'), f.read(), mode=f.mode)
duration = time.time() - t_start
zip_size = os.path.getsize(args.outputfile)

View File

@ -1515,6 +1515,26 @@ VARIABLES = {
"""List of manifest files defining Android instrumentation tests.
"""),
'MARIONETTE_LAYOUT_MANIFESTS': (ManifestparserManifestList, list,
"""List of manifest files defining marionette-layout tests.
"""),
'MARIONETTE_LOOP_MANIFESTS': (ManifestparserManifestList, list,
"""List of manifest files defining marionette-loop tests.
"""),
'MARIONETTE_UNIT_MANIFESTS': (ManifestparserManifestList, list,
"""List of manifest files defining marionette-unit tests.
"""),
'MARIONETTE_UPDATE_MANIFESTS': (ManifestparserManifestList, list,
"""List of manifest files defining marionette-update tests.
"""),
'MARIONETTE_WEBAPI_MANIFESTS': (ManifestparserManifestList, list,
"""List of manifest files defining marionette-webapi tests.
"""),
'METRO_CHROME_MANIFESTS': (ManifestparserManifestList, list,
"""List of manifest files defining metro browser chrome tests.
"""),

View File

@ -570,7 +570,7 @@ class JarWriter(object):
self._data.write(end.serialize())
self._data.close()
def add(self, name, data, compress=None, mode=None, skip_duplicates=False):
def add(self, name, data, compress=None, mode=None):
'''
Add a new member to the jar archive, with the given name and the given
data.
@ -582,15 +582,13 @@ class JarWriter(object):
than the uncompressed size.
The mode option gives the unix permissions that should be stored
for the jar entry.
If a duplicated member is found skip_duplicates will prevent raising
an exception if set to True.
The given data may be a buffer, a file-like instance, a Deflater or a
JarFileReader instance. The latter two allow to avoid uncompressing
data to recompress it.
'''
name = mozpath.normsep(name)
if name in self._contents and not skip_duplicates:
if name in self._contents:
raise JarWriterError("File %s already in JarWriter" % name)
if compress is None:
compress = self._compress

View File

@ -0,0 +1,38 @@
# 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/.
from manifestparser import TestManifest
import os.path
import sys
def print_test_dirs(topsrcdir, manifest_file):
"""
Simple routine which prints the paths of directories specified
in a Marionette manifest, relative to topsrcdir. This does not recurse
into manifests, as we currently have no need for that.
"""
dirs = set()
# output the directory of this (parent) manifest
topsrcdir = os.path.abspath(topsrcdir)
scriptdir = os.path.abspath(os.path.dirname(__file__))
dirs.add(scriptdir[len(topsrcdir) + 1:])
# output the directories of all the other manifests
manifest = TestManifest()
manifest.read(manifest_file)
for i in manifest.get():
d = os.path.dirname(i['manifest'])[len(topsrcdir) + 1:]
dirs.add(d)
for path in dirs:
path = path.replace('\\', '/')
print path
if __name__ == '__main__':
if len(sys.argv) < 3:
print >>sys.stderr, "Usage: %s topsrcdir manifest.ini" % sys.argv[0]
sys.exit(1)
print_test_dirs(sys.argv[1], sys.argv[2])

View File

@ -5,7 +5,9 @@
DIRS += ["components"]
JAR_MANIFESTS += ["jar.mn"]
MARIONETTE_UNIT_MANIFESTS += ["harness/marionette/tests/unit/unit-tests.ini"]
MARIONETTE_UPDATE_MANIFESTS += ["harness/marionette/tests/update-tests.ini"]
MARIONETTE_WEBAPI_MANIFESTS += ["harness/marionette/tests/webapi-tests.ini"]
XPCSHELL_TESTS_MANIFESTS += ["unit.ini"]
with Files("**"):

View File

@ -182,6 +182,7 @@ stage-all: \
stage-mochitest \
stage-jstests \
stage-jetpack \
stage-marionette \
stage-luciddream \
test-packages-manifest \
$(NULL)
@ -330,6 +331,24 @@ stage-luciddream: make-stage-dir
$(NSINSTALL) -D $(LUCIDDREAM_DIR)
@(cd $(topsrcdir)/testing/luciddream && tar $(TAR_CREATE_FLAGS) - *) | (cd $(LUCIDDREAM_DIR)/ && tar -xf -)
MARIONETTE_DIR=$(PKG_STAGE)/marionette
stage-marionette: make-stage-dir
$(NSINSTALL) -D $(MARIONETTE_DIR)/tests
$(NSINSTALL) -D $(MARIONETTE_DIR)/client
@(cd $(topsrcdir)/testing/marionette/harness && tar --exclude marionette/tests $(TAR_CREATE_FLAGS) - *) | (cd $(MARIONETTE_DIR)/ && tar -xf -)
@(cd $(topsrcdir)/testing/marionette/client && tar $(TAR_CREATE_FLAGS) - *) | (cd $(MARIONETTE_DIR)/client && tar -xf -)
cp $(topsrcdir)/testing/marionette/mach_test_package_commands.py $(MARIONETTE_DIR)
$(PYTHON) $(topsrcdir)/testing/marionette/harness/marionette/tests/print-manifest-dirs.py \
$(topsrcdir) \
$(topsrcdir)/testing/marionette/harness/marionette/tests/unit-tests.ini \
| (cd $(topsrcdir) && xargs tar $(TAR_CREATE_FLAGS) -) \
| (cd $(MARIONETTE_DIR)/tests && tar -xf -)
$(PYTHON) $(topsrcdir)/testing/marionette/harness/marionette/tests/print-manifest-dirs.py \
$(topsrcdir) \
$(topsrcdir)/testing/marionette/harness/marionette/tests/webapi-tests.ini \
| (cd $(topsrcdir) && xargs tar $(TAR_CREATE_FLAGS) -) \
| (cd $(MARIONETTE_DIR)/tests && tar -xf -)
stage-instrumentation-tests: make-stage-dir
$(MAKE) -C $(DEPTH)/testing/instrumentation stage-package
@ -357,6 +376,7 @@ stage-extensions: make-stage-dir
stage-jstests \
stage-android \
stage-jetpack \
stage-marionette \
stage-steeplechase \
stage-instrumentation-tests \
stage-luciddream \