summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2023-11-21 02:37:04 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-23 12:46:42 +0000
commit541868630f0beae4644046393ffc4c394292fdd5 (patch)
treed598888791cc872a83aa8a2f0ceb7633ee7ef22d
parentb6906962b7767a189886365fdfd241f090ecbeb0 (diff)
downloadpoky-541868630f0beae4644046393ffc4c394292fdd5.tar.gz
oeqa/selftest/tinfoil: Add tests that parse virtual recipes
Running `devtool search gcc` would result in errors for virtual recipes. The reason was the newly introduced :layer-<layername> override. When tinfoil parsed the recipes using the parseRecipeFile() function, it failed to properly identify the layername for virtual recipes, which resulted in the errors. Add tests that exercise these code paths through parseRecipeFile(). (From OE-Core rev: cf7f34f93f9f90279412ea57d6d5930854d411ba) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/tinfoil.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/tinfoil.py b/meta/lib/oeqa/selftest/cases/tinfoil.py
index dd13c20402..21c8686b2a 100644
--- a/meta/lib/oeqa/selftest/cases/tinfoil.py
+++ b/meta/lib/oeqa/selftest/cases/tinfoil.py
@@ -48,6 +48,17 @@ class TinfoilTests(OESelftestTestCase):
48 rd = tinfoil.parse_recipe_file(best[3]) 48 rd = tinfoil.parse_recipe_file(best[3])
49 self.assertEqual(testrecipe, rd.getVar('PN')) 49 self.assertEqual(testrecipe, rd.getVar('PN'))
50 50
51 def test_parse_virtual_recipe(self):
52 with bb.tinfoil.Tinfoil() as tinfoil:
53 tinfoil.prepare(config_only=False, quiet=2)
54 testrecipe = 'nativesdk-gcc'
55 best = tinfoil.find_best_provider(testrecipe)
56 if not best:
57 self.fail('Unable to find recipe providing %s' % testrecipe)
58 rd = tinfoil.parse_recipe_file(best[3])
59 self.assertEqual(testrecipe, rd.getVar('PN'))
60 self.assertIsNotNone(rd.getVar('FILE_LAYERNAME'))
61
51 def test_parse_recipe_copy_expand(self): 62 def test_parse_recipe_copy_expand(self):
52 with bb.tinfoil.Tinfoil() as tinfoil: 63 with bb.tinfoil.Tinfoil() as tinfoil:
53 tinfoil.prepare(config_only=False, quiet=2) 64 tinfoil.prepare(config_only=False, quiet=2)
@@ -66,7 +77,7 @@ class TinfoilTests(OESelftestTestCase):
66 localdata.setVar('PN', 'hello') 77 localdata.setVar('PN', 'hello')
67 self.assertEqual('hello', localdata.getVar('BPN')) 78 self.assertEqual('hello', localdata.getVar('BPN'))
68 79
69 # The config_data API tp parse_recipe_file is used by: 80 # The config_data API to parse_recipe_file is used by:
70 # layerindex-web layerindex/update_layer.py 81 # layerindex-web layerindex/update_layer.py
71 def test_parse_recipe_custom_data(self): 82 def test_parse_recipe_custom_data(self):
72 with bb.tinfoil.Tinfoil() as tinfoil: 83 with bb.tinfoil.Tinfoil() as tinfoil:
@@ -80,6 +91,18 @@ class TinfoilTests(OESelftestTestCase):
80 rd = tinfoil.parse_recipe_file(best[3], config_data=localdata) 91 rd = tinfoil.parse_recipe_file(best[3], config_data=localdata)
81 self.assertEqual("testval", rd.getVar('TESTVAR')) 92 self.assertEqual("testval", rd.getVar('TESTVAR'))
82 93
94 def test_parse_virtual_recipe_custom_data(self):
95 with bb.tinfoil.Tinfoil() as tinfoil:
96 tinfoil.prepare(config_only=False, quiet=2)
97 localdata = bb.data.createCopy(tinfoil.config_data)
98 localdata.setVar("TESTVAR", "testval")
99 testrecipe = 'nativesdk-gcc'
100 best = tinfoil.find_best_provider(testrecipe)
101 if not best:
102 self.fail('Unable to find recipe providing %s' % testrecipe)
103 rd = tinfoil.parse_recipe_file(best[3], config_data=localdata)
104 self.assertEqual("testval", rd.getVar('TESTVAR'))
105
83 def test_list_recipes(self): 106 def test_list_recipes(self):
84 with bb.tinfoil.Tinfoil() as tinfoil: 107 with bb.tinfoil.Tinfoil() as tinfoil:
85 tinfoil.prepare(config_only=False, quiet=2) 108 tinfoil.prepare(config_only=False, quiet=2)