mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 22:37:50 +00:00
Bug 1261456 - Combine support-files listed in [DEFAULT] with any listed per-test rather than overriding. r=gps
This requires a change to how we process test manifests in the build system: now, whenever we see a support file mentioned in a manifest, we require that file isn't already in that test's support files, but if we see a support file that was already seen in some other test, the entry is ignored, but it is not an error. As a result of this change, several duplicate support-files entries needed to be removed. MozReview-Commit-ID: G0juyxzcaB8 --HG-- rename : testing/mozbase/manifestparser/tests/test_default_skipif.py => testing/mozbase/manifestparser/tests/test_default_overrides.py
This commit is contained in:
parent
dc426e9cbb
commit
52083635d3
@ -673,17 +673,12 @@ skip-if = buildapp == 'b2g'
|
||||
[test_bug698384.html]
|
||||
[test_bug704063.html]
|
||||
[test_bug704320_http_http.html]
|
||||
support-files = referrerHelper.js
|
||||
[test_bug704320_http_https.html]
|
||||
support-files = referrerHelper.js
|
||||
[test_bug704320_https_http.html]
|
||||
support-files = referrerHelper.js
|
||||
skip-if = buildapp == 'b2g' # b2g (https://example.com not working bug 1162353)
|
||||
[test_bug704320_https_https.html]
|
||||
support-files = referrerHelper.js
|
||||
skip-if = buildapp == 'b2g' # b2g (https://example.com not working bug 1162353)
|
||||
[test_bug704320_policyset.html]
|
||||
support-files = referrerHelper.js
|
||||
[test_bug704320_policyset2.html]
|
||||
skip-if = os == "mac" # fails intermittently - bug 1101288
|
||||
[test_bug704320_preload.html]
|
||||
@ -739,9 +734,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #bug 901343, specialpowers.wr
|
||||
[test_bug1101364.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android'
|
||||
[test_bug1163743.html]
|
||||
support-files = referrerHelper.js
|
||||
[test_bug1165501.html]
|
||||
support-files = referrerHelper.js
|
||||
[test_img_referrer.html]
|
||||
[test_anchor_area_referrer.html]
|
||||
[test_anchor_area_referrer_changing.html]
|
||||
|
@ -83,7 +83,6 @@ support-files =
|
||||
browserElement_XFrameOptionsAllowFrom.js
|
||||
browserElement_XFrameOptionsDeny.js
|
||||
browserElement_XFrameOptionsSameOrigin.js
|
||||
browserElement_XFrameOptionsSameOrigin.js
|
||||
browserElement_GetContentDimensions.js
|
||||
browserElement_AudioChannel.js
|
||||
browserElement_AudioChannel_nested.js
|
||||
|
@ -1,6 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
bbox-helper.svg
|
||||
MutationEventChecker.js
|
||||
a_href_destination.svg
|
||||
a_href_helper_01.svg
|
||||
a_href_helper_02_03.svg
|
||||
@ -9,13 +9,12 @@ support-files =
|
||||
animated-svg-image-helper.svg
|
||||
bbox-helper.svg
|
||||
bounds-helper.svg
|
||||
getBBox-method-helper.svg
|
||||
dataTypes-helper.svg
|
||||
fragments-helper.svg
|
||||
getBBox-method-helper.svg
|
||||
getCTM-helper.svg
|
||||
getSubStringLength-helper.svg
|
||||
matrixUtils.js
|
||||
MutationEventChecker.js
|
||||
object-delayed-intrinsic-size.sjs
|
||||
pointer-events.js
|
||||
scientific-helper.svg
|
||||
|
@ -26,7 +26,6 @@ support-files =
|
||||
image3ico32x32.png
|
||||
image4.gif
|
||||
image4gif16x16bmp24bpp.ico
|
||||
image4gif16x16bmp24bpp.ico
|
||||
image4gif16x16bmp32bpp.ico
|
||||
image4gif32x32bmp24bpp.ico
|
||||
image4gif32x32bmp32bpp.ico
|
||||
|
@ -0,0 +1,8 @@
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
[DEFAULT]
|
||||
support-files = foo.js bar.js
|
||||
|
||||
[test_baz.js]
|
||||
support-files = bar.js
|
@ -0,0 +1,4 @@
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
MOCHITEST_MANIFESTS += ['mochitest.ini']
|
@ -429,6 +429,16 @@ class TestEmitterBasic(unittest.TestCase):
|
||||
with self.assertRaisesRegexp(SandboxValidationError, 'Empty test manifest'):
|
||||
self.read_topsrcdir(reader)
|
||||
|
||||
def test_test_manifest_dupe_support_files(self):
|
||||
"""A test manifest with dupe support-files in a single test is not
|
||||
supported.
|
||||
"""
|
||||
reader = self.reader('test-manifest-dupes')
|
||||
|
||||
with self.assertRaisesRegexp(SandboxValidationError, 'bar.js appears multiple times '
|
||||
'in a test manifest under a support-files field, please omit the duplicate entry.'):
|
||||
self.read_topsrcdir(reader)
|
||||
|
||||
def test_test_manifest_absolute_support_files(self):
|
||||
"""Support files starting with '/' are placed relative to the install root"""
|
||||
reader = self.reader('test-manifest-absolute-support')
|
||||
|
@ -298,6 +298,7 @@ def all_test_flavors():
|
||||
|
||||
class TestInstallInfo(object):
|
||||
def __init__(self):
|
||||
self.seen = set()
|
||||
self.pattern_installs = []
|
||||
self.installs = []
|
||||
self.external_installs = set()
|
||||
@ -337,15 +338,26 @@ class SupportFilesConverter(object):
|
||||
# test, based on the relative path to the manifest in the srcdir,
|
||||
# the install_root, and 'install-to-subdir', if present in the manifest.
|
||||
info = TestInstallInfo()
|
||||
for thing, seen in self._fields:
|
||||
value = test.get(thing, '')
|
||||
# We need to memoize on the basis of both the path and the output
|
||||
# directory for the benefit of tests specifying 'install-to-subdir'.
|
||||
if (value, out_dir) in seen:
|
||||
continue
|
||||
seen.add((value, out_dir))
|
||||
for field, seen in self._fields:
|
||||
value = test.get(field, '')
|
||||
for pattern in value.split():
|
||||
if thing == 'generated-files':
|
||||
|
||||
# We track uniqueness locally (per test) where duplicates are forbidden,
|
||||
# and globally, where they are permitted. If a support file appears multiple
|
||||
# times for a single test, there are unnecessary entries in the manifest. But
|
||||
# many entries will be shared across tests that share defaults.
|
||||
# We need to memoize on the basis of both the path and the output
|
||||
# directory for the benefit of tests specifying 'install-to-subdir'.
|
||||
key = field, pattern, out_dir
|
||||
if key in info.seen:
|
||||
raise ValueError("%s appears multiple times in a test manifest under a %s field,"
|
||||
" please omit the duplicate entry." % (pattern, field))
|
||||
info.seen.add(key)
|
||||
if key in seen:
|
||||
continue
|
||||
seen.add(key)
|
||||
|
||||
if field == 'generated-files':
|
||||
info.external_installs.add(mozpath.normpath(mozpath.join(out_dir, pattern)))
|
||||
# '!' indicates our syntax for inter-directory support file
|
||||
# dependencies. These receive special handling in the backend.
|
||||
@ -353,7 +365,7 @@ class SupportFilesConverter(object):
|
||||
info.deferred_installs.add(pattern)
|
||||
# We only support globbing on support-files because
|
||||
# the harness doesn't support * for head and tail.
|
||||
elif '*' in pattern and thing == 'support-files':
|
||||
elif '*' in pattern and field == 'support-files':
|
||||
info.pattern_installs.append((manifest_dir, pattern, out_dir))
|
||||
# "absolute" paths identify files that are to be
|
||||
# placed in the install_root directory (no globs)
|
||||
@ -375,7 +387,7 @@ class SupportFilesConverter(object):
|
||||
# with custom prefixes impossible. If this is
|
||||
# needed, we can add support for that via a
|
||||
# special syntax later.
|
||||
if thing == 'support-files':
|
||||
if field == 'support-files':
|
||||
dest_path = mozpath.join(out_dir,
|
||||
os.path.basename(pattern))
|
||||
# If it's not a support file, we ignore it.
|
||||
|
@ -112,8 +112,14 @@ def read_ini(fp, variables=None, default='DEFAULT', defaults_only=False,
|
||||
# interpret the variables
|
||||
def interpret_variables(global_dict, local_dict):
|
||||
variables = global_dict.copy()
|
||||
if 'skip-if' in local_dict and 'skip-if' in variables:
|
||||
local_dict['skip-if'] = "(%s) || (%s)" % (variables['skip-if'].split('#')[0], local_dict['skip-if'].split('#')[0])
|
||||
|
||||
# These variables are combinable when they appear both in default
|
||||
# and per-entry.
|
||||
for field_name, pattern in (('skip-if', '(%s) || (%s)'),
|
||||
('support-files', '%s %s')):
|
||||
local_value, global_value = local_dict.get(field_name), variables.get(field_name)
|
||||
if local_value and global_value:
|
||||
local_dict[field_name] = pattern % (global_value.split('#')[0], local_value.split('#')[0])
|
||||
variables.update(local_dict)
|
||||
|
||||
return variables
|
||||
|
@ -0,0 +1,9 @@
|
||||
[DEFAULT]
|
||||
support-files = foo.js # a comment
|
||||
|
||||
[test1]
|
||||
[test2]
|
||||
support-files = bar.js # another comment
|
||||
[test3]
|
||||
foo = bar
|
||||
|
@ -11,7 +11,7 @@ from manifestparser import ManifestParser
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
class TestDefaultSkipif(unittest.TestCase):
|
||||
"""test applying a skip-if condition in [DEFAULT] and || with the value for the test"""
|
||||
"""Tests applying a skip-if condition in [DEFAULT] and || with the value for the test"""
|
||||
|
||||
|
||||
def test_defaults(self):
|
||||
@ -32,5 +32,22 @@ class TestDefaultSkipif(unittest.TestCase):
|
||||
elif test['name'] == 'test6':
|
||||
self.assertEqual(test['skip-if'], "(os == 'win' && debug ) || (debug )")
|
||||
|
||||
class TestDefaultSupportFiles(unittest.TestCase):
|
||||
"""Tests combining support-files field in [DEFAULT] with the value for a test"""
|
||||
|
||||
def test_defaults(self):
|
||||
|
||||
default = os.path.join(here, 'default-suppfiles.ini')
|
||||
parser = ManifestParser(manifests=(default,))
|
||||
expected_supp_files = {
|
||||
'test1': 'foo.js # a comment',
|
||||
'test2': 'foo.js bar.js ',
|
||||
'test3': 'foo.js # a comment',
|
||||
}
|
||||
for test in parser.tests:
|
||||
expected = expected_supp_files[test['name']]
|
||||
self.assertEqual(test['support-files'], expected)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
x
Reference in New Issue
Block a user