mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
oe-selftest: add RECIPE_UPDATE_EXTRA_TASKS test
Add test_devtool_upgrade_recipe_update_extra_tasks test case to test upgrade of python3-guessing-game from v0.1.0 to v0.2.0 which will exercise the update_crates task during the upgrade. Add python3-guessing-game_git.bb.upgraded and python3-guessing-game-crates.inc.upgraded which are the 0.2.0 variants. Check that the new recipe file has the expected differences. Check that the new -crates.inc file has the expected differences, which should be reproducible because of Cargo.lock. (From OE-Core rev: d14368bc775cbf5142c1312dfc2076e328381aef) Signed-off-by: Tim Orling <tim.orling@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
1ba3586bbe
commit
c16d3b930f
@@ -2017,6 +2017,52 @@ class DevtoolUpgradeTests(DevtoolBase):
|
||||
newlines = f.readlines()
|
||||
self.assertEqual(desiredlines, newlines)
|
||||
|
||||
def test_devtool_upgrade_recipe_update_extra_tasks(self):
|
||||
# Check preconditions
|
||||
self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
|
||||
self.track_for_cleanup(self.workspacedir)
|
||||
self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
|
||||
recipe = 'python3-guessing-game'
|
||||
version = '0.2.0'
|
||||
commit = '40cf004c2772ffa20ea803fa3be1528a75be3e98'
|
||||
oldrecipefile = get_bb_var('FILE', recipe)
|
||||
oldcratesincfile = os.path.join(os.path.dirname(oldrecipefile), os.path.basename(oldrecipefile).strip('_git.bb') + '-crates.inc')
|
||||
tempdir = tempfile.mkdtemp(prefix='devtoolqa')
|
||||
self.track_for_cleanup(tempdir)
|
||||
# Check that recipe is not already under devtool control
|
||||
result = runCmd('devtool status')
|
||||
self.assertNotIn(recipe, result.output)
|
||||
# Check upgrade
|
||||
result = runCmd('devtool upgrade %s %s --version %s --srcrev %s' % (recipe, tempdir, version, commit))
|
||||
# Check if srctree at least is populated
|
||||
self.assertTrue(len(os.listdir(tempdir)) > 0, 'srctree (%s) should be populated with new (%s) source code' % (tempdir, commit))
|
||||
# Check new recipe file and new -crates.inc files are present
|
||||
newrecipefile = os.path.join(self.workspacedir, 'recipes', recipe, os.path.basename(oldrecipefile))
|
||||
newcratesincfile = os.path.join(self.workspacedir, 'recipes', recipe, os.path.basename(oldcratesincfile))
|
||||
self.assertExists(newrecipefile, 'Recipe file should exist after upgrade')
|
||||
self.assertExists(newcratesincfile, 'Recipe crates.inc file should exist after upgrade')
|
||||
# Check devtool status and make sure recipe is present
|
||||
result = runCmd('devtool status')
|
||||
self.assertIn(recipe, result.output)
|
||||
self.assertIn(tempdir, result.output)
|
||||
# Check recipe got changed as expected
|
||||
with open(oldrecipefile + '.upgraded', 'r') as f:
|
||||
desiredlines = f.readlines()
|
||||
with open(newrecipefile, 'r') as f:
|
||||
newlines = f.readlines()
|
||||
self.assertEqual(desiredlines, newlines)
|
||||
# Check crates.inc got changed as expected
|
||||
with open(oldcratesincfile + '.upgraded', 'r') as f:
|
||||
desiredlines = f.readlines()
|
||||
with open(newcratesincfile, 'r') as f:
|
||||
newlines = f.readlines()
|
||||
self.assertEqual(desiredlines, newlines)
|
||||
# Check devtool reset recipe
|
||||
result = runCmd('devtool reset %s -n' % recipe)
|
||||
result = runCmd('devtool status')
|
||||
self.assertNotIn(recipe, result.output)
|
||||
self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after resetting')
|
||||
|
||||
def test_devtool_layer_plugins(self):
|
||||
"""Test that devtool can use plugins from other layers.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user