1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-31 12:50:02 +00:00

kselftest: add kselftest recipe and integrate into testimage

Package up the kselftest from the kernel, and execute the arm64 GCS tests
inside CI.

At the moment some of the tests fail: gcs_write_fault and gcs_stress.
Mark the test as expected to fail until this is resolved.

Signed-off-by: Ross Burton <ross.burton@arm.com>
This commit is contained in:
Ross Burton
2024-07-01 18:11:14 +01:00
parent 0d3bc7947a
commit bb98b3c2dc
3 changed files with 74 additions and 4 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ local_conf_header:
IMAGE_CLASSES += "testimage"
TEST_SUITES = "ping ssh gcs"
IMAGE_FEATURES += "ssh-server-dropbear"
CORE_IMAGE_EXTRA_INSTALL += "ssh-pregen-hostkeys binutils"
CORE_IMAGE_EXTRA_INSTALL += "ssh-pregen-hostkeys binutils kselftest"
target:
- core-image-full-cmdline
+22 -3
View File
@@ -2,14 +2,13 @@
# SPDX-License-Identifier: MIT
#
import unittest
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.runtime.decorator.package import OEHasPackage
class GCSTests(OERuntimeTestCase):
# TODO:
# - Need a test that fails if GCS is enabled. kselftest most likely has tests here?
def test_dmesg(self):
"""
Verify that the kernel detected the GCS processor feature.
@@ -47,3 +46,23 @@ class GCSTests(OERuntimeTestCase):
status, output = self.target.run(cmd)
self.assertEqual(status, 0, f"ls failed: {output}")
self.assertEqual(output, "/usr")
@OEHasPackage(['kselftest'])
@unittest.expectedFailure
def test_kselftest(self):
"""
Run the GCS tests in the kselftest.
"""
cmd = """
cd /usr/libexec/kselftest; \
./run_kselftest.sh $(./run_kselftest.sh -l | awk -e '/arm64.*gcs/ { print "-t " $1 }') \
"""
status, output = self.target.run(cmd)
# kselftest normally returns 0 even if tests fail, so a failure here is serious
self.assertEqual(status, 0, f"kselftest failed: {output}")
# Identify any test failure lines, and assert that the list is empty
fails = [l for l in output.splitlines() if "not ok " in l]
self.assertFalse(fails)
@@ -0,0 +1,51 @@
SUMMARY = "kselftest, the kernel test suite"
SECTION = "kernel"
LICENSE = "GPL-2.0-only"
DEPENDS = "rsync-native alsa-lib libcap libcap-ng numactl popt libmnl"
inherit kernelsrc kernel-arch
PACKAGE_ARCH = "${MACHINE_ARCH}"
B = "${WORKDIR}/build"
do_compile[cleandirs] = "${B}"
CC:remove:aarch64 = "-mbranch-protection=standard"
SECURITY_CFLAGS = ""
# Disable BPF and HID as they need clang for BPF compilation
SKIP_TARGETS ?= "bpf hid"
EXTRA_OEMAKE += "\
O=${B} \
V=1 \
ARCH=${ARCH} \
CROSS_COMPILE=${TARGET_PREFIX} \
CC="${CC}" \
AR="${AR}" \
LD="${LD}" \
KHDR_INCLUDES="-isystem ${STAGING_KERNEL_BUILDDIR}" \
SKIP_TARGETS="${SKIP_TARGETS}" \
"
# Force all tests to build successfully
#EXTRA_OEMAKE += "FORCE_TARGETS=1"
do_compile() {
oe_runmake -C ${S}/tools/testing/selftests
}
do_install() {
oe_runmake -C ${S}/tools/testing/selftests install INSTALL_PATH=${D}/${libexecdir}/kselftest
# install uses rsync -a
chown -R root:root ${D}/${libexecdir}/kselftest
}
RDEPENDS:${PN} += "bash python3-core python3 perl perl-module-io-handle"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INSANE_SKIP:${PN} = "already-stripped buildpaths ldflags textrel"
# TODO test with musl