[RFC,1/1] testsuite: check if kernel SBOMs are deployed on supported kernels

Message ID 20261204143536.3423107-1-felix.moessbauer@siemens.com
State New
Headers show
Series [RFC,1/1] testsuite: check if kernel SBOMs are deployed on supported kernels | expand

Commit Message

Felix Moessbauer Dec. 4, 2026, 2:35 p.m. UTC
The kernel SBOMs have recently been introduced in the kernel. Check if
the corresponding isar kernel build generates and deploys them.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 .../linux/linux-isar-ci_7.3.6.bb              | 20 ++++++++++++++
 testsuite/citest.py                           | 26 +++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 meta-test/recipes-kernel/linux/linux-isar-ci_7.3.6.bb

Patch

diff --git a/meta-test/recipes-kernel/linux/linux-isar-ci_7.3.6.bb b/meta-test/recipes-kernel/linux/linux-isar-ci_7.3.6.bb
new file mode 100644
index 00000000..3cf15317
--- /dev/null
+++ b/meta-test/recipes-kernel/linux/linux-isar-ci_7.3.6.bb
@@ -0,0 +1,20 @@ 
+# Recipe to test kernel build SBOM generation
+#
+# This software is a part of Isar.
+# Copyright (c) Siemens AG, 2026
+#
+# SPDX-License-Identifier: MIT
+
+PN .= "-${DISTRO_ARCH}"
+
+inherit linux-kernel
+
+ARCHIVE_VERSION = "${@ d.getVar('PV')[:-2] if d.getVar('PV').endswith('.0') else d.getVar('PV') }"
+
+SRC_URI += "https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-${ARCHIVE_VERSION}.tar.xz"
+SRC_URI[sha256sum] = "8183d475a76a0faffa92d6cd500af421f589dfd0300a0f1060bb875e11d45723"
+
+S = "${WORKDIR}/linux-${ARCHIVE_VERSION}"
+
+KERNEL_SBOM_SUPPORT = "1"
+LINUX_VERSION_EXTENSION = "-isar"
diff --git a/testsuite/citest.py b/testsuite/citest.py
index 884e7375..fdff783b 100644
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -6,6 +6,8 @@ 
 #
 # SPDX-License-Identifier: MIT
 
+import os
+
 from avocado import skipUnless
 from avocado.core import exceptions
 from avocado.utils import path, process
@@ -809,6 +811,30 @@  class KernelTests(CIBaseTest):
                 'linux-cip', target,
                 f"unexpected linux-cip provider pulled in: {target}")
 
+    def test_kernel_sbom(self):
+        """Test that the kernel SBOM is generated."""
+        targets = [
+            'mc:qemuamd64-trixie:linux-image-isar-ci-amd64',
+            'mc:qemuarm64-trixie:linux-image-isar-ci-arm64',
+        ]
+        self.init()
+        self.perform_build_test(targets, ccache=True)
+
+        for target in targets:
+            _, multiconfig, image = target.split(':')
+            recipe = f'mc:{multiconfig}:{image.removeprefix("linux-image-")}'
+            kernel_name, kernel_version, image_dir = CIUtils.getVars(
+                'KERNEL_NAME_PROVIDED', 'PV', 'DEPLOY_DIR_IMAGE',
+                target=recipe)
+            for sbom_type in ('build', 'output', 'source'):
+                sbom_path = os.path.join(
+                    image_dir,
+                    f'linux-{kernel_name}-{kernel_version}-sbom-'
+                    f'{sbom_type}.spdx.json')
+                self.assertTrue(
+                    os.path.isfile(sbom_path),
+                    f'Kernel SPDX SBOM not found: {sbom_path}')
+
 
 class InitRdBaseTest(CIBaseTest):
     """