oeqa/selftest/devtool: add test for updating local files into another layer

We don't have a test to check if we can correctly devtool update-recipe/finish
into another layer. So update the existing test_devtool_update_recipe_local_files
to also check the updates into another layer.

(From OE-Core rev: bd44c895d36e246a25c7a6e40bf9f4089dc7a297)

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>
This commit is contained in:
Julien Stephan 2024-04-15 21:20:10 +02:00 committed by Richard Purdie
parent 28516320d8
commit aace45f9b8

View File

@ -1405,14 +1405,30 @@ class DevtoolUpdateTests(DevtoolBase):
runCmd('echo "Bar" > new-file', cwd=tempdir)
runCmd('git add new-file', cwd=tempdir)
runCmd('git commit -m "Add new file"', cwd=tempdir)
self.add_command_to_tearDown('cd %s; git clean -fd .; git checkout .' %
os.path.dirname(recipefile))
runCmd('devtool update-recipe %s' % testrecipe)
expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)),
(' M', '.*/makedevs/makedevs.c$'),
('??', '.*/makedevs/new-local$'),
('??', '.*/makedevs/0001-Add-new-file.patch$')]
self._check_repo_status(os.path.dirname(recipefile), expected_status)
# Now try to update recipe in another layer, so first, clean it
runCmd('cd %s; git clean -fd .; git checkout .' % os.path.dirname(recipefile))
# Create a temporary layer and add it to bblayers.conf
self._create_temp_layer(templayerdir, True, 'templayer')
# Update recipe in templayer
result = runCmd('devtool update-recipe %s -a %s' % (testrecipe, templayerdir))
self.assertNotIn('WARNING:', result.output)
# Check recipe is still clean
self._check_repo_status(os.path.dirname(recipefile), [])
splitpath = os.path.dirname(recipefile).split(os.sep)
appenddir = os.path.join(templayerdir, splitpath[-2], splitpath[-1])
bbappendfile = self._check_bbappend(testrecipe, recipefile, appenddir)
patchfile = os.path.join(appenddir, testrecipe, '0001-Add-new-file.patch')
new_local_file = os.path.join(appenddir, testrecipe, 'new_local')
local_file = os.path.join(appenddir, testrecipe, 'makedevs.c')
self.assertExists(patchfile, 'Patch file 0001-Add-new-file.patch not created')
self.assertExists(local_file, 'File makedevs.c not created')
self.assertExists(patchfile, 'File new_local not created')
def test_devtool_update_recipe_local_files_2(self):
"""Check local source files support when oe-local-files is in Git"""