diff options
author | Tim Orling <tim.orling@konsulko.com> | 2024-06-11 08:55:15 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-06-13 09:11:17 +0100 |
commit | c16d3b930fb46fc50eaef4d0cb16347ca9c4a1f8 (patch) | |
tree | 4c2c85f912ffe9ef977c778dbab82f8124ac4a4b /meta/lib/oeqa/selftest/cases/devtool.py | |
parent | 1ba3586bbe660600c48a2170cf615b9ccab749e2 (diff) | |
download | poky-c16d3b930fb46fc50eaef4d0cb16347ca9c4a1f8.tar.gz |
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>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/devtool.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 1cafb922ea..432d9c9a67 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -2017,6 +2017,52 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
2017 | newlines = f.readlines() | 2017 | newlines = f.readlines() |
2018 | self.assertEqual(desiredlines, newlines) | 2018 | self.assertEqual(desiredlines, newlines) |
2019 | 2019 | ||
2020 | def test_devtool_upgrade_recipe_update_extra_tasks(self): | ||
2021 | # Check preconditions | ||
2022 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
2023 | self.track_for_cleanup(self.workspacedir) | ||
2024 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
2025 | recipe = 'python3-guessing-game' | ||
2026 | version = '0.2.0' | ||
2027 | commit = '40cf004c2772ffa20ea803fa3be1528a75be3e98' | ||
2028 | oldrecipefile = get_bb_var('FILE', recipe) | ||
2029 | oldcratesincfile = os.path.join(os.path.dirname(oldrecipefile), os.path.basename(oldrecipefile).strip('_git.bb') + '-crates.inc') | ||
2030 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | ||
2031 | self.track_for_cleanup(tempdir) | ||
2032 | # Check that recipe is not already under devtool control | ||
2033 | result = runCmd('devtool status') | ||
2034 | self.assertNotIn(recipe, result.output) | ||
2035 | # Check upgrade | ||
2036 | result = runCmd('devtool upgrade %s %s --version %s --srcrev %s' % (recipe, tempdir, version, commit)) | ||
2037 | # Check if srctree at least is populated | ||
2038 | self.assertTrue(len(os.listdir(tempdir)) > 0, 'srctree (%s) should be populated with new (%s) source code' % (tempdir, commit)) | ||
2039 | # Check new recipe file and new -crates.inc files are present | ||
2040 | newrecipefile = os.path.join(self.workspacedir, 'recipes', recipe, os.path.basename(oldrecipefile)) | ||
2041 | newcratesincfile = os.path.join(self.workspacedir, 'recipes', recipe, os.path.basename(oldcratesincfile)) | ||
2042 | self.assertExists(newrecipefile, 'Recipe file should exist after upgrade') | ||
2043 | self.assertExists(newcratesincfile, 'Recipe crates.inc file should exist after upgrade') | ||
2044 | # Check devtool status and make sure recipe is present | ||
2045 | result = runCmd('devtool status') | ||
2046 | self.assertIn(recipe, result.output) | ||
2047 | self.assertIn(tempdir, result.output) | ||
2048 | # Check recipe got changed as expected | ||
2049 | with open(oldrecipefile + '.upgraded', 'r') as f: | ||
2050 | desiredlines = f.readlines() | ||
2051 | with open(newrecipefile, 'r') as f: | ||
2052 | newlines = f.readlines() | ||
2053 | self.assertEqual(desiredlines, newlines) | ||
2054 | # Check crates.inc got changed as expected | ||
2055 | with open(oldcratesincfile + '.upgraded', 'r') as f: | ||
2056 | desiredlines = f.readlines() | ||
2057 | with open(newcratesincfile, 'r') as f: | ||
2058 | newlines = f.readlines() | ||
2059 | self.assertEqual(desiredlines, newlines) | ||
2060 | # Check devtool reset recipe | ||
2061 | result = runCmd('devtool reset %s -n' % recipe) | ||
2062 | result = runCmd('devtool status') | ||
2063 | self.assertNotIn(recipe, result.output) | ||
2064 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after resetting') | ||
2065 | |||
2020 | def test_devtool_layer_plugins(self): | 2066 | def test_devtool_layer_plugins(self): |
2021 | """Test that devtool can use plugins from other layers. | 2067 | """Test that devtool can use plugins from other layers. |
2022 | 2068 | ||