All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] buildtools-tarball: add testsdk task
@ 2021-07-21 13:54 Ross Burton
  2021-07-21 13:54 ` [PATCH 2/2] oeqa/sdk: add some buildtools tests Ross Burton
  2021-07-22  6:50 ` [OE-core] [PATCH 1/2] buildtools-tarball: add testsdk task Richard Purdie
  0 siblings, 2 replies; 4+ messages in thread
From: Ross Burton @ 2021-07-21 13:54 UTC (permalink / raw)
  To: openembedded-core

Add a testsdk task, which is essentially the same as testsdk.bbclass but
the test case directory is changed.  This lets us exercise the
buildtools tarballs at build time.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-core/meta/buildtools-tarball.bb | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb
index b5dae176bf..67a6d81ddd 100644
--- a/meta/recipes-core/meta/buildtools-tarball.bb
+++ b/meta/recipes-core/meta/buildtools-tarball.bb
@@ -99,3 +99,14 @@ TOOLCHAIN_NEED_CONFIGSITE_CACHE = ""
 
 # The recipe doesn't need any default deps
 INHIBIT_DEFAULT_DEPS = "1"
+
+python do_testsdk() {
+    import oeqa.sdk.testsdk
+    testsdk = oeqa.sdk.testsdk.TestSDK()
+    os.path.join(os.path.abspath(os.path.dirname(oeqa.sdk.testsdk.__file__)), "buildtools-cases")
+    testsdk.context_executor_class.default_cases = "/home/ross/Yocto/poky/meta/lib/oeqa/sdk/buildtools-cases"
+    testsdk.run(d)
+}
+addtask testsdk
+do_testsdk[nostamp] = "1"
+do_testsdk[depends] += "xz-native:do_populate_sysroot"
-- 
2.25.1


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

* [PATCH 2/2] oeqa/sdk: add some buildtools tests
  2021-07-21 13:54 [PATCH 1/2] buildtools-tarball: add testsdk task Ross Burton
@ 2021-07-21 13:54 ` Ross Burton
  2021-07-22  6:50 ` [OE-core] [PATCH 1/2] buildtools-tarball: add testsdk task Richard Purdie
  1 sibling, 0 replies; 4+ messages in thread
From: Ross Burton @ 2021-07-21 13:54 UTC (permalink / raw)
  To: openembedded-core

These two tests are designed to exercise the buildtools-tarball.

SanityTests simply verifies that inside the SDK, some commands are used
from the SDK.

BuildTests creates a new OE build directory and builds virtual/libc to
verify that a basic build works correctly. DL_DIR is reused to avoid
needless downloading, but sstate is not shared to ensure a build does
happen.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oeqa/sdk/buildtools-cases/README    |  2 ++
 meta/lib/oeqa/sdk/buildtools-cases/build.py  | 23 ++++++++++++++++++++
 meta/lib/oeqa/sdk/buildtools-cases/sanity.py | 22 +++++++++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 meta/lib/oeqa/sdk/buildtools-cases/README
 create mode 100644 meta/lib/oeqa/sdk/buildtools-cases/build.py
 create mode 100644 meta/lib/oeqa/sdk/buildtools-cases/sanity.py

diff --git a/meta/lib/oeqa/sdk/buildtools-cases/README b/meta/lib/oeqa/sdk/buildtools-cases/README
new file mode 100644
index 0000000000..d4f20faa9f
--- /dev/null
+++ b/meta/lib/oeqa/sdk/buildtools-cases/README
@@ -0,0 +1,2 @@
+These test cases are used by buildtools-tarball, and are not used by the testsdk
+class.
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/build.py b/meta/lib/oeqa/sdk/buildtools-cases/build.py
new file mode 100644
index 0000000000..5a17ab98c6
--- /dev/null
+++ b/meta/lib/oeqa/sdk/buildtools-cases/build.py
@@ -0,0 +1,23 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+import os, tempfile
+from oeqa.sdk.case import OESDKTestCase
+from oeqa.utils.subprocesstweak import errors_have_output
+errors_have_output()
+
+class BuildTests(OESDKTestCase):
+    """
+    Verify that bitbake can build virtual/libc inside the buildtools.
+    """
+    def test_libc(self):
+        with tempfile.TemporaryDirectory(prefix='bitbake-build-', dir=self.tc.sdk_dir) as testdir:
+            corebase = self.td['COREBASE']
+
+            self._run('. %s/oe-init-build-env %s' % (corebase, testdir))
+            with open(os.path.join(testdir, 'conf', 'local.conf'), 'ta') as conf:
+                conf.write('\n')
+                conf.write('DL_DIR = "%s"\n' % self.td['DL_DIR'])
+
+            self._run('. %s/oe-init-build-env %s && bitbake virtual/libc' % (corebase, testdir))
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/sanity.py b/meta/lib/oeqa/sdk/buildtools-cases/sanity.py
new file mode 100644
index 0000000000..64baaa8f84
--- /dev/null
+++ b/meta/lib/oeqa/sdk/buildtools-cases/sanity.py
@@ -0,0 +1,22 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+import shutil
+import os.path
+from oeqa.sdk.case import OESDKTestCase
+
+class SanityTests(OESDKTestCase):
+    def test_tools(self):
+        """
+        Test that wget and tar come from the buildtools, not the host. This
+        verifies that the buildtools have installed correctly. We can't check
+        for gcc as that is only installed by buildtools-extended.
+        """
+        for command in ("tar", "wget"):
+            # Canonicalise the SDK root
+            sdk_base = os.path.realpath(self.tc.sdk_dir)
+            # Canonicalise the location of this command
+            tool_path = os.path.realpath(self._run("command -v %s" % command).strip())
+            # Assert that the tool was found inside the SDK root
+            self.assertEquals(os.path.commonprefix((sdk_base, tool_path)), sdk_base)
-- 
2.25.1


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

* Re: [OE-core] [PATCH 1/2] buildtools-tarball: add testsdk task
  2021-07-21 13:54 [PATCH 1/2] buildtools-tarball: add testsdk task Ross Burton
  2021-07-21 13:54 ` [PATCH 2/2] oeqa/sdk: add some buildtools tests Ross Burton
@ 2021-07-22  6:50 ` Richard Purdie
  2021-08-09 11:53   ` Ross Burton
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2021-07-22  6:50 UTC (permalink / raw)
  To: Ross Burton, openembedded-core

On Wed, 2021-07-21 at 14:54 +0100, Ross Burton wrote:
> Add a testsdk task, which is essentially the same as testsdk.bbclass but
> the test case directory is changed.  This lets us exercise the
> buildtools tarballs at build time.
> 
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  meta/recipes-core/meta/buildtools-tarball.bb | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb
> index b5dae176bf..67a6d81ddd 100644
> --- a/meta/recipes-core/meta/buildtools-tarball.bb
> +++ b/meta/recipes-core/meta/buildtools-tarball.bb
> @@ -99,3 +99,14 @@ TOOLCHAIN_NEED_CONFIGSITE_CACHE = ""
>  
> 
>  # The recipe doesn't need any default deps
>  INHIBIT_DEFAULT_DEPS = "1"
> +
> +python do_testsdk() {
> +    import oeqa.sdk.testsdk
> +    testsdk = oeqa.sdk.testsdk.TestSDK()
> +    os.path.join(os.path.abspath(os.path.dirname(oeqa.sdk.testsdk.__file__)), "buildtools-cases")
> +    testsdk.context_executor_class.default_cases = "/home/ross/Yocto/poky/meta/lib/oeqa/sdk/buildtools-cases"

This looks like a good idea, I'm happy to see it but I think the line above may 
need a small tweak! :)

Cheers,

Richard


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

* Re: [OE-core] [PATCH 1/2] buildtools-tarball: add testsdk task
  2021-07-22  6:50 ` [OE-core] [PATCH 1/2] buildtools-tarball: add testsdk task Richard Purdie
@ 2021-08-09 11:53   ` Ross Burton
  0 siblings, 0 replies; 4+ messages in thread
From: Ross Burton @ 2021-08-09 11:53 UTC (permalink / raw)
  To: Richard Purdie; +Cc: OE-core

Yeah not sure how that happened!

V2 incoming :)

On Thu, 22 Jul 2021 at 07:50, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Wed, 2021-07-21 at 14:54 +0100, Ross Burton wrote:
> > Add a testsdk task, which is essentially the same as testsdk.bbclass but
> > the test case directory is changed.  This lets us exercise the
> > buildtools tarballs at build time.
> >
> > Signed-off-by: Ross Burton <ross.burton@arm.com>
> > ---
> >  meta/recipes-core/meta/buildtools-tarball.bb | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb
> > index b5dae176bf..67a6d81ddd 100644
> > --- a/meta/recipes-core/meta/buildtools-tarball.bb
> > +++ b/meta/recipes-core/meta/buildtools-tarball.bb
> > @@ -99,3 +99,14 @@ TOOLCHAIN_NEED_CONFIGSITE_CACHE = ""
> >
> >
> >  # The recipe doesn't need any default deps
> >  INHIBIT_DEFAULT_DEPS = "1"
> > +
> > +python do_testsdk() {
> > +    import oeqa.sdk.testsdk
> > +    testsdk = oeqa.sdk.testsdk.TestSDK()
> > +    os.path.join(os.path.abspath(os.path.dirname(oeqa.sdk.testsdk.__file__)), "buildtools-cases")
> > +    testsdk.context_executor_class.default_cases = "/home/ross/Yocto/poky/meta/lib/oeqa/sdk/buildtools-cases"
>
> This looks like a good idea, I'm happy to see it but I think the line above may
> need a small tweak! :)
>
> Cheers,
>
> Richard
>

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

end of thread, other threads:[~2021-08-09 11:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 13:54 [PATCH 1/2] buildtools-tarball: add testsdk task Ross Burton
2021-07-21 13:54 ` [PATCH 2/2] oeqa/sdk: add some buildtools tests Ross Burton
2021-07-22  6:50 ` [OE-core] [PATCH 1/2] buildtools-tarball: add testsdk task Richard Purdie
2021-08-09 11:53   ` Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.