From patchwork Mon Dec 2 17:29:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 53459 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4409D7833B for ; Mon, 2 Dec 2024 17:30:00 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.179860.1733160598233349069 for ; Mon, 02 Dec 2024 09:29:58 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F38D01007 for ; Mon, 2 Dec 2024 09:30:25 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3445C3F71E for ; Mon, 2 Dec 2024 09:29:57 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [RFC PATCH] kselftest: add recipe Date: Mon, 2 Dec 2024 17:29:53 +0000 Message-Id: <20241202172953.769101-1-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 02 Dec 2024 17:30:00 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/208149 There's a similar recipe in meta-oe (kernel-selftest) but it needs clang and seems overly complicated. This recipe still needs further improvements, primarily that there is no integration into oeqa, but that can come later. Signed-off-by: Ross Burton --- meta/conf/distro/include/maintainers.inc | 1 + meta/recipes-kernel/linux/kselftest.bb | 65 ++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 meta/recipes-kernel/linux/kselftest.bb diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index 4cac0647c2a..3485c9df1b0 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc @@ -304,6 +304,7 @@ RECIPE_MAINTAINER:pn-kexec-tools = "Unassigned " RECIPE_MAINTAINER:pn-keymaps = "Alexander Kanavin " RECIPE_MAINTAINER:pn-kmod = "Chen Qi " RECIPE_MAINTAINER:pn-kmscube = "Carlos Rafael Giani " +RECIPE_MAINTAINER:pn-kselftest = "Ross Burton " RECIPE_MAINTAINER:pn-l3afpad = "Anuj Mittal " RECIPE_MAINTAINER:pn-lame = "Michael Opdenacker " RECIPE_MAINTAINER:pn-ldconfig-native = "Khem Raj " diff --git a/meta/recipes-kernel/linux/kselftest.bb b/meta/recipes-kernel/linux/kselftest.bb new file mode 100644 index 00000000000..dec57aca071 --- /dev/null +++ b/meta/recipes-kernel/linux/kselftest.bb @@ -0,0 +1,65 @@ +SUMMARY = "kselftest, the kernel test suite" +SECTION = "kernel" +LICENSE = "GPL-2.0-only" + +DEPENDS = "rsync-native" + +inherit kernelsrc kernel-arch pkgconfig + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# Unconventional usage of PACKAGECONFIG to control how the tests are built. +# +# Enabled should be unused, Disabled is the list of test targets which should +# be skipped if this dependency isn't present. +PACKAGECONFIG ??= "alsa libcap libcapng netlink numa openssl popt" +PACKAGECONFIG[alsa] = ",alsa,alsa-lib" +PACKAGECONFIG[bpf] = ",bpf hid,clang-native elfutils" +PACKAGECONFIG[fuse] = ",,fuse" +PACKAGECONFIG[libcap] = ",,libcap" +PACKAGECONFIG[libcapng] = ",,libcap-ng" +PACKAGECONFIG[netlink] = ",,libmnl" +PACKAGECONFIG[numa] = ",,numactl" +PACKAGECONFIG[openssl] = ",,openssl" +PACKAGECONFIG[popt] = ",,popt" + +B = "${WORKDIR}/build" + +do_compile[cleandirs] = "${B}" + +CC:remove:aarch64 = "-mbranch-protection=standard" +SECURITY_CFLAGS = "" + +SKIP_TARGETS = "${PACKAGECONFIG_CONFARGS}" + +EXTRA_OEMAKE += "\ + O=${B} \ + V=1 \ + ARCH=${ARCH} \ + CROSS_COMPILE=${TARGET_PREFIX} \ + CC="${CC} ${DEBUG_PREFIX_MAP}" \ + AR="${AR}" \ + LD="${LD}" \ + HOSTPKG_CONFIG=pkg-config-native \ + SKIP_TARGETS="${SKIP_TARGETS}" \ +" + +# Force all tests to build successfully. Usually we just package what +# successfully builds. +# 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 so reset the permissions + chown -R root:root ${D}/${libexecdir}/kselftest +} + +RDEPENDS:${PN} += "bash coreutils grep iproute2 python3-core python3 perl perl-module-io-handle" + +# Some binaries appear to be explicitly built without debug info, and often +# don't pass LDFLAGS. As this is a testing tool this is acceptable. +INSANE_SKIP:${PN} = "ldflags already-stripped textrel"