diff options
| author | Tobias Pistora <pistora.tobias@gmail.com> | 2025-08-13 11:20:42 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-08-14 10:31:10 +0100 |
| commit | 921faf324658371193b1f0847ebc1912d7fef25d (patch) | |
| tree | d74696244e096e3fd38c61107dc64bc2694b3faf | |
| parent | 4c7b0007327d592b8f5d1f50ebb0325dc483bd87 (diff) | |
| download | poky-921faf324658371193b1f0847ebc1912d7fef25d.tar.gz | |
selftest/devtool: add devtool upgrade selftest for recipes with git submodules
Tests [YOCTO #15943]
Move code from test_devtool_upgrade_git() into separate, local function.
Add a test_devtool_upgrade_gitsm() selftest for devtool.
Add recipes for testing gitsm components.
(From OE-Core rev: c996801af3a22f50955ed4e47220461d6d243a3b)
Signed-off-by: Tobias Pistora <pistora.tobias@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
3 files changed, 70 insertions, 3 deletions
diff --git a/meta-selftest/recipes-test/devtool/devtool-upgrade-test5_git.bb b/meta-selftest/recipes-test/devtool/devtool-upgrade-test5_git.bb new file mode 100644 index 0000000000..7e8b001a28 --- /dev/null +++ b/meta-selftest/recipes-test/devtool/devtool-upgrade-test5_git.bb | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | SUMMARY = "Test recipe for fetching git submodules" | ||
| 2 | HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/git-submodule-test/" | ||
| 3 | LICENSE = "MIT" | ||
| 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
| 5 | |||
| 6 | INHIBIT_DEFAULT_DEPS = "1" | ||
| 7 | |||
| 8 | # Note: this is intentionally not the latest version in the original .bb | ||
| 9 | SRCREV = "132fea6e4dee56b61bcf5721c94e8b2445c6a017" | ||
| 10 | PV = "0.1+git" | ||
| 11 | PR = "r2" | ||
| 12 | |||
| 13 | SRC_URI = "gitsm://git.yoctoproject.org/git-submodule-test;branch=master" | ||
| 14 | UPSTREAM_CHECK_COMMITS = "1" | ||
| 15 | RECIPE_NO_UPDATE_REASON = "This recipe is used to test devtool upgrade feature" | ||
| 16 | |||
| 17 | EXCLUDE_FROM_WORLD = "1" | ||
| 18 | |||
| 19 | do_test_git_as_user() { | ||
| 20 | cd ${S} | ||
| 21 | git status | ||
| 22 | git submodule status | ||
| 23 | } | ||
| 24 | addtask test_git_as_user after do_unpack | ||
| 25 | |||
| 26 | fakeroot do_test_git_as_root() { | ||
| 27 | cd ${S} | ||
| 28 | git status | ||
| 29 | git submodule status | ||
| 30 | } | ||
| 31 | do_test_git_as_root[depends] += "virtual/fakeroot-native:do_populate_sysroot" | ||
| 32 | addtask test_git_as_root after do_unpack \ No newline at end of file | ||
diff --git a/meta-selftest/recipes-test/devtool/devtool-upgrade-test5_git.bb.upgraded b/meta-selftest/recipes-test/devtool/devtool-upgrade-test5_git.bb.upgraded new file mode 100644 index 0000000000..938c46b016 --- /dev/null +++ b/meta-selftest/recipes-test/devtool/devtool-upgrade-test5_git.bb.upgraded | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | SUMMARY = "Test recipe for fetching git submodules" | ||
| 2 | HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/git-submodule-test/" | ||
| 3 | LICENSE = "MIT" | ||
| 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
| 5 | |||
| 6 | INHIBIT_DEFAULT_DEPS = "1" | ||
| 7 | |||
| 8 | # Note: this is intentionally not the latest version in the original .bb | ||
| 9 | SRCREV = "a2885dd7d25380d23627e7544b7bbb55014b16ee" | ||
| 10 | PV = "0.1+git" | ||
| 11 | |||
| 12 | SRC_URI = "gitsm://git.yoctoproject.org/git-submodule-test;branch=master" | ||
| 13 | UPSTREAM_CHECK_COMMITS = "1" | ||
| 14 | RECIPE_NO_UPDATE_REASON = "This recipe is used to test devtool upgrade feature" | ||
| 15 | |||
| 16 | EXCLUDE_FROM_WORLD = "1" | ||
| 17 | |||
| 18 | do_test_git_as_user() { | ||
| 19 | cd ${S} | ||
| 20 | git status | ||
| 21 | git submodule status | ||
| 22 | } | ||
| 23 | addtask test_git_as_user after do_unpack | ||
| 24 | |||
| 25 | fakeroot do_test_git_as_root() { | ||
| 26 | cd ${S} | ||
| 27 | git status | ||
| 28 | git submodule status | ||
| 29 | } | ||
| 30 | do_test_git_as_root[depends] += "virtual/fakeroot-native:do_populate_sysroot" | ||
| 31 | addtask test_git_as_root after do_unpack \ No newline at end of file | ||
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 580c567be3..19a205912b 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
| @@ -1958,13 +1958,11 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
| 1958 | self.assertNotIn(recipe, result.output) | 1958 | self.assertNotIn(recipe, result.output) |
| 1959 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after resetting') | 1959 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after resetting') |
| 1960 | 1960 | ||
| 1961 | def test_devtool_upgrade_git(self): | 1961 | def _test_devtool_upgrade_git_by_recipe(self, recipe, commit): |
| 1962 | # Check preconditions | 1962 | # Check preconditions |
| 1963 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') | 1963 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') |
| 1964 | self.track_for_cleanup(self.workspacedir) | 1964 | self.track_for_cleanup(self.workspacedir) |
| 1965 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 1965 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
| 1966 | recipe = 'devtool-upgrade-test2' | ||
| 1967 | commit = '6cc6077a36fe2648a5f993fe7c16c9632f946517' | ||
| 1968 | oldrecipefile = get_bb_var('FILE', recipe) | 1966 | oldrecipefile = get_bb_var('FILE', recipe) |
| 1969 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 1967 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
| 1970 | self.track_for_cleanup(tempdir) | 1968 | self.track_for_cleanup(tempdir) |
| @@ -1994,6 +1992,12 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
| 1994 | self.assertNotIn(recipe, result.output) | 1992 | self.assertNotIn(recipe, result.output) |
| 1995 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after resetting') | 1993 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after resetting') |
| 1996 | 1994 | ||
| 1995 | def test_devtool_upgrade_git(self): | ||
| 1996 | self._test_devtool_upgrade_git_by_recipe('devtool-upgrade-test2', '6cc6077a36fe2648a5f993fe7c16c9632f946517') | ||
| 1997 | |||
| 1998 | def test_devtool_upgrade_gitsm(self): | ||
| 1999 | self._test_devtool_upgrade_git_by_recipe('devtool-upgrade-test5', 'a2885dd7d25380d23627e7544b7bbb55014b16ee') | ||
| 2000 | |||
| 1997 | def test_devtool_upgrade_drop_md5sum(self): | 2001 | def test_devtool_upgrade_drop_md5sum(self): |
| 1998 | # Check preconditions | 2002 | # Check preconditions |
| 1999 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') | 2003 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') |
