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>,
Vince Chang <vince_chang@aspeedtech.com>
Subject: [PATCH v2 3/3] oeqa/selftest/devtool: Add test for multiple nested git destsuffix repos
Date: Fri, 22 May 2026 07:59:29 +0000 [thread overview]
Message-ID: <20260522075925.2381158-4-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20260522075925.2381158-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) 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 | 67 +++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 5ed69aee1b..b927bbf8f0 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -1182,6 +1182,73 @@ 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 six git SRC_URI entries
+ with S = ${UNPACKDIR}. All repos are nested inside S:
+ destsuffix=level1_a -> srcdir/level1_a/
+ destsuffix=level1_b -> srcdir/level1_b/
+ destsuffix=level1/level2_a -> srcdir/level1/level2_a/
+ destsuffix=level1/level2_b -> srcdir/level1/level2_b/
+ destsuffix=level1/level2/level3_a -> srcdir/level1/level2/level3_a/
+ destsuffix=level1/level2/level3_b -> srcdir/level1/level2/level3_b/
+
+ This mirrors real-world recipes that embed multiple module repos
+ as nested subdirectories of the primary source tree.
+ """
+ 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_a', 'level1_a'),
+ ('level1_b', 'level1_b'),
+ ('level2_a', 'level1/level2_a'),
+ ('level2_b', 'level1/level2_b'),
+ ('level3_a', 'level1/level2/level3_a'),
+ ('level3_b', 'level1/level2/level3_b'),
+ ]
+
+ 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-05-22 7:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 7:59 [PATCH v2 0/3] devtool: fix standalone clone conversion for nested git repos Jamin Lin
2026-05-22 7:59 ` [PATCH v2 1/3] scripts/scriptutils: Convert nested git repos to standalone clones in devtool workspace Jamin Lin
2026-05-22 10:41 ` Paul Barker
2026-05-22 7:59 ` [PATCH v2 2/3] meta-selftest: Add devtool-test-multi-destsuffix recipe Jamin Lin
2026-05-22 10:44 ` Paul Barker
2026-05-22 7:59 ` 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=20260522075925.2381158-4-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 \
--cc=vince_chang@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