diff mbox series

[09/23] oeqa/sdk: use ensure_*_package helpers

Message ID 20250510084400.269726-9-ross.burton@arm.com
State New
Headers show
Series [01/23] buildtools-tarball: fix default_cases assignment | expand

Commit Message

Ross Burton May 10, 2025, 8:43 a.m. UTC
Clean up lots of dependency checking code by using the new helpers.

This means that a lot of tests that were previously skipped inside the
eSDK testing on the autobuilder are now executed, and fail.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oeqa/sdk/cases/cmake.py   |  4 +---
 meta/lib/oeqa/sdk/cases/gtk3.py    |  8 ++------
 meta/lib/oeqa/sdk/cases/kmod.py    | 10 ++--------
 meta/lib/oeqa/sdk/cases/maturin.py | 13 +++----------
 meta/lib/oeqa/sdk/cases/meson.py   |  4 +---
 meta/lib/oeqa/sdk/cases/perl.py    |  5 +----
 meta/lib/oeqa/sdk/cases/python.py  |  5 +----
 7 files changed, 11 insertions(+), 38 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/sdk/cases/cmake.py b/meta/lib/oeqa/sdk/cases/cmake.py
index cb0944ee995..070682ef084 100644
--- a/meta/lib/oeqa/sdk/cases/cmake.py
+++ b/meta/lib/oeqa/sdk/cases/cmake.py
@@ -23,9 +23,7 @@  class CMakeTest(OESDKTestCase):
         if libc in [ 'newlib' ]:
             raise unittest.SkipTest("CMakeTest class: SDK doesn't contain a supported C library")
 
-        if not (self.tc.hasHostPackage("nativesdk-cmake") or
-                self.tc.hasHostPackage("cmake-native")):
-            raise unittest.SkipTest("CMakeTest: needs cmake")
+        self.ensure_host_package("cmake")
 
     def test_assimp(self):
         with tempfile.TemporaryDirectory(prefix="assimp", dir=self.tc.sdk_dir) as testdir:
diff --git a/meta/lib/oeqa/sdk/cases/gtk3.py b/meta/lib/oeqa/sdk/cases/gtk3.py
index 8f60d5e7da7..1d953eecf1d 100644
--- a/meta/lib/oeqa/sdk/cases/gtk3.py
+++ b/meta/lib/oeqa/sdk/cases/gtk3.py
@@ -22,12 +22,8 @@  class GTK3Test(OESDKTestCase):
         if libc in [ 'newlib' ]:
             raise unittest.SkipTest("GTK3Test class: SDK doesn't contain a supported C library")
 
-        if not (self.tc.hasTargetPackage("gtk+3", multilib=True) or \
-                self.tc.hasTargetPackage("libgtk-3.0", multilib=True)):
-            raise unittest.SkipTest("GalculatorTest class: SDK don't support gtk+3")
-        if not (self.tc.hasHostPackage("nativesdk-gettext-dev") or
-                self.tc.hasHostPackage("gettext-native")):
-            raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain gettext")
+        self.ensure_host_package(recipe="intltool")
+        self.ensure_target_package("gtk+3", "libgtk-3.0", recipe="gtk+3")
 
     def test_galculator(self):
         with tempfile.TemporaryDirectory(prefix="galculator", dir=self.tc.sdk_dir) as testdir:
diff --git a/meta/lib/oeqa/sdk/cases/kmod.py b/meta/lib/oeqa/sdk/cases/kmod.py
index 9e8fdbcd403..af9fcf5150d 100644
--- a/meta/lib/oeqa/sdk/cases/kmod.py
+++ b/meta/lib/oeqa/sdk/cases/kmod.py
@@ -7,7 +7,6 @@ 
 import os
 import subprocess
 import tempfile
-import unittest
 
 from oeqa.sdk.case import OESDKTestCase
 from oeqa.utils.subprocesstweak import errors_have_output
@@ -17,16 +16,11 @@  class KernelModuleTest(OESDKTestCase):
     """
     Test that out-of-tree kernel modules build.
     """
-
-    def setUp(self):
-        if not self.tc.hasTargetPackage("kernel-devsrc"):
-            raise unittest.SkipTest("KernelModuleTest needs kernel-devsrc")
-
+    def test_cryptodev(self):
+        self.ensure_target_package("kernel-devsrc")
         # These targets need to be built before kernel modules can be built.
         self._run("make -j -C $OECORE_TARGET_SYSROOT/usr/src/kernel prepare scripts")
 
-
-    def test_cryptodev(self):
         with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir:
             git_url = "https://github.com/cryptodev-linux/cryptodev-linux"
             # This is a knnown-good commit post-1.13 that builds with kernel 6.7+
diff --git a/meta/lib/oeqa/sdk/cases/maturin.py b/meta/lib/oeqa/sdk/cases/maturin.py
index 20f6b553d0b..42394c7a973 100644
--- a/meta/lib/oeqa/sdk/cases/maturin.py
+++ b/meta/lib/oeqa/sdk/cases/maturin.py
@@ -16,11 +16,7 @@  errors_have_output()
 
 class MaturinTest(OESDKTestCase):
     def setUp(self):
-        if not (
-            self.tc.hasHostPackage("nativesdk-python3-maturin")
-            or self.tc.hasHostPackage("python3-maturin-native")
-        ):
-            raise unittest.SkipTest("No python3-maturin package in the SDK")
+        self.ensure_host_package("python3-maturin")
 
     def test_maturin_list_python(self):
         py_major = self._run("python3 -c 'import sys; print(sys.version_info.major)'")
@@ -49,11 +45,8 @@  class MaturinDevelopTest(OESDKTestCase):
 
     def setUp(self):
         machine = self.td.get("MACHINE")
-        if not (
-            self.tc.hasHostPackage("nativesdk-python3-maturin")
-            or self.tc.hasHostPackage("python3-maturin-native")
-        ):
-            raise unittest.SkipTest("No python3-maturin package in the SDK")
+        self.ensure_host_package("python3-maturin")
+
         if not (
             self.tc.hasHostPackage("packagegroup-rust-cross-canadian-%s" % machine)
         ):
diff --git a/meta/lib/oeqa/sdk/cases/meson.py b/meta/lib/oeqa/sdk/cases/meson.py
index 1edf78720ac..6f773544e3d 100644
--- a/meta/lib/oeqa/sdk/cases/meson.py
+++ b/meta/lib/oeqa/sdk/cases/meson.py
@@ -22,9 +22,7 @@  class MesonTest(OESDKTestCase):
         if libc in [ 'newlib' ]:
             raise unittest.SkipTest("MesonTest class: SDK doesn't contain a supported C library")
 
-        if not (self.tc.hasHostPackage("nativesdk-meson") or
-                self.tc.hasHostPackage("meson-native")):
-            raise unittest.SkipTest("MesonTest: needs meson")
+        self.ensure_host_package("meson")
 
     def test_epoxy(self):
         with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir:
diff --git a/meta/lib/oeqa/sdk/cases/perl.py b/meta/lib/oeqa/sdk/cases/perl.py
index 8eab4442e85..a72bd2461a6 100644
--- a/meta/lib/oeqa/sdk/cases/perl.py
+++ b/meta/lib/oeqa/sdk/cases/perl.py
@@ -4,7 +4,6 @@ 
 # SPDX-License-Identifier: MIT
 #
 
-import unittest
 from oeqa.sdk.case import OESDKTestCase
 
 from oeqa.utils.subprocesstweak import errors_have_output
@@ -12,9 +11,7 @@  errors_have_output()
 
 class PerlTest(OESDKTestCase):
     def setUp(self):
-        if not (self.tc.hasHostPackage("nativesdk-perl") or
-                self.tc.hasHostPackage("perl-native")):
-            raise unittest.SkipTest("No perl package in the SDK")
+        self.ensure_host_package("perl")
 
     def test_perl(self):
         cmd = "perl -e '$_=\"Uryyb, jbeyq\"; tr/a-zA-Z/n-za-mN-ZA-M/;print'"
diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py
index 51284949f50..b990cd889ad 100644
--- a/meta/lib/oeqa/sdk/cases/python.py
+++ b/meta/lib/oeqa/sdk/cases/python.py
@@ -4,7 +4,6 @@ 
 # SPDX-License-Identifier: MIT
 #
 
-import unittest
 from oeqa.sdk.case import OESDKTestCase
 
 from oeqa.utils.subprocesstweak import errors_have_output
@@ -12,9 +11,7 @@  errors_have_output()
 
 class Python3Test(OESDKTestCase):
     def setUp(self):
-        if not (self.tc.hasHostPackage("nativesdk-python3-core") or
-                self.tc.hasHostPackage("python3-core-native")):
-            raise unittest.SkipTest("No python3 package in the SDK")
+        self.ensure_host_package("python3-core", recipe="python3")
 
     def test_python3(self):
         cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""