]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/selftest/devtool: add devtool modify testcase for nested gitsm
authorClement Faure <clement.faure@arm.com>
Thu, 12 Feb 2026 10:38:03 +0000 (11:38 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 16 Feb 2026 18:05:10 +0000 (18:05 +0000)
Add a selftest that exercises devtool modify against git repositories
that contain nested git repositories with submodules.

Signed-off-by: Clement Faure <clement.faure@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta-selftest/recipes-test/devtool/devtool-test-git-gitsm_git.bb [new file with mode: 0644]
meta/lib/oeqa/selftest/cases/devtool.py

diff --git a/meta-selftest/recipes-test/devtool/devtool-test-git-gitsm_git.bb b/meta-selftest/recipes-test/devtool/devtool-test-git-gitsm_git.bb
new file mode 100644 (file)
index 0000000..ad50c7f
--- /dev/null
@@ -0,0 +1,10 @@
+SUMMARY = "Test recipe for fetching git submodules as second repo"
+HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/git-submodule-test/"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+SRC_URI = "git://git.yoctoproject.org/git-submodule-test;branch=master;name=repo-git \
+    gitsm://git.yoctoproject.org/git-submodule-test;branch=master;name=repo-gitsm;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/nested/repo-gitsm"
+SRCREV_repo-git = "a2885dd7d25380d23627e7544b7bbb55014b16ee"
+SRCREV_repo-gitsm = "a2885dd7d25380d23627e7544b7bbb55014b16ee"
+SRCREV_FORMAT = "repo-git_repo-gitsm"
index 0ff8e563360ea63cfd93abd57dc7698bcda87a48..b977443545c2dbd06787d44be1a0ccfcc0eed410 100644 (file)
@@ -1156,6 +1156,31 @@ class DevtoolModifyTests(DevtoolBase):
         result = bitbake(testrecipe)
         self.assertEqual(result.status, 0, "Bitbake failed, exit code %s, output %s" % (result.status, result.output))
 
+    def test_devtool_modify_nested_gitsm(self):
+        """Checks that a recipe with multiple sources including a git repo with a nested git repo with
+        submodules can be used with devtool modify
+        """
+        testrecipe = 'devtool-test-git-gitsm'
+        src_uri = get_bb_var('SRC_URI', testrecipe)
+        self.assertIn('git://', src_uri, 'This test expects the %s recipe to fetch a git source' % testrecipe)
+        self.assertIn('gitsm://', src_uri, 'This test expects the %s recipe to fetch a gitsm source' % testrecipe)
+        # Try modifying a recipe
+        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        self.track_for_cleanup(tempdir)
+        self.track_for_cleanup(self.workspacedir)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+        result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir))
+        self.assertEqual(result.status, 0, "Could not modify recipe %s. Output: %s" % (testrecipe, result.output))
+        # Test devtool status
+        result = runCmd('devtool status')
+        self.assertIn(testrecipe, result.output)
+        self.assertIn(tempdir, result.output)
+        # Submodules in repo-gitsm should be extracted
+        source_repo_gitsm_gitmodules = os.path.join(tempdir, 'nested/repo-gitsm')
+        self.assertExists(source_repo_gitsm_gitmodules, 'Nested repo repo-gitsm not found')
+        self.assertExists(os.path.join(source_repo_gitsm_gitmodules, 'bitbake'), 'Submodule not found')
+        self.assertExists(os.path.join(source_repo_gitsm_gitmodules, 'bitbake-gitsm-test1'), 'Submodule not found')
+
 class DevtoolUpdateTests(DevtoolBase):
 
     def test_devtool_update_recipe(self):