* [OE-core][PATCH] oeqa/selftest: add test case to cover 'devtool modify -n' for a git recipe
@ 2024-01-22 5:29 Qi.Chen
2024-01-26 14:54 ` Richard Purdie
0 siblings, 1 reply; 4+ messages in thread
From: Qi.Chen @ 2024-01-22 5:29 UTC (permalink / raw)
To: openembedded-core
From: Chen Qi <Qi.Chen@windriver.com>
Add a test case to ensure the following error does not happen again for
'devtool modify -n'.
Traceback (most recent call last):
File "/buildarea2/chenqi/poky/scripts/devtool", line 349, in <module>
ret = main()
File "/buildarea2/chenqi/poky/scripts/devtool", line 336, in main
ret = args.func(args, config, basepath, workspace)
File "/buildarea2/chenqi/poky/scripts/lib/devtool/standard.py", line 924, in modify
if not initial_revs["."]:
KeyError: '.'
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
meta/lib/oeqa/selftest/cases/devtool.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index a877720769..22ea0ecba9 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -917,6 +917,28 @@ class DevtoolModifyTests(DevtoolBase):
# Try building
bitbake(testrecipe)
+ def test_devtool_modify_git_no_extract(self):
+ # Check preconditions
+ testrecipe = 'psplash'
+ src_uri = get_bb_var('SRC_URI', testrecipe)
+ self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
+ # Clean up anything in the workdir/sysroot/sstate cache
+ bitbake('%s -c cleansstate' % 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 -c clean %s' % testrecipe)
+ self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+ result = runCmd('git clone https://git.yoctoproject.org/psplash %s && devtool modify -n %s %s' % (tempdir, testrecipe, tempdir))
+ self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created. devtool output: %s' % result.output)
+ matches = glob.glob(os.path.join(self.workspacedir, 'appends', 'psplash_*.bbappend'))
+ self.assertTrue(matches, 'bbappend not created')
+ # Test devtool status
+ result = runCmd('devtool status')
+ self.assertIn(testrecipe, result.output)
+ self.assertIn(tempdir, result.output)
+
def test_devtool_modify_git_crates_subpath(self):
# This tests two things in devtool context:
# - that we support local git dependencies for cargo based recipe
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [OE-core][PATCH] oeqa/selftest: add test case to cover 'devtool modify -n' for a git recipe
2024-01-22 5:29 [OE-core][PATCH] oeqa/selftest: add test case to cover 'devtool modify -n' for a git recipe Qi.Chen
@ 2024-01-26 14:54 ` Richard Purdie
2024-01-26 15:00 ` Alexander Kanavin
0 siblings, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2024-01-26 14:54 UTC (permalink / raw)
To: Qi.Chen, openembedded-core
On Mon, 2024-01-22 at 13:29 +0800, Chen Qi via lists.openembedded.org
wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> Add a test case to ensure the following error does not happen again for
> 'devtool modify -n'.
>
> Traceback (most recent call last):
> File "/buildarea2/chenqi/poky/scripts/devtool", line 349, in <module>
> ret = main()
> File "/buildarea2/chenqi/poky/scripts/devtool", line 336, in main
> ret = args.func(args, config, basepath, workspace)
> File "/buildarea2/chenqi/poky/scripts/lib/devtool/standard.py", line 924, in modify
> if not initial_revs["."]:
> KeyError: '.'
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
> meta/lib/oeqa/selftest/cases/devtool.py | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
> index a877720769..22ea0ecba9 100644
> --- a/meta/lib/oeqa/selftest/cases/devtool.py
> +++ b/meta/lib/oeqa/selftest/cases/devtool.py
> @@ -917,6 +917,28 @@ class DevtoolModifyTests(DevtoolBase):
> # Try building
> bitbake(testrecipe)
>
> + def test_devtool_modify_git_no_extract(self):
> + # Check preconditions
> + testrecipe = 'psplash'
> + src_uri = get_bb_var('SRC_URI', testrecipe)
> + self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
> + # Clean up anything in the workdir/sysroot/sstate cache
> + bitbake('%s -c cleansstate' % testrecipe)
I'm afraid we can't use cleansstate inside oe-selftest as it may race
against other copies of oe-selftest running against the same sstate
cache (or other builds using psplash in this case).
We'll need to find another way to make this work.
Cheers,
Richard
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [OE-core][PATCH] oeqa/selftest: add test case to cover 'devtool modify -n' for a git recipe
2024-01-26 14:54 ` Richard Purdie
@ 2024-01-26 15:00 ` Alexander Kanavin
2024-01-26 15:05 ` Richard Purdie
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Kanavin @ 2024-01-26 15:00 UTC (permalink / raw)
To: Richard Purdie; +Cc: Qi.Chen, openembedded-core
On Fri, 26 Jan 2024 at 15:54, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> > + def test_devtool_modify_git_no_extract(self):
> > + # Check preconditions
> > + testrecipe = 'psplash'
> > + src_uri = get_bb_var('SRC_URI', testrecipe)
> > + self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
> > + # Clean up anything in the workdir/sysroot/sstate cache
> > + bitbake('%s -c cleansstate' % testrecipe)
>
> I'm afraid we can't use cleansstate inside oe-selftest as it may race
> against other copies of oe-selftest running against the same sstate
> cache (or other builds using psplash in this case).
>
> We'll need to find another way to make this work.
There's a number of existing tests in
meta/lib/oeqa/selftest/cases/devtool.py which do rely on cleansstate;
I can only presume they do it with utmost care, and can be used as
examples for how things could be done.
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [OE-core][PATCH] oeqa/selftest: add test case to cover 'devtool modify -n' for a git recipe
2024-01-26 15:00 ` Alexander Kanavin
@ 2024-01-26 15:05 ` Richard Purdie
0 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2024-01-26 15:05 UTC (permalink / raw)
To: Alexander Kanavin; +Cc: Qi.Chen, openembedded-core
On Fri, 2024-01-26 at 16:00 +0100, Alexander Kanavin wrote:
> On Fri, 26 Jan 2024 at 15:54, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
>
> > > + def test_devtool_modify_git_no_extract(self):
> > > + # Check preconditions
> > > + testrecipe = 'psplash'
> > > + src_uri = get_bb_var('SRC_URI', testrecipe)
> > > + self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
> > > + # Clean up anything in the workdir/sysroot/sstate cache
> > > + bitbake('%s -c cleansstate' % testrecipe)
> >
> > I'm afraid we can't use cleansstate inside oe-selftest as it may race
> > against other copies of oe-selftest running against the same sstate
> > cache (or other builds using psplash in this case).
> >
> > We'll need to find another way to make this work.
>
> There's a number of existing tests in
> meta/lib/oeqa/selftest/cases/devtool.py which do rely on cleansstate;
> I can only presume they do it with utmost care, and can be used as
> examples for how things could be done.
Thanks for the reminder. devtool is "special" in that it does:
cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate
cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n' % cls.original_sstate)
in DevtoolBase which means it can call cleansstate.
I'll queue it for merge, thanks.
Cheers,
Richard
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-26 15:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-22 5:29 [OE-core][PATCH] oeqa/selftest: add test case to cover 'devtool modify -n' for a git recipe Qi.Chen
2024-01-26 14:54 ` Richard Purdie
2024-01-26 15:00 ` Alexander Kanavin
2024-01-26 15:05 ` Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox