Bug 1161270 - Add source manifest to reftest manifest representation in moz.build.;r=gps,roc

This commit is contained in:
Chris Manchester 2015-05-11 16:35:39 -07:00
parent eb2e96572d
commit 54783a4a8b
6 changed files with 30 additions and 6 deletions

View File

@ -45,15 +45,16 @@ class ReftestManifest(object):
self.dirs = set() self.dirs = set()
self.files = set() self.files = set()
self.manifests = set() self.manifests = set()
self.tests = set()
def load(self, path): def load(self, path):
"""Parse a reftest manifest file.""" """Parse a reftest manifest file."""
normalized = os.path.normpath(os.path.abspath(path)) normalized_path = os.path.normpath(os.path.abspath(path))
self.manifests.add(normalized) self.manifests.add(normalized_path)
if not self.path: if not self.path:
self.path = normalized self.path = normalized_path
mdir = os.path.dirname(normalized) mdir = os.path.dirname(normalized_path)
self.dirs.add(mdir) self.dirs.add(mdir)
with open(path, 'r') as fh: with open(path, 'r') as fh:
@ -123,3 +124,4 @@ class ReftestManifest(object):
test = os.path.normpath(os.path.join(mdir, urlprefix + f)) test = os.path.normpath(os.path.join(mdir, urlprefix + f))
self.files.add(test) self.files.add(test)
self.dirs.add(os.path.dirname(test)) self.dirs.add(os.path.dirname(test))
self.tests.add((test, normalized_path))

View File

@ -1130,11 +1130,11 @@ class TreeMetadataEmitter(LoggingMixin):
relpath=mozpath.join(manifest_reldir, relpath=mozpath.join(manifest_reldir,
mozpath.basename(manifest_path))) mozpath.basename(manifest_path)))
for test in sorted(manifest.files): for test, source_manifest in sorted(manifest.tests):
obj.tests.append({ obj.tests.append({
'path': test, 'path': test,
'here': mozpath.dirname(test), 'here': mozpath.dirname(test),
'manifest': manifest_full_path, 'manifest': source_manifest,
'name': mozpath.basename(test), 'name': mozpath.basename(test),
'head': '', 'head': '',
'tail': '', 'tail': '',

View File

@ -0,0 +1 @@
!= reftest2.html reftest2-ref.html

View File

@ -0,0 +1 @@
REFTEST_MANIFESTS += ['reftest.list']

View File

@ -0,0 +1,2 @@
== reftest1.html reftest1-ref.html
include included-reftest.list

View File

@ -468,6 +468,24 @@ class TestEmitterBasic(unittest.TestCase):
paths = sorted([v[0] for v in o.installs.values()]) paths = sorted([v[0] for v in o.installs.values()])
self.assertEqual(paths, expected) self.assertEqual(paths, expected)
def test_test_manifest_includes(self):
"""Ensure that manifest objects from the emitter list a correct manifest.
"""
reader = self.reader('test-manifest-emitted-includes')
[obj] = self.read_topsrcdir(reader)
# Expected manifest leafs for our tests.
expected_manifests = {
'reftest1.html': 'reftest.list',
'reftest1-ref.html': 'reftest.list',
'reftest2.html': 'included-reftest.list',
'reftest2-ref.html': 'included-reftest.list',
}
for t in obj.tests:
self.assertTrue(t['manifest'].endswith(expected_manifests[t['name']]))
def test_test_manifest_keys_extracted(self): def test_test_manifest_keys_extracted(self):
"""Ensure all metadata from test manifests is extracted.""" """Ensure all metadata from test manifests is extracted."""
reader = self.reader('test-manifest-keys-extracted') reader = self.reader('test-manifest-keys-extracted')