]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/sdk: add some buildtools tests
authorRoss Burton <ross@burtonini.com>
Mon, 9 Aug 2021 13:49:33 +0000 (14:49 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 12 Aug 2021 05:26:10 +0000 (06:26 +0100)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/sdk/buildtools-cases/README [new file with mode: 0644]
meta/lib/oeqa/sdk/buildtools-cases/build.py [new file with mode: 0644]
meta/lib/oeqa/sdk/buildtools-cases/sanity.py [new file with mode: 0644]

diff --git a/meta/lib/oeqa/sdk/buildtools-cases/README b/meta/lib/oeqa/sdk/buildtools-cases/README
new file mode 100644 (file)
index 0000000..d4f20fa
--- /dev/null
@@ -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 (file)
index 0000000..5a17ab9
--- /dev/null
@@ -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 (file)
index 0000000..64baaa8
--- /dev/null
@@ -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)