diff mbox series

[2/2] oeqa/selftest/sdk: add install tests for all SDK_ARCHIVE_TYPE variants

Message ID 20261202224846.576290-2-ross.burton@arm.com
State New
Headers show
Series [1/2] populate_sdk_base: fix typo in error message | expand

Commit Message

Ross Burton Dec. 2, 2026, 10:48 p.m. UTC
Add tests to verify that the SDK installs correctly with each of the
archive types. The test is minimal: success is defined as the SDK
installing and an environment script being present.

The 7zip type has to be conditional on meta-oe being present, as 7zip is
in that layer.

Also check that the required host tools are present, so hosts with a
minimal set of tools don't fail.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oeqa/selftest/cases/sdk.py | 43 ++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/sdk.py b/meta/lib/oeqa/selftest/cases/sdk.py
index ee1e4ca4200..cb31d8ec365 100644
--- a/meta/lib/oeqa/selftest/cases/sdk.py
+++ b/meta/lib/oeqa/selftest/cases/sdk.py
@@ -13,7 +13,7 @@  import select
 from tempfile import TemporaryDirectory
 
 from oeqa.selftest.case import OESelftestTestCase
-from oeqa.utils.commands import bitbake, get_bb_vars
+from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars
 
 class SDKTests(OESelftestTestCase):
 
@@ -123,3 +123,44 @@  IMAGE_INSTALL:append = " selftest-hello"
             self.logger.debug(f"runqemu works in SDK: {runqemu_works}\n{output}")
 
             self.assertTrue(runqemu_works, f"runqemu does not work in SDK\n{output}")
+
+class SDKInstallTests(OESelftestTestCase):
+
+    def do_install_with_compression(self, compression):
+        image = "core-image-minimal"
+
+        self.write_config(f"""
+SDK_ARCHIVE_TYPE = "{compression}"
+""")
+        bitbake(f"{image} -c populate_sdk")
+
+        with TemporaryDirectory() as tmpdir:
+            vars = get_bb_vars(["SDK_DEPLOY", "TOOLCHAIN_OUTPUTNAME"], image)
+            sdk_installer = os.path.join(vars["SDK_DEPLOY"], vars["TOOLCHAIN_OUTPUTNAME"] + ".sh")
+            # Install the SDK
+            subprocess.check_call([sdk_installer, "-y", "-d", tmpdir])
+            # Verify that at least environment scripts were created
+            environment_scripts = glob.glob(os.path.join(tmpdir, "environment-setup-*"))
+            self.assertTrue(environment_scripts)
+
+    def test_sdk_install_7z(self):
+        if "openembedded-layer" not in get_bb_var('BBFILE_COLLECTIONS').split():
+            self.skipTest("Test needs meta-oe for 7zip")
+        if not shutil.which("7z"):
+            self.skipTest("Test needs 7z on the host")
+        self.do_install_with_compression("7z")
+
+    def test_sdk_install_tar_xz(self):
+        if not shutil.which("xz"):
+            self.skipTest("Test needs xz on the host")
+        self.do_install_with_compression("tar.xz")
+
+    def test_sdk_install_tar_zst(self):
+        if not shutil.which("zstd"):
+            self.skipTest("Test needs zstd on the host")
+        self.do_install_with_compression("tar.zst")
+
+    def test_sdk_install_zip(self):
+        if not shutil.which("unzip"):
+            self.skipTest("Test needs unzip on the host")
+        self.do_install_with_compression("zip")