summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/recipetool.py
diff options
context:
space:
mode:
authorJulien Stephan <jstephan@baylibre.com>2023-12-05 15:56:36 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-06 22:55:50 +0000
commitec340f14dae730cce94bdc10198eaf5d3e4dcd2b (patch)
treee06526f03be1774a661c846099e346ddcaa2397a /meta/lib/oeqa/selftest/cases/recipetool.py
parent7ff486d556e691f06590d5047c0d0080c9049d52 (diff)
downloadpoky-ec340f14dae730cce94bdc10198eaf5d3e4dcd2b.tar.gz
oeqa/selftest/recipetool: appendsrc: add test for update mode
add a basic test for testing the update mode of recipetool appendsrcfile(s) (From OE-Core rev: f999092c772f10d23106c355e2787259befb6e30) Signed-off-by: Julien Stephan <jstephan@baylibre.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/recipetool.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/recipetool.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index a55d7dea15..bfe06eb4a5 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -1247,6 +1247,34 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase):
1247 # A more complex test: existing entry in src_uri with different param 1247 # A more complex test: existing entry in src_uri with different param
1248 self.test_recipetool_appendsrcfile_existing_in_src_uri_diff_params(machine='mymachine') 1248 self.test_recipetool_appendsrcfile_existing_in_src_uri_diff_params(machine='mymachine')
1249 1249
1250 def test_recipetool_appendsrcfile_update_recipe_basic(self):
1251 testrecipe = "base-files"
1252 recipefile = get_bb_var('FILE', testrecipe)
1253 result = runCmd('bitbake-layers show-layers')
1254 layerrecipe = None
1255 for line in result.output.splitlines()[3:]:
1256 with open("/tmp/juju.txt", "a") as file:
1257 layer = line.split()[1]
1258 print(layer, file=file)
1259 if layer in recipefile:
1260 layerrecipe = layer
1261 break
1262 self.assertTrue(layerrecipe, 'Unable to find the layer containing %s' % testrecipe)
1263 cmd = 'recipetool appendsrcfile -u %s %s %s' % (layerrecipe, testrecipe, self.testfile)
1264 result = runCmd(cmd)
1265 self.assertNotIn('Traceback', result.output)
1266 self.add_command_to_tearDown('cd %s; rm -f %s/%s; git checkout .' % (os.path.dirname(recipefile), testrecipe, os.path.basename(self.testfile)))
1267
1268 expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)),
1269 ('??', '.*/%s/%s/%s$' % (testrecipe, testrecipe, os.path.basename(self.testfile)))]
1270 self._check_repo_status(os.path.dirname(recipefile), expected_status)
1271 result = runCmd('git diff %s' % os.path.basename(recipefile), cwd=os.path.dirname(recipefile))
1272 removelines = []
1273 addlines = [
1274 'file://%s \\\\' % os.path.basename(self.testfile),
1275 ]
1276 self._check_diff(result.output, addlines, removelines)
1277
1250 def test_recipetool_appendsrcfile_replace_file_srcdir(self): 1278 def test_recipetool_appendsrcfile_replace_file_srcdir(self):
1251 testrecipe = 'bash' 1279 testrecipe = 'bash'
1252 filepath = 'Makefile.in' 1280 filepath = 'Makefile.in'