Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH v2] oeqa/selftest/devtool: add test for modifying recipes using go.bbclass
@ 2024-05-17  8:54 olani
  2024-05-17  8:56 ` Ola x Nilsson
  0 siblings, 1 reply; 2+ messages in thread
From: olani @ 2024-05-17  8:54 UTC (permalink / raw)
  To: openembedded-core; +Cc: olani

From: Ola x Nilsson <olani@axis.com>

go.bbclass uses a special do_unpack function that causes the git root
to be different from S.  Verify that it unpacks as expected.

[ YOCTO #15483 ]

Signed-off-by: Ola x Nilsson <olani@axis.com>
---

Changes since v1:
  Correct author

 meta/lib/oeqa/selftest/cases/devtool.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 882225dde3..fc08906117 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -753,6 +753,25 @@ class DevtoolModifyTests(DevtoolBase):
         result = runCmd('devtool status')
         self.assertNotIn('mdadm', result.output)
 
+    def test_devtool_modify_go(self):
+        import oe.path
+        from tempfile import TemporaryDirectory
+        with TemporaryDirectory(prefix='devtoolqa') as tempdir:
+            self.track_for_cleanup(self.workspacedir)
+            self.add_command_to_tearDown('bitbake -c clean go-helloworld')
+            self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+            result = runCmd('devtool modify go-helloworld -x %s' % tempdir)
+            self.assertExists(
+                oe.path.join(tempdir, 'src', 'golang.org', 'x', 'example', 'go.mod'),
+                             'Extracted source could not be found'
+            )
+            self.assertExists(
+                oe.path.join(self.workspacedir, 'conf', 'layer.conf'),
+                'Workspace directory not created'
+            )
+            matches = glob.glob(oe.path.join(self.workspacedir, 'appends', 'go-helloworld_*.bbappend'))
+            self.assertTrue(matches, 'bbappend not created %s' % result.output)
+
     def test_devtool_buildclean(self):
         def assertFile(path, *paths):
             f = os.path.join(path, *paths)
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] oeqa/selftest/devtool: add test for modifying recipes using go.bbclass
  2024-05-17  8:54 [PATCH v2] oeqa/selftest/devtool: add test for modifying recipes using go.bbclass olani
@ 2024-05-17  8:56 ` Ola x Nilsson
  0 siblings, 0 replies; 2+ messages in thread
From: Ola x Nilsson @ 2024-05-17  8:56 UTC (permalink / raw)
  To: olani; +Cc: openembedded-core

On Fri, May 17 2024, olani@axis.com wrote:

> From: Ola x Nilsson <olani@axis.com>
>
> go.bbclass uses a special do_unpack function that causes the git root
> to be different from S.  Verify that it unpacks as expected.
>
> [ YOCTO #15483 ]
>
> Signed-off-by: Ola x Nilsson <olani@axis.com>
> ---
>
> Changes since v1:
>   Correct author
>
>  meta/lib/oeqa/selftest/cases/devtool.py | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
> index 882225dde3..fc08906117 100644
> --- a/meta/lib/oeqa/selftest/cases/devtool.py
> +++ b/meta/lib/oeqa/selftest/cases/devtool.py
> @@ -753,6 +753,25 @@ class DevtoolModifyTests(DevtoolBase):
>          result = runCmd('devtool status')
>          self.assertNotIn('mdadm', result.output)
>  
> +    def test_devtool_modify_go(self):
> +        import oe.path
> +        from tempfile import TemporaryDirectory
> +        with TemporaryDirectory(prefix='devtoolqa') as tempdir:
> +            self.track_for_cleanup(self.workspacedir)
> +            self.add_command_to_tearDown('bitbake -c clean go-helloworld')
> +            self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
> +            result = runCmd('devtool modify go-helloworld -x %s' % tempdir)
> +            self.assertExists(
> +                oe.path.join(tempdir, 'src', 'golang.org', 'x', 'example', 'go.mod'),
> +                             'Extracted source could not be found'
> +            )
> +            self.assertExists(
> +                oe.path.join(self.workspacedir, 'conf', 'layer.conf'),
> +                'Workspace directory not created'
> +            )
> +            matches = glob.glob(oe.path.join(self.workspacedir, 'appends', 'go-helloworld_*.bbappend'))
> +            self.assertTrue(matches, 'bbappend not created %s' % result.output)
> +
>      def test_devtool_buildclean(self):
>          def assertFile(path, *paths):
>              f = os.path.join(path, *paths)

I realize that this test doesn't really solve the problem of "papering
over" the problem in devtool modify, but I hope it at least protects
against some breakage.

/Ola


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-17  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-17  8:54 [PATCH v2] oeqa/selftest/devtool: add test for modifying recipes using go.bbclass olani
2024-05-17  8:56 ` Ola x Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox