@@ -132,6 +132,7 @@ class Metadata(Base):
@classmethod
def setUpClassLocal(cls):
cls.tinfoil = cls.setup_tinfoil()
+ cls.recipe_data = {}
# get info about added/modified/remove recipes
cls.added, cls.modified, cls.removed = cls.get_metadata_stats(cls.patchset)
@@ -140,6 +141,13 @@ class Metadata(Base):
def tearDownClassLocal(cls):
cls.tinfoil.shutdown()
+ @classmethod
+ def parse_recipe(cls, pn):
+ """Parse a recipe, reusing the result for every test that needs it"""
+ if pn not in cls.recipe_data:
+ cls.recipe_data[pn] = cls.tinfoil.parse_recipe(pn)
+ return cls.recipe_data[pn]
+
@classmethod
def setup_tinfoil(cls, config_only=False):
"""Initialize tinfoil api from bitbake"""
@@ -32,7 +32,7 @@ class TestMetadata(base.Metadata):
no_license = False
for pn in self.added:
- rd = self.tinfoil.parse_recipe(pn)
+ rd = self.parse_recipe(pn)
license = rd.getVar(patchtest_patterns.metadata_lic)
if license == patchtest_patterns.invalid_license:
no_license = True
@@ -56,7 +56,7 @@ class TestMetadata(base.Metadata):
self.skip('No added recipes, skipping test')
for pn in self.added:
- rd = self.tinfoil.parse_recipe(pn)
+ rd = self.parse_recipe(pn)
pathname = rd.getVar('FILE')
# we are not interested in images
if '/images/' in pathname:
@@ -111,7 +111,7 @@ class TestMetadata(base.Metadata):
for pn in self.modified:
if 'core-image' in pn:
continue
- rd = self.tinfoil.parse_recipe(pn)
+ rd = self.parse_recipe(pn)
PatchTestDataStore[
"%s-%s-%s" % (key_prefix, patchtest_patterns.metadata_src_uri, pn)
] = rd.getVar(patchtest_patterns.metadata_src_uri)
@@ -168,7 +168,7 @@ class TestMetadata(base.Metadata):
# we are not interested in images
if 'core-image' in pn:
continue
- rd = self.tinfoil.parse_recipe(pn)
+ rd = self.parse_recipe(pn)
summary = rd.getVar(patchtest_patterns.metadata_summary)
# "${PN} version ${PN}-${PR}" is the default, so fail if default
@@ -190,7 +190,7 @@ class TestMetadata(base.Metadata):
# we are not interested in images
if 'core-image' in pn:
continue
- rd = self.tinfoil.parse_recipe(pn)
+ rd = self.parse_recipe(pn)
cve_check_ignore = rd.getVar(patchtest_patterns.cve_check_ignore_var)
if cve_check_ignore is not None: