diff mbox series

oeqa/selftest/devtool: add unit test for "devtool add -b"

Message ID 20230628070939.1298739-1-yoann.congal@smile.fr
State New
Headers show
Series oeqa/selftest/devtool: add unit test for "devtool add -b" | expand

Commit Message

Yoann Congal June 28, 2023, 7:09 a.m. UTC
From: Fawzi KHABER <fawzi.khaber@smile.fr>

Fix [Yocto #15085]

Signed-off-by: Fawzi KHABER <fawzi.khaber@smile.fr>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Richard Purdie June 28, 2023, 7:47 p.m. UTC | #1
On Wed, 2023-06-28 at 09:09 +0200, Yoann Congal wrote:
> From: Fawzi KHABER <fawzi.khaber@smile.fr>
> 
> Fix [Yocto #15085]
> 
> Signed-off-by: Fawzi KHABER <fawzi.khaber@smile.fr>
> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> ---
>  meta/lib/oeqa/selftest/cases/devtool.py | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
> index 4c8e375d00..c5ed8f5720 100644
> --- a/meta/lib/oeqa/selftest/cases/devtool.py
> +++ b/meta/lib/oeqa/selftest/cases/devtool.py
> @@ -366,6 +366,29 @@ class DevtoolAddTests(DevtoolBase):
>              bindir = bindir[1:]
>          self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D')
>  
> +    def test_devtool_add_binary(self):
> +        # Test "devtool add -b" with an arbitrary binary package from Yocto mirrors
> +        pn = 'pvr-bin-cdv-devel'
> +        pv = '1.0.3-1.1'
> +        url = 'http://downloads.yoctoproject.org/mirror/sources/pvr-bin-cdv-devel-1.0.3-1.1.i586.rpm'
> +
> +        self.track_for_cleanup(self.workspacedir)
> +        self.add_command_to_tearDown('bitbake -c cleansstate %s' % pn)
> +        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
> +
> +        # Test devtool add -b
> +        result = runCmd('devtool add  -b %s %s' % (pn, url))
> +        self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created')
> +
> +        # Test devtool build
> +        result = runCmd('devtool build %s' % pn)
> +        bb_vars = get_bb_vars(['D', 'bindir'], pn)
> +        installdir = bb_vars['D']
> +        self.assertTrue(installdir, 'Could not query installdir variable')
> +
> +        # Check that a known file from the binary package has indeed been installed
> +        self.assertTrue(os.path.isfile(os.path.join(installdir, 'usr', 'include', 'EGL', 'egl.h')), 'egl.h not found in D')
> +
>      def test_devtool_add_git_local(self):
>          # We need dbus built so that DEPENDS recognition works
>          bitbake('dbus')


https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/5437/steps/14/logs/stdio

There are systems where rpm doesn't exist so the test can fail?

Cheers,

Richard
Yoann Congal June 29, 2023, 8:18 a.m. UTC | #2
Le mer. 28 juin 2023 à 21:47, Richard Purdie
<richard.purdie@linuxfoundation.org> a écrit :
>
> On Wed, 2023-06-28 at 09:09 +0200, Yoann Congal wrote:
> > From: Fawzi KHABER <fawzi.khaber@smile.fr>
> >
> > Fix [Yocto #15085]
> >
> > Signed-off-by: Fawzi KHABER <fawzi.khaber@smile.fr>
> > Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> > ---
> >  meta/lib/oeqa/selftest/cases/devtool.py | 23 +++++++++++++++++++++++
> >  1 file changed, 23 insertions(+)
> >
> > diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
> > index 4c8e375d00..c5ed8f5720 100644
> > --- a/meta/lib/oeqa/selftest/cases/devtool.py
> > +++ b/meta/lib/oeqa/selftest/cases/devtool.py
> > @@ -366,6 +366,29 @@ class DevtoolAddTests(DevtoolBase):
> >              bindir = bindir[1:]
> >          self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D')
> >
> > +    def test_devtool_add_binary(self):
> > +        # Test "devtool add -b" with an arbitrary binary package from Yocto mirrors
> > +        pn = 'pvr-bin-cdv-devel'
> > +        pv = '1.0.3-1.1'
> > +        url = 'http://downloads.yoctoproject.org/mirror/sources/pvr-bin-cdv-devel-1.0.3-1.1.i586.rpm'
> > +
> > +        self.track_for_cleanup(self.workspacedir)
> > +        self.add_command_to_tearDown('bitbake -c cleansstate %s' % pn)
> > +        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
> > +
> > +        # Test devtool add -b
> > +        result = runCmd('devtool add  -b %s %s' % (pn, url))
> > +        self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created')
> > +
> > +        # Test devtool build
> > +        result = runCmd('devtool build %s' % pn)
> > +        bb_vars = get_bb_vars(['D', 'bindir'], pn)
> > +        installdir = bb_vars['D']
> > +        self.assertTrue(installdir, 'Could not query installdir variable')
> > +
> > +        # Check that a known file from the binary package has indeed been installed
> > +        self.assertTrue(os.path.isfile(os.path.join(installdir, 'usr', 'include', 'EGL', 'egl.h')), 'egl.h not found in D')
> > +
> >      def test_devtool_add_git_local(self):
> >          # We need dbus built so that DEPENDS recognition works
> >          bitbake('dbus')
>
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/5437/steps/14/logs/stdio
>
> There are systems where rpm doesn't exist so the test can fail?

Yeah you are right !
I need to find a binary package available from yocto mirrors that can
be extracted with HOSTTOOLS.
If I can't find this, I'll build the binary package directly in the test.

I will send a v2.

Regards,
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 4c8e375d00..c5ed8f5720 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -366,6 +366,29 @@  class DevtoolAddTests(DevtoolBase):
             bindir = bindir[1:]
         self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D')
 
+    def test_devtool_add_binary(self):
+        # Test "devtool add -b" with an arbitrary binary package from Yocto mirrors
+        pn = 'pvr-bin-cdv-devel'
+        pv = '1.0.3-1.1'
+        url = 'http://downloads.yoctoproject.org/mirror/sources/pvr-bin-cdv-devel-1.0.3-1.1.i586.rpm'
+
+        self.track_for_cleanup(self.workspacedir)
+        self.add_command_to_tearDown('bitbake -c cleansstate %s' % pn)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+
+        # Test devtool add -b
+        result = runCmd('devtool add  -b %s %s' % (pn, url))
+        self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created')
+
+        # Test devtool build
+        result = runCmd('devtool build %s' % pn)
+        bb_vars = get_bb_vars(['D', 'bindir'], pn)
+        installdir = bb_vars['D']
+        self.assertTrue(installdir, 'Could not query installdir variable')
+
+        # Check that a known file from the binary package has indeed been installed
+        self.assertTrue(os.path.isfile(os.path.join(installdir, 'usr', 'include', 'EGL', 'egl.h')), 'egl.h not found in D')
+
     def test_devtool_add_git_local(self):
         # We need dbus built so that DEPENDS recognition works
         bitbake('dbus')