From: Jamin Lin <jamin_lin@aspeedtech.com>
To: "openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>,
"alex.kanavin@gmail.com" <alex.kanavin@gmail.com>,
"paul@pbarker.dev" <paul@pbarker.dev>
Cc: Troy Lee <troy_lee@aspeedtech.com>, Jamin Lin <jamin_lin@aspeedtech.com>
Subject: [PATCH v3 5/5] oeqa/selftest/devtool: Add test for multiple nested git destsuffix repos
Date: Thu, 23 Jul 2026 08:11:25 +0000 [thread overview]
Message-ID: <20260723081118.1558249-6-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20260723081118.1558249-1-jamin_lin@aspeedtech.com>
Add test_devtool_modify_multi_git_destsuffix_standalone to verify that
devtool modify converts all nested git repos (from multiple SRC_URI git
entries with different destsuffix values, including a repo nested inside
another repo's own working tree) to standalone clones so the workspace
survives 'bitbake -c cleanall'.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
meta/lib/oeqa/selftest/cases/devtool.py | 64 +++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index a10eb0c784..de73a2e620 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -1265,6 +1265,70 @@ class DevtoolModifyTests(DevtoolBase):
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')
+ def test_devtool_modify_multi_git_destsuffix_standalone(self):
+ """
+ Verify that devtool modify converts all nested git repos (from multiple
+ SRC_URI git entries with different destsuffix values) to standalone clones
+ so that 'bitbake -c cleanall' does not break the devtool workspace.
+
+ The recipe (devtool-test-multi-destsuffix) has three git SRC_URI entries
+ with S = ${UNPACKDIR}, each nested inside the previous repo's own
+ working tree:
+ destsuffix=level1 -> srcdir/level1/
+ destsuffix=level1/level2 -> srcdir/level1/level2/
+ destsuffix=level1/level2/level3 -> srcdir/level1/level2/level3/
+
+ This mirrors real-world recipes that embed multiple module repos
+ as nested subdirectories of the primary source tree, including the
+ case where one repo's checkout lives inside another repo's working
+ tree rather than merely under a shared plain directory.
+ """
+ testrecipe = 'devtool-test-multi-destsuffix'
+ src_uri = get_bb_var('SRC_URI', testrecipe)
+ self.assertIn('git://', src_uri,
+ 'This test expects %s to have git SRC_URI entries' % testrecipe)
+ self.track_for_cleanup(self.workspacedir)
+ self.add_command_to_tearDown('devtool reset %s' % testrecipe)
+ self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+ result = runCmd('devtool modify %s' % testrecipe)
+ self.assertEqual(result.status, 0,
+ 'devtool modify failed: %s' % result.output)
+ srcdir = os.path.join(self.workspacedir, 'sources', testrecipe)
+ nested_paths = [
+ ('level1', 'level1'),
+ ('level2', 'level1/level2'),
+ ('level3', 'level1/level2/level3'),
+ ]
+
+ for name, subpath in nested_paths:
+ repo_path = os.path.join(srcdir, subpath)
+ self.assertExists(os.path.join(repo_path, '.git'),
+ 'Repo %s (.git) not found in devtool workspace' % name)
+
+ # Key assertion: no nested repo should retain a git alternates file.
+ # devtool modify must repack objects locally so the workspace does not
+ # depend on the downloads cache, which 'bitbake -c cleanall' will delete.
+ for name, subpath in nested_paths:
+ repo_path = os.path.join(srcdir, subpath)
+ alternates_file = os.path.join(repo_path, '.git', 'objects',
+ 'info', 'alternates')
+ self.assertNotExists(alternates_file,
+ 'Repo %s still has a git alternates file after '
+ 'devtool modify' % name)
+
+ # Verify the workspace survives cleanall, which removes the shared
+ # objects in the downloads cache that alternates would reference.
+ bitbake('%s -c cleanall' % testrecipe)
+
+ # After cleanall all repos must still be usable.
+ # A broken alternates file would cause git operations to fail.
+ for name, subpath in nested_paths:
+ repo_path = os.path.join(srcdir, subpath)
+ result = runCmd('git status', cwd=repo_path)
+ self.assertEqual(result.status, 0,
+ 'git status failed in repo %s after cleanall: %s'
+ % (name, result.output))
+
class DevtoolUpdateTests(DevtoolBase):
def test_devtool_update_recipe(self):
--
2.43.0
prev parent reply other threads:[~2026-07-23 8:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 8:11 [PATCH v3 0/5] devtool: fix standalone clone conversion for nested git repos Jamin Lin
2026-07-23 8:11 ` [PATCH v3 1/5] devtool: Detect nested git repos before the initial workspace commit Jamin Lin
2026-07-23 8:11 ` [PATCH v3 2/5] oe/patch: Skip commitIgnored when nothing is actually staged Jamin Lin
2026-07-23 8:11 ` [PATCH v3 3/5] devtool-source: Convert nested git SRC_URI destsuffix repos to standalone clones Jamin Lin
2026-07-23 8:11 ` [PATCH v3 4/5] meta-selftest: Add devtool-test-multi-destsuffix recipe Jamin Lin
2026-07-23 8:11 ` Jamin Lin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260723081118.1558249-6-jamin_lin@aspeedtech.com \
--to=jamin_lin@aspeedtech.com \
--cc=alex.kanavin@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=paul@pbarker.dev \
--cc=troy_lee@aspeedtech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox