All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexis Lothoré via buildroot" <buildroot@buildroot.org>
To: buildroot@buildroot.org
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Alexis Lothoré" <alexis.lothore@bootlin.com>
Subject: [Buildroot] [PATCH v2 2/2] support/testing: add tests for openscap
Date: Mon, 07 Sep 2026 15:47:37 +0200	[thread overview]
Message-ID: <20260907-fix_openscap-v2-2-28f8f6ee3248@bootlin.com> (raw)
In-Reply-To: <20260907-fix_openscap-v2-0-28f8f6ee3248@bootlin.com>

Add basic tests for openscap, ensuring that it builds and runs a minimal
command with different cryptographic backends:
- libgcrypt
- libnss
- no crypto backend

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 support/testing/tests/package/test_openscap.py     | 63 ++++++++++++++++++++++
 .../rootfs-overlay/root/benchmark.xml              |  5 ++
 2 files changed, 68 insertions(+)

diff --git a/support/testing/tests/package/test_openscap.py b/support/testing/tests/package/test_openscap.py
new file mode 100644
index 000000000000..08527d28aa4d
--- /dev/null
+++ b/support/testing/tests/package/test_openscap.py
@@ -0,0 +1,63 @@
+import os
+
+import infra.basetest
+
+
+class TestOpenSCAPBase(infra.basetest.BRTest):
+    config = """
+        BR2_arm=y
+        BR2_cortex_a8=y
+        BR2_ARM_EABIHF=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
+        BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV7_EABIHF_GLIBC_STABLE=y
+        BR2_PACKAGE_OPENSCAP=y
+        BR2_ROOTFS_OVERLAY="{}"
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """.format(
+                infra.filepath("tests/package/test_openscap/rootfs-overlay"))
+
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(
+            arch="armv7",
+            kernel="builtin",
+            options=["-m", "512M", "-initrd", cpio_file],
+        )
+        self.emulator.login()
+
+        out, ret = self.emulator.run("oscap --version")
+        self.assertEqual(ret, 0)
+
+        out, ret = self.emulator.run("oscap info /root/benchmark.xml")
+        self.assertEqual(ret, 0)
+        self.assertIn("Document type: XCCDF Checklist", "\n".join(out))
+
+
+class TestOpenSCAPGcrypt(TestOpenSCAPBase):
+    """Test openscap using the gcrypt crypto backend."""
+
+    config = (
+        TestOpenSCAPBase.config
+        + """
+        BR2_PACKAGE_LIBGCRYPT=y
+        """
+    )
+
+
+class TestOpenSCAPNss(TestOpenSCAPBase):
+    """Test openscap using the nss crypto backend."""
+
+    config = (
+        TestOpenSCAPBase.config
+        + """
+        BR2_PACKAGE_LIBNSS=y
+        """
+    )
+
+
+class TestOpenSCAPNoCrypto(TestOpenSCAPBase):
+    """Test openscap without any crypto backend."""
+
+    config = TestOpenSCAPBase.config
diff --git a/support/testing/tests/package/test_openscap/rootfs-overlay/root/benchmark.xml b/support/testing/tests/package/test_openscap/rootfs-overlay/root/benchmark.xml
new file mode 100644
index 000000000000..aac0f1e0fa9a
--- /dev/null
+++ b/support/testing/tests/package/test_openscap/rootfs-overlay/root/benchmark.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xccdf:Benchmark xmlns:xccdf="http://checklists.nist.gov/xccdf/1.2" id="xccdf_org.buildroot.benchmark">
+  <xccdf:status>accepted</xccdf:status>
+  <xccdf:version>1.0</xccdf:version>
+</xccdf:Benchmark>

-- 
2.55.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      parent reply	other threads:[~2026-09-07 13:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 13:47 [Buildroot] [PATCH v2 0/2] package/openscap: fix and test build failure related to crypto Alexis Lothoré via buildroot
2026-09-07 13:47 ` [Buildroot] [PATCH v2 1/2] package: openscap: fix build failure when crypto backend is not gcrypt Alexis Lothoré via buildroot
2026-09-07 13:47 ` Alexis Lothoré via buildroot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260907-fix_openscap-v2-2-28f8f6ee3248@bootlin.com \
    --to=buildroot@buildroot.org \
    --cc=alexis.lothore@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.