mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 968351 - Allow test manifests with just support-files. r=gps
This commit is contained in:
parent
e3a7de47c3
commit
ea1a307391
@ -437,15 +437,15 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
|
||||
try:
|
||||
m = manifestparser.TestManifest(manifests=[path], strict=True)
|
||||
|
||||
if not m.tests:
|
||||
defaults = m.manifest_defaults[os.path.normpath(path)]
|
||||
if not m.tests and not 'support-files' in defaults:
|
||||
raise SandboxValidationError('Empty test manifest: %s'
|
||||
% path)
|
||||
|
||||
obj = TestManifest(sandbox, path, m, flavor=flavor,
|
||||
install_prefix=install_prefix,
|
||||
relpath=mozpath.join(manifest_reldir, mozpath.basename(path)),
|
||||
dupe_manifest='dupe-manifest' in m.tests[0])
|
||||
dupe_manifest='dupe-manifest' in defaults)
|
||||
|
||||
filtered = m.tests
|
||||
|
||||
@ -463,13 +463,7 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
extras = (('head', set()),
|
||||
('tail', set()),
|
||||
('support-files', set()))
|
||||
|
||||
for test in filtered:
|
||||
obj.tests.append(test)
|
||||
|
||||
obj.installs[mozpath.normpath(test['path'])] = \
|
||||
mozpath.join(out_dir, test['relpath'])
|
||||
|
||||
def process_support_files(test):
|
||||
for thing, seen in extras:
|
||||
value = test.get(thing, '')
|
||||
if value in seen:
|
||||
@ -491,6 +485,18 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
|
||||
obj.installs[full] = mozpath.join(out_dir, pattern)
|
||||
|
||||
for test in filtered:
|
||||
obj.tests.append(test)
|
||||
|
||||
obj.installs[mozpath.normpath(test['path'])] = \
|
||||
mozpath.join(out_dir, test['relpath'])
|
||||
|
||||
process_support_files(test)
|
||||
|
||||
if not m.tests:
|
||||
# If there are no tests, look for support-files under DEFAULT.
|
||||
process_support_files(defaults)
|
||||
|
||||
# We also copy the manifest into the output directory.
|
||||
out_path = mozpath.join(out_dir, mozpath.basename(manifest_path))
|
||||
obj.installs[path] = out_path
|
||||
@ -500,7 +506,7 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
# reason. Here, we prune those files from the install set.
|
||||
# FUTURE we should be able to detect autogenerated files from
|
||||
# other build metadata. Once we do that, we can get rid of this.
|
||||
for f in m.tests[0].get('generated-files', '').split():
|
||||
for f in defaults.get('generated-files', '').split():
|
||||
# We re-raise otherwise the stack trace isn't informative.
|
||||
try:
|
||||
del obj.installs[mozpath.join(manifest_dir, f)]
|
||||
|
@ -0,0 +1 @@
|
||||
hello
|
@ -0,0 +1,2 @@
|
||||
[DEFAULT]
|
||||
support-files = foo.txt
|
@ -0,0 +1,4 @@
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
MOCHITEST_MANIFESTS += ['just-support.ini']
|
@ -242,6 +242,18 @@ class TestEmitterBasic(unittest.TestCase):
|
||||
with self.assertRaisesRegexp(SandboxValidationError, 'Empty test manifest'):
|
||||
self.read_topsrcdir(reader)
|
||||
|
||||
|
||||
def test_test_manifest_just_support_files(self):
|
||||
"""A test manifest with no tests but support-files is supported."""
|
||||
reader = self.reader('test-manifest-just-support')
|
||||
|
||||
objs = self.read_topsrcdir(reader)
|
||||
self.assertEqual(len(objs), 1)
|
||||
o = objs[0]
|
||||
self.assertEqual(len(o.installs), 2)
|
||||
paths = sorted([k[len(o.directory)+1:] for k in o.installs.keys()])
|
||||
self.assertEqual(paths, ["foo.txt", "just-support.ini"])
|
||||
|
||||
def test_test_manifest_keys_extracted(self):
|
||||
"""Ensure all metadata from test manifests is extracted."""
|
||||
reader = self.reader('test-manifest-keys-extracted')
|
||||
|
Loading…
Reference in New Issue
Block a user