Bug 1583353 - [mozbuild.reader] Don't return root moz.build twice in 'all_mozbuild_paths', r=froydnj

Despite what the comment says, the finder *does* pick up the root moz.build. So
we end up processing it twice. This was never caught before because we only ever
used this function to read Sphinx related variables, of which the root moz.build
contains none.

Differential Revision: https://phabricator.services.mozilla.com/D51832

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Halberstadt 2019-11-05 15:38:32 +00:00
Родитель 548d1181f8
Коммит 48615d1c1b
2 изменённых файлов: 8 добавлений и 3 удалений

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

@ -901,9 +901,6 @@ class BuildReader(object):
# In the future, we may traverse moz.build files by looking
# for DIRS references in the AST, even if a directory is added behind
# a conditional. For now, just walk the filesystem.
# The root doesn't get picked up by FileFinder.
yield 'moz.build'
for path, f in self._relevant_mozbuild_finder.find('**/moz.build'):
yield path

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

@ -345,6 +345,14 @@ class TestBuildReader(unittest.TestCase):
self.assertEqual([ctx.relsrcdir for ctx in paths['d2/file']],
['', 'd2'])
def test_all_mozbuild_paths(self):
reader = self.reader('reader-relevant-mozbuild')
paths = list(reader.all_mozbuild_paths())
# Ensure no duplicate paths.
self.assertEqual(sorted(paths), sorted(set(paths)))
self.assertEqual(len(paths), 10)
def test_files_bad_bug_component(self):
reader = self.reader('files-info')