* [PATCH] Add recipe for linux kselftest @ 2020-05-18 12:05 Vijai Kumar K 2020-05-18 15:12 ` Jan Kiszka 0 siblings, 1 reply; 11+ messages in thread From: Vijai Kumar K @ 2020-05-18 12:05 UTC (permalink / raw) To: isar-users; +Cc: Vijai Kumar K Kselftest is a set of unit and regression tests under the tools/testing/selftests/ directory of the Linux kernel. These are used for testing individual code paths in the kernel. Kselftest is not debianized and is not available as part of the official Debian repository. This patch provides a recipe to build kselftest from the linux source of your choice. Sometimes developers/testers tend to use the latest version of selftests from Linux upstream stable releases for testing and hence the need for a separate recipe instead of being part of the linux recipe of ISAR. Some kselftest test cases build are known to break in certain linux versions, this has to be addressed upstream. Right now kselftest build succeeds even if atleast one of the testcase case build succeeds. You can change that by setting KSELFTEST_FORCE_TARGETS=1. TARGETS, TARGETS_SKIP, FORCE_TARETS can be set using the appropriate KSELFTEST_* recipe variable. Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com> --- .../kselftest/kselftest_5.6.13.bb | 27 ++++++++++++ .../kselftest/files/debian/changelog.tmpl | 5 +++ .../kselftest/files/debian/compat | 1 + .../kselftest/files/debian/control.tmpl | 10 +++++ .../kselftest/files/debian/rules | 27 ++++++++++++ meta/recipes-kernel/kselftest/kselftest.inc | 44 +++++++++++++++++++ 6 files changed, 114 insertions(+) create mode 100644 meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb create mode 100644 meta/recipes-kernel/kselftest/files/debian/changelog.tmpl create mode 100644 meta/recipes-kernel/kselftest/files/debian/compat create mode 100644 meta/recipes-kernel/kselftest/files/debian/control.tmpl create mode 100755 meta/recipes-kernel/kselftest/files/debian/rules create mode 100644 meta/recipes-kernel/kselftest/kselftest.inc diff --git a/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb new file mode 100644 index 0000000..3303742 --- /dev/null +++ b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb @@ -0,0 +1,27 @@ +# Kselftest package +# +# This software is a part of ISAR. +# Copyright (c) Mentor Graphics, a Siemens business, 2020 +# +# SPDX-License-Identifier: MIT + +require recipes-kernel/kselftest/kselftest.inc + +KSELFTEST_DEPENDS += " \ + libelf-dev:native, \ + libcap-ng-dev:native, \ + libpopt-dev:native, \ + libcap-dev:native, \ + libmount-dev:native, \ + libnuma-dev:native, \ + libfuse-dev:native, \ + libmnl-dev:native, \ + pkg-config, \ + clang, \ + llvm, \ + " + +SRC_URI += "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${PV}.tar.xz" +SRC_URI[sha256sum] = "f125d79c8f6974213638787adcad6b575bbd35a05851802fd83f622ec18ff987" + +S = "${WORKDIR}/linux-${PV}" diff --git a/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl b/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl new file mode 100644 index 0000000..6e59e06 --- /dev/null +++ b/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl @@ -0,0 +1,5 @@ +${PN} (${PV}) unstable; urgency=low + + * Generated package. + + -- ISAR project <isar-users@googlegroups.com> Tue, 6 Feb 2018 00:00:00 +0000 diff --git a/meta/recipes-kernel/kselftest/files/debian/compat b/meta/recipes-kernel/kselftest/files/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/meta/recipes-kernel/kselftest/files/debian/compat @@ -0,0 +1 @@ +9 diff --git a/meta/recipes-kernel/kselftest/files/debian/control.tmpl b/meta/recipes-kernel/kselftest/files/debian/control.tmpl new file mode 100644 index 0000000..de5d315 --- /dev/null +++ b/meta/recipes-kernel/kselftest/files/debian/control.tmpl @@ -0,0 +1,10 @@ +Source: ${PN} +Section: kernel +Priority: optional +Build-Depends: ${KSELFTEST_DEPENDS} +Standards-Version: 3.9.6 +Maintainer: ISAR project <isar-users@googlegroups.com> + +Package: ${PN} +Architecture: any +Description: ${DESCRIPTION} diff --git a/meta/recipes-kernel/kselftest/files/debian/rules b/meta/recipes-kernel/kselftest/files/debian/rules new file mode 100755 index 0000000..6f49138 --- /dev/null +++ b/meta/recipes-kernel/kselftest/files/debian/rules @@ -0,0 +1,27 @@ +#!/usr/bin/make -f + +# Debian rules for Kselftest build +# +# This software is a part of ISAR. +# Copyright (c) Mentor, A Siemens Business +# +# SPDX-License-Identifier: MIT + +deb_top_dir:=$(CURDIR)/debian +kselftest_install_dir :=$(deb_top_dir)/kselftest/usr/libexec/kselftest + +PARALLEL_BUILD=-j $(shell echo $$(($$(nproc) * 2))) + +override_dh_auto_build: + $(MAKE) defconfig + $(MAKE) $(PARALLEL_BUILD) -C tools/testing/selftests/ ${KSELFTEST_ARGS} + +override_dh_auto_install: + mkdir -p ${kselftest_install_dir} + cd tools/testing/selftests/ && KSFT_INSTALL_PATH=${kselftest_install_dir} $(MAKE) $(PARALLEL_BUILD) install ${KSELFTEST_ARGS} + +override_dh_auto_clean: + rm -rf ${deb_top_dir}/kselftest/ + +%: + CFLAGS= LDFLAGS= dh $@ --parallel diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc new file mode 100644 index 0000000..12ebec9 --- /dev/null +++ b/meta/recipes-kernel/kselftest/kselftest.inc @@ -0,0 +1,44 @@ +# Kselftest package for Linux +# +# This software is a part of ISAR. +# Copyright (c) Mentor Graphics, a Siemens Business, 2020 +# +# SPDX-License-Identifier: MIT + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +DESCRIPTION ?= "Kernel selftests from Linux kernel ${PV}" + +ISAR_CROSS_COMPILE = "0" + +SRC_URI += "file://debian" +KSELFTEST_DEPENDS ?= " \ + rsync, \ + flex, \ + bison, \ + " +KSELFTEST_TARGETS ?= "" +KSELFTEST_SKIP_TARGETS ?= "" +KSELFTEST_FORCE_TARGETS ?= "0" + +inherit dpkg + +TEMPLATE_FILES += "debian/control.tmpl \ + debian/changelog.tmpl" +TEMPLATE_VARS += "KSELFTEST_DEPENDS" + +do_prepare_build() { + cp -rf ${WORKDIR}/debian ${S}/debian +} + +dpkg_runbuild_prepend() { + if [ -n "${KSELFTEST_TARGETS}" ];then + export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\"" + fi + if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then + export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1" + fi + if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then + export KSELFTEST_ARGS="${KSELFTEST_ARGS} SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" + fi +} -- 2.17.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Add recipe for linux kselftest 2020-05-18 12:05 [PATCH] Add recipe for linux kselftest Vijai Kumar K @ 2020-05-18 15:12 ` Jan Kiszka 2020-05-18 15:57 ` vijai kumar 0 siblings, 1 reply; 11+ messages in thread From: Jan Kiszka @ 2020-05-18 15:12 UTC (permalink / raw) To: isar-users On 18.05.20 14:05, Vijai Kumar K wrote: > Kselftest is a set of unit and regression tests under the > tools/testing/selftests/ directory of the Linux kernel. These are used > for testing individual code paths in the kernel. > > Kselftest is not debianized and is not available as part of the official > Debian repository. > > This patch provides a recipe to build kselftest from the linux source of > your choice. > > Sometimes developers/testers tend to use the latest version of selftests > from Linux upstream stable releases for testing and hence the need for a > separate recipe instead of being part of the linux recipe of ISAR. > > Some kselftest test cases build are known to break in certain linux > versions, this has to be addressed upstream. Right now kselftest build > succeeds even if atleast one of the testcase case build succeeds. > > You can change that by setting KSELFTEST_FORCE_TARGETS=1. > > TARGETS, TARGETS_SKIP, FORCE_TARETS can be set using the appropriate > KSELFTEST_* recipe variable. > > Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com> > --- > .../kselftest/kselftest_5.6.13.bb | 27 ++++++++++++ > .../kselftest/files/debian/changelog.tmpl | 5 +++ > .../kselftest/files/debian/compat | 1 + > .../kselftest/files/debian/control.tmpl | 10 +++++ > .../kselftest/files/debian/rules | 27 ++++++++++++ > meta/recipes-kernel/kselftest/kselftest.inc | 44 +++++++++++++++++++ > 6 files changed, 114 insertions(+) > create mode 100644 meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > create mode 100644 meta/recipes-kernel/kselftest/files/debian/changelog.tmpl > create mode 100644 meta/recipes-kernel/kselftest/files/debian/compat > create mode 100644 meta/recipes-kernel/kselftest/files/debian/control.tmpl > create mode 100755 meta/recipes-kernel/kselftest/files/debian/rules > create mode 100644 meta/recipes-kernel/kselftest/kselftest.inc > > diff --git a/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > new file mode 100644 > index 0000000..3303742 > --- /dev/null > +++ b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > @@ -0,0 +1,27 @@ > +# Kselftest package > +# > +# This software is a part of ISAR. > +# Copyright (c) Mentor Graphics, a Siemens business, 2020 > +# > +# SPDX-License-Identifier: MIT > + > +require recipes-kernel/kselftest/kselftest.inc > + > +KSELFTEST_DEPENDS += " \ > + libelf-dev:native, \ > + libcap-ng-dev:native, \ > + libpopt-dev:native, \ > + libcap-dev:native, \ > + libmount-dev:native, \ > + libnuma-dev:native, \ > + libfuse-dev:native, \ > + libmnl-dev:native, \ > + pkg-config, \ > + clang, \ > + llvm, \ > + " Are all of these deps specific to the version, or would it make sense to extract some common ones (or even all?) to kselftest.inc? > + > +SRC_URI += "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${PV}.tar.xz" > +SRC_URI[sha256sum] = "f125d79c8f6974213638787adcad6b575bbd35a05851802fd83f622ec18ff987" > + > +S = "${WORKDIR}/linux-${PV}" The SRC_URI and S are likely also version-independent. > diff --git a/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl b/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl > new file mode 100644 > index 0000000..6e59e06 > --- /dev/null > +++ b/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl > @@ -0,0 +1,5 @@ > +${PN} (${PV}) unstable; urgency=low > + > + * Generated package. > + > + -- ISAR project <isar-users@googlegroups.com> Tue, 6 Feb 2018 00:00:00 +0000 deb_add_changelog? > diff --git a/meta/recipes-kernel/kselftest/files/debian/compat b/meta/recipes-kernel/kselftest/files/debian/compat > new file mode 100644 > index 0000000..ec63514 > --- /dev/null > +++ b/meta/recipes-kernel/kselftest/files/debian/compat > @@ -0,0 +1 @@ > +9 > diff --git a/meta/recipes-kernel/kselftest/files/debian/control.tmpl b/meta/recipes-kernel/kselftest/files/debian/control.tmpl > new file mode 100644 > index 0000000..de5d315 > --- /dev/null > +++ b/meta/recipes-kernel/kselftest/files/debian/control.tmpl > @@ -0,0 +1,10 @@ > +Source: ${PN} > +Section: kernel > +Priority: optional > +Build-Depends: ${KSELFTEST_DEPENDS} > +Standards-Version: 3.9.6 > +Maintainer: ISAR project <isar-users@googlegroups.com> > + > +Package: ${PN} > +Architecture: any > +Description: ${DESCRIPTION} This looks to like deb_create_control could generate it as well. If you like, you could still patch the setion afterward from misc to kernel. > diff --git a/meta/recipes-kernel/kselftest/files/debian/rules b/meta/recipes-kernel/kselftest/files/debian/rules > new file mode 100755 > index 0000000..6f49138 > --- /dev/null > +++ b/meta/recipes-kernel/kselftest/files/debian/rules > @@ -0,0 +1,27 @@ > +#!/usr/bin/make -f > + > +# Debian rules for Kselftest build > +# > +# This software is a part of ISAR. > +# Copyright (c) Mentor, A Siemens Business > +# > +# SPDX-License-Identifier: MIT > + > +deb_top_dir:=$(CURDIR)/debian > +kselftest_install_dir :=$(deb_top_dir)/kselftest/usr/libexec/kselftest > + > +PARALLEL_BUILD=-j $(shell echo $$(($$(nproc) * 2))) > + > +override_dh_auto_build: > + $(MAKE) defconfig > + $(MAKE) $(PARALLEL_BUILD) -C tools/testing/selftests/ ${KSELFTEST_ARGS} > + > +override_dh_auto_install: > + mkdir -p ${kselftest_install_dir} > + cd tools/testing/selftests/ && KSFT_INSTALL_PATH=${kselftest_install_dir} $(MAKE) $(PARALLEL_BUILD) install ${KSELFTEST_ARGS} > + > +override_dh_auto_clean: > + rm -rf ${deb_top_dir}/kselftest/ > + > +%: > + CFLAGS= LDFLAGS= dh $@ --parallel > diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc > new file mode 100644 > index 0000000..12ebec9 > --- /dev/null > +++ b/meta/recipes-kernel/kselftest/kselftest.inc > @@ -0,0 +1,44 @@ > +# Kselftest package for Linux > +# > +# This software is a part of ISAR. > +# Copyright (c) Mentor Graphics, a Siemens Business, 2020 > +# > +# SPDX-License-Identifier: MIT > + > +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" > + > +DESCRIPTION ?= "Kernel selftests from Linux kernel ${PV}" > + > +ISAR_CROSS_COMPILE = "0" Why that? Please leave a comment so that it can be revisited in future releases, or make version dependent (-> move to .bb recipe). > + > +SRC_URI += "file://debian" > +KSELFTEST_DEPENDS ?= " \ > + rsync, \ > + flex, \ > + bison, \ > + " > +KSELFTEST_TARGETS ?= "" > +KSELFTEST_SKIP_TARGETS ?= "" > +KSELFTEST_FORCE_TARGETS ?= "0" > + > +inherit dpkg > + > +TEMPLATE_FILES += "debian/control.tmpl \ > + debian/changelog.tmpl" > +TEMPLATE_VARS += "KSELFTEST_DEPENDS" > + > +do_prepare_build() { > + cp -rf ${WORKDIR}/debian ${S}/debian > +} > + > +dpkg_runbuild_prepend() { > + if [ -n "${KSELFTEST_TARGETS}" ];then > + export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\"" > + fi > + if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then > + export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1" > + fi > + if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then > + export KSELFTEST_ARGS="${KSELFTEST_ARGS} SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" > + fi > +} > Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Add recipe for linux kselftest 2020-05-18 15:12 ` Jan Kiszka @ 2020-05-18 15:57 ` vijai kumar 2020-05-18 16:06 ` Jan Kiszka 0 siblings, 1 reply; 11+ messages in thread From: vijai kumar @ 2020-05-18 15:57 UTC (permalink / raw) To: Jan Kiszka; +Cc: isar-users On Mon, May 18, 2020 at 8:43 PM Jan Kiszka <jan.kiszka@siemens.com> wrote: > > On 18.05.20 14:05, Vijai Kumar K wrote: > > Kselftest is a set of unit and regression tests under the > > tools/testing/selftests/ directory of the Linux kernel. These are used > > for testing individual code paths in the kernel. > > > > Kselftest is not debianized and is not available as part of the official > > Debian repository. > > > > This patch provides a recipe to build kselftest from the linux source of > > your choice. > > > > Sometimes developers/testers tend to use the latest version of selftests > > from Linux upstream stable releases for testing and hence the need for a > > separate recipe instead of being part of the linux recipe of ISAR. > > > > Some kselftest test cases build are known to break in certain linux > > versions, this has to be addressed upstream. Right now kselftest build > > succeeds even if atleast one of the testcase case build succeeds. > > > > You can change that by setting KSELFTEST_FORCE_TARGETS=1. > > > > TARGETS, TARGETS_SKIP, FORCE_TARETS can be set using the appropriate > > KSELFTEST_* recipe variable. > > > > Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com> > > --- > > .../kselftest/kselftest_5.6.13.bb | 27 ++++++++++++ > > .../kselftest/files/debian/changelog.tmpl | 5 +++ > > .../kselftest/files/debian/compat | 1 + > > .../kselftest/files/debian/control.tmpl | 10 +++++ > > .../kselftest/files/debian/rules | 27 ++++++++++++ > > meta/recipes-kernel/kselftest/kselftest.inc | 44 +++++++++++++++++++ > > 6 files changed, 114 insertions(+) > > create mode 100644 meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > > create mode 100644 meta/recipes-kernel/kselftest/files/debian/changelog.tmpl > > create mode 100644 meta/recipes-kernel/kselftest/files/debian/compat > > create mode 100644 meta/recipes-kernel/kselftest/files/debian/control.tmpl > > create mode 100755 meta/recipes-kernel/kselftest/files/debian/rules > > create mode 100644 meta/recipes-kernel/kselftest/kselftest.inc > > > > diff --git a/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > > new file mode 100644 > > index 0000000..3303742 > > --- /dev/null > > +++ b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > > @@ -0,0 +1,27 @@ > > +# Kselftest package > > +# > > +# This software is a part of ISAR. > > +# Copyright (c) Mentor Graphics, a Siemens business, 2020 > > +# > > +# SPDX-License-Identifier: MIT > > + > > +require recipes-kernel/kselftest/kselftest.inc > > + > > +KSELFTEST_DEPENDS += " \ > > + libelf-dev:native, \ > > + libcap-ng-dev:native, \ > > + libpopt-dev:native, \ > > + libcap-dev:native, \ > > + libmount-dev:native, \ > > + libnuma-dev:native, \ > > + libfuse-dev:native, \ > > + libmnl-dev:native, \ > > + pkg-config, \ > > + clang, \ > > + llvm, \ > > + " > > Are all of these deps specific to the version, or would it make sense to > extract some common ones (or even all?) to kselftest.inc? On the limited versions of Linux I have tested, this seems common when you build ALL test cases. This list is a collection of dependencies needed by ALL the testcases(TARGETS) that kselftest builds. We could also specify the limited list of test cases you want to compile using "TARGETS=" & "SKIP_TARGETS=" variables. If you just compiling for say "size" test case you may not need any of these. That is the reason I had these depends in the bb. The common ones like bison, flex and rsync are there kselftest.inc > > > + > > +SRC_URI += "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${PV}.tar.xz" > > +SRC_URI[sha256sum] = "f125d79c8f6974213638787adcad6b575bbd35a05851802fd83f622ec18ff987" > > + > > +S = "${WORKDIR}/linux-${PV}" > > The SRC_URI and S are likely also version-independent. Sorry, but I am not getting this. Can you please elaborate? > > > diff --git a/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl b/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl > > new file mode 100644 > > index 0000000..6e59e06 > > --- /dev/null > > +++ b/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl > > @@ -0,0 +1,5 @@ > > +${PN} (${PV}) unstable; urgency=low > > + > > + * Generated package. > > + > > + -- ISAR project <isar-users@googlegroups.com> Tue, 6 Feb 2018 00:00:00 +0000 > > deb_add_changelog? I will have a look into that API. Will address in v2. > > > diff --git a/meta/recipes-kernel/kselftest/files/debian/compat b/meta/recipes-kernel/kselftest/files/debian/compat > > new file mode 100644 > > index 0000000..ec63514 > > --- /dev/null > > +++ b/meta/recipes-kernel/kselftest/files/debian/compat > > @@ -0,0 +1 @@ > > +9 > > diff --git a/meta/recipes-kernel/kselftest/files/debian/control.tmpl b/meta/recipes-kernel/kselftest/files/debian/control.tmpl > > new file mode 100644 > > index 0000000..de5d315 > > --- /dev/null > > +++ b/meta/recipes-kernel/kselftest/files/debian/control.tmpl > > @@ -0,0 +1,10 @@ > > +Source: ${PN} > > +Section: kernel > > +Priority: optional > > +Build-Depends: ${KSELFTEST_DEPENDS} > > +Standards-Version: 3.9.6 > > +Maintainer: ISAR project <isar-users@googlegroups.com> > > + > > +Package: ${PN} > > +Architecture: any > > +Description: ${DESCRIPTION} > > This looks to like deb_create_control could generate it as well. If you > like, you could still patch the setion afterward from misc to kernel. Will have a look and possibly address in v2. > > > diff --git a/meta/recipes-kernel/kselftest/files/debian/rules b/meta/recipes-kernel/kselftest/files/debian/rules > > new file mode 100755 > > index 0000000..6f49138 > > --- /dev/null > > +++ b/meta/recipes-kernel/kselftest/files/debian/rules > > @@ -0,0 +1,27 @@ > > +#!/usr/bin/make -f > > + > > +# Debian rules for Kselftest build > > +# > > +# This software is a part of ISAR. > > +# Copyright (c) Mentor, A Siemens Business > > +# > > +# SPDX-License-Identifier: MIT > > + > > +deb_top_dir:=$(CURDIR)/debian > > +kselftest_install_dir :=$(deb_top_dir)/kselftest/usr/libexec/kselftest > > + > > +PARALLEL_BUILD=-j $(shell echo $$(($$(nproc) * 2))) > > + > > +override_dh_auto_build: > > + $(MAKE) defconfig > > + $(MAKE) $(PARALLEL_BUILD) -C tools/testing/selftests/ ${KSELFTEST_ARGS} > > + > > +override_dh_auto_install: > > + mkdir -p ${kselftest_install_dir} > > + cd tools/testing/selftests/ && KSFT_INSTALL_PATH=${kselftest_install_dir} $(MAKE) $(PARALLEL_BUILD) install ${KSELFTEST_ARGS} > > + > > +override_dh_auto_clean: > > + rm -rf ${deb_top_dir}/kselftest/ > > + > > +%: > > + CFLAGS= LDFLAGS= dh $@ --parallel > > diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc > > new file mode 100644 > > index 0000000..12ebec9 > > --- /dev/null > > +++ b/meta/recipes-kernel/kselftest/kselftest.inc > > @@ -0,0 +1,44 @@ > > +# Kselftest package for Linux > > +# > > +# This software is a part of ISAR. > > +# Copyright (c) Mentor Graphics, a Siemens Business, 2020 > > +# > > +# SPDX-License-Identifier: MIT > > + > > +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" > > + > > +DESCRIPTION ?= "Kernel selftests from Linux kernel ${PV}" > > + > > +ISAR_CROSS_COMPILE = "0" > > Why that? Please leave a comment so that it can be revisited in future > releases, or make version dependent (-> move to .bb recipe). I remember having issues with some test cases failing in cross compilation. Added this to make sure the deb has consistent working testcases in ISAR cross compilation setup. I have to look back at my notes on what failed. Will have a look and take care of this in v2. Thanks, Vijai Kumar K > > > + > > +SRC_URI += "file://debian" > > +KSELFTEST_DEPENDS ?= " \ > > + rsync, \ > > + flex, \ > > + bison, \ > > + " > > +KSELFTEST_TARGETS ?= "" > > +KSELFTEST_SKIP_TARGETS ?= "" > > +KSELFTEST_FORCE_TARGETS ?= "0" > > + > > +inherit dpkg > > + > > +TEMPLATE_FILES += "debian/control.tmpl \ > > + debian/changelog.tmpl" > > +TEMPLATE_VARS += "KSELFTEST_DEPENDS" > > + > > +do_prepare_build() { > > + cp -rf ${WORKDIR}/debian ${S}/debian > > +} > > + > > +dpkg_runbuild_prepend() { > > + if [ -n "${KSELFTEST_TARGETS}" ];then > > + export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\"" > > + fi > > + if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then > > + export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1" > > + fi > > + if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then > > + export KSELFTEST_ARGS="${KSELFTEST_ARGS} SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" > > + fi > > +} > > > > Jan > > -- > Siemens AG, Corporate Technology, CT RDA IOT SES-DE > Corporate Competence Center Embedded Linux > > -- > You received this message because you are subscribed to the Google Groups "isar-users" group. > To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/42ea0194-db8d-09eb-2157-2b1af59bcad9%40siemens.com. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Add recipe for linux kselftest 2020-05-18 15:57 ` vijai kumar @ 2020-05-18 16:06 ` Jan Kiszka 2020-05-19 11:01 ` [PATCH v2] " Vijai Kumar K 0 siblings, 1 reply; 11+ messages in thread From: Jan Kiszka @ 2020-05-18 16:06 UTC (permalink / raw) To: vijai kumar; +Cc: isar-users On 18.05.20 17:57, vijai kumar wrote: > On Mon, May 18, 2020 at 8:43 PM Jan Kiszka <jan.kiszka@siemens.com> wrote: >> >> On 18.05.20 14:05, Vijai Kumar K wrote: >>> Kselftest is a set of unit and regression tests under the >>> tools/testing/selftests/ directory of the Linux kernel. These are used >>> for testing individual code paths in the kernel. >>> >>> Kselftest is not debianized and is not available as part of the official >>> Debian repository. >>> >>> This patch provides a recipe to build kselftest from the linux source of >>> your choice. >>> >>> Sometimes developers/testers tend to use the latest version of selftests >>> from Linux upstream stable releases for testing and hence the need for a >>> separate recipe instead of being part of the linux recipe of ISAR. >>> >>> Some kselftest test cases build are known to break in certain linux >>> versions, this has to be addressed upstream. Right now kselftest build >>> succeeds even if atleast one of the testcase case build succeeds. >>> >>> You can change that by setting KSELFTEST_FORCE_TARGETS=1. >>> >>> TARGETS, TARGETS_SKIP, FORCE_TARETS can be set using the appropriate >>> KSELFTEST_* recipe variable. >>> >>> Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com> >>> --- >>> .../kselftest/kselftest_5.6.13.bb | 27 ++++++++++++ >>> .../kselftest/files/debian/changelog.tmpl | 5 +++ >>> .../kselftest/files/debian/compat | 1 + >>> .../kselftest/files/debian/control.tmpl | 10 +++++ >>> .../kselftest/files/debian/rules | 27 ++++++++++++ >>> meta/recipes-kernel/kselftest/kselftest.inc | 44 +++++++++++++++++++ >>> 6 files changed, 114 insertions(+) >>> create mode 100644 meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb >>> create mode 100644 meta/recipes-kernel/kselftest/files/debian/changelog.tmpl >>> create mode 100644 meta/recipes-kernel/kselftest/files/debian/compat >>> create mode 100644 meta/recipes-kernel/kselftest/files/debian/control.tmpl >>> create mode 100755 meta/recipes-kernel/kselftest/files/debian/rules >>> create mode 100644 meta/recipes-kernel/kselftest/kselftest.inc >>> >>> diff --git a/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb >>> new file mode 100644 >>> index 0000000..3303742 >>> --- /dev/null >>> +++ b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb >>> @@ -0,0 +1,27 @@ >>> +# Kselftest package >>> +# >>> +# This software is a part of ISAR. >>> +# Copyright (c) Mentor Graphics, a Siemens business, 2020 >>> +# >>> +# SPDX-License-Identifier: MIT >>> + >>> +require recipes-kernel/kselftest/kselftest.inc >>> + >>> +KSELFTEST_DEPENDS += " \ >>> + libelf-dev:native, \ >>> + libcap-ng-dev:native, \ >>> + libpopt-dev:native, \ >>> + libcap-dev:native, \ >>> + libmount-dev:native, \ >>> + libnuma-dev:native, \ >>> + libfuse-dev:native, \ >>> + libmnl-dev:native, \ >>> + pkg-config, \ >>> + clang, \ >>> + llvm, \ >>> + " >> >> Are all of these deps specific to the version, or would it make sense to >> extract some common ones (or even all?) to kselftest.inc? > > On the limited versions of Linux I have tested, this seems common when > you build ALL > test cases. This list is a collection of dependencies needed by ALL > the testcases(TARGETS) > that kselftest builds. > > We could also specify the limited list of test cases you want to > compile using "TARGETS=" & "SKIP_TARGETS=" > variables. > > If you just compiling for say "size" test case you may not need any > of these. That is the > reason I had these depends in the bb. The common ones like bison, flex > and rsync are there kselftest.inc > If you can identify some dependency clusters for specific test case set, adding them automatically when selecting a set would be nice. Otherwise, I would simply go for "add them all". Background is that only little information should be left in the example & test layer meta-isar. >> >>> + >>> +SRC_URI += "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${PV}.tar.xz" >>> +SRC_URI[sha256sum] = "f125d79c8f6974213638787adcad6b575bbd35a05851802fd83f622ec18ff987" >>> + >>> +S = "${WORKDIR}/linux-${PV}" >> >> The SRC_URI and S are likely also version-independent. > > Sorry, but I am not getting this. Can you please elaborate? > Move them to kselftest.inc. Reduces the boilerplate one has to add to an own recipe. >> >>> diff --git a/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl b/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl >>> new file mode 100644 >>> index 0000000..6e59e06 >>> --- /dev/null >>> +++ b/meta/recipes-kernel/kselftest/files/debian/changelog.tmpl >>> @@ -0,0 +1,5 @@ >>> +${PN} (${PV}) unstable; urgency=low >>> + >>> + * Generated package. >>> + >>> + -- ISAR project <isar-users@googlegroups.com> Tue, 6 Feb 2018 00:00:00 +0000 >> >> deb_add_changelog? > > I will have a look into that API. Will address in v2. > >> >>> diff --git a/meta/recipes-kernel/kselftest/files/debian/compat b/meta/recipes-kernel/kselftest/files/debian/compat >>> new file mode 100644 >>> index 0000000..ec63514 >>> --- /dev/null >>> +++ b/meta/recipes-kernel/kselftest/files/debian/compat >>> @@ -0,0 +1 @@ >>> +9 >>> diff --git a/meta/recipes-kernel/kselftest/files/debian/control.tmpl b/meta/recipes-kernel/kselftest/files/debian/control.tmpl >>> new file mode 100644 >>> index 0000000..de5d315 >>> --- /dev/null >>> +++ b/meta/recipes-kernel/kselftest/files/debian/control.tmpl >>> @@ -0,0 +1,10 @@ >>> +Source: ${PN} >>> +Section: kernel >>> +Priority: optional >>> +Build-Depends: ${KSELFTEST_DEPENDS} >>> +Standards-Version: 3.9.6 >>> +Maintainer: ISAR project <isar-users@googlegroups.com> >>> + >>> +Package: ${PN} >>> +Architecture: any >>> +Description: ${DESCRIPTION} >> >> This looks to like deb_create_control could generate it as well. If you >> like, you could still patch the setion afterward from misc to kernel. > > Will have a look and possibly address in v2. > >> >>> diff --git a/meta/recipes-kernel/kselftest/files/debian/rules b/meta/recipes-kernel/kselftest/files/debian/rules >>> new file mode 100755 >>> index 0000000..6f49138 >>> --- /dev/null >>> +++ b/meta/recipes-kernel/kselftest/files/debian/rules >>> @@ -0,0 +1,27 @@ >>> +#!/usr/bin/make -f >>> + >>> +# Debian rules for Kselftest build >>> +# >>> +# This software is a part of ISAR. >>> +# Copyright (c) Mentor, A Siemens Business >>> +# >>> +# SPDX-License-Identifier: MIT >>> + >>> +deb_top_dir:=$(CURDIR)/debian >>> +kselftest_install_dir :=$(deb_top_dir)/kselftest/usr/libexec/kselftest >>> + >>> +PARALLEL_BUILD=-j $(shell echo $$(($$(nproc) * 2))) >>> + >>> +override_dh_auto_build: >>> + $(MAKE) defconfig >>> + $(MAKE) $(PARALLEL_BUILD) -C tools/testing/selftests/ ${KSELFTEST_ARGS} >>> + >>> +override_dh_auto_install: >>> + mkdir -p ${kselftest_install_dir} >>> + cd tools/testing/selftests/ && KSFT_INSTALL_PATH=${kselftest_install_dir} $(MAKE) $(PARALLEL_BUILD) install ${KSELFTEST_ARGS} >>> + >>> +override_dh_auto_clean: >>> + rm -rf ${deb_top_dir}/kselftest/ >>> + >>> +%: >>> + CFLAGS= LDFLAGS= dh $@ --parallel >>> diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc >>> new file mode 100644 >>> index 0000000..12ebec9 >>> --- /dev/null >>> +++ b/meta/recipes-kernel/kselftest/kselftest.inc >>> @@ -0,0 +1,44 @@ >>> +# Kselftest package for Linux >>> +# >>> +# This software is a part of ISAR. >>> +# Copyright (c) Mentor Graphics, a Siemens Business, 2020 >>> +# >>> +# SPDX-License-Identifier: MIT >>> + >>> +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" >>> + >>> +DESCRIPTION ?= "Kernel selftests from Linux kernel ${PV}" >>> + >>> +ISAR_CROSS_COMPILE = "0" >> >> Why that? Please leave a comment so that it can be revisited in future >> releases, or make version dependent (-> move to .bb recipe). > > I remember having issues with some test cases failing in cross > compilation. Added this to make sure the deb has > consistent working testcases in ISAR cross compilation setup. I have > to look back at my notes on what failed. > Will have a look and take care of this in v2. > Perfect. Thanks, Jan > Thanks, > Vijai Kumar K > >> >>> + >>> +SRC_URI += "file://debian" >>> +KSELFTEST_DEPENDS ?= " \ >>> + rsync, \ >>> + flex, \ >>> + bison, \ >>> + " >>> +KSELFTEST_TARGETS ?= "" >>> +KSELFTEST_SKIP_TARGETS ?= "" >>> +KSELFTEST_FORCE_TARGETS ?= "0" >>> + >>> +inherit dpkg >>> + >>> +TEMPLATE_FILES += "debian/control.tmpl \ >>> + debian/changelog.tmpl" >>> +TEMPLATE_VARS += "KSELFTEST_DEPENDS" >>> + >>> +do_prepare_build() { >>> + cp -rf ${WORKDIR}/debian ${S}/debian >>> +} >>> + >>> +dpkg_runbuild_prepend() { >>> + if [ -n "${KSELFTEST_TARGETS}" ];then >>> + export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\"" >>> + fi >>> + if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then >>> + export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1" >>> + fi >>> + if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then >>> + export KSELFTEST_ARGS="${KSELFTEST_ARGS} SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" >>> + fi >>> +} >>> >> >> Jan >> >> -- >> Siemens AG, Corporate Technology, CT RDA IOT SES-DE >> Corporate Competence Center Embedded Linux >> >> -- >> You received this message because you are subscribed to the Google Groups "isar-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com. >> To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/42ea0194-db8d-09eb-2157-2b1af59bcad9%40siemens.com. > -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2] Add recipe for linux kselftest 2020-05-18 16:06 ` Jan Kiszka @ 2020-05-19 11:01 ` Vijai Kumar K 2020-05-19 11:44 ` Jan Kiszka 2020-05-28 19:55 ` Baurzhan Ismagulov 0 siblings, 2 replies; 11+ messages in thread From: Vijai Kumar K @ 2020-05-19 11:01 UTC (permalink / raw) To: isar-users; +Cc: Vijai Kumar K Kselftest is a set of unit and regression tests under the tools/testing/selftests/ directory of the Linux kernel. These are used for testing individual code paths in the kernel. Kselftest is not debianized and is not available as part of the official Debian repository. This patch provides a recipe to build kselftest from the linux source of your choice. Sometimes developers/testers tend to use the latest version of selftests from Linux upstream stable releases for testing and hence the need for a separate recipe instead of being part of the linux recipe of ISAR. Some kselftest test cases build are known to break in certain linux versions, this has to be addressed upstream. Right now kselftest build succeeds even if atleast one of the testcase case build succeeds. You can change that by setting KSELFTEST_FORCE_TARGETS=1. TARGETS, TARGETS_SKIP, FORCE_TARGETS can be set using the appropriate KSELFTEST_* recipe variable. Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com> --- Changes since v1: - Addressed review comments in v1 - Used debianize APIs for control, compat and changelog. - Moved Depends & S definitions to include file. - Added cross compilation bits in rules. - Change clang, llvm to clang:native & llvm:native .../kselftest/kselftest_5.6.13.bb | 11 ++++ .../kselftest/files/debian/rules | 41 +++++++++++++ meta/recipes-kernel/kselftest/kselftest.inc | 61 +++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb create mode 100755 meta/recipes-kernel/kselftest/files/debian/rules create mode 100644 meta/recipes-kernel/kselftest/kselftest.inc diff --git a/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb new file mode 100644 index 0000000..0c9818a --- /dev/null +++ b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb @@ -0,0 +1,11 @@ +# Kselftest package +# +# This software is a part of ISAR. +# Copyright (c) Mentor Graphics, a Siemens business, 2020 +# +# SPDX-License-Identifier: MIT + +require recipes-kernel/kselftest/kselftest.inc + +SRC_URI += "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${PV}.tar.xz" +SRC_URI[sha256sum] = "f125d79c8f6974213638787adcad6b575bbd35a05851802fd83f622ec18ff987" diff --git a/meta/recipes-kernel/kselftest/files/debian/rules b/meta/recipes-kernel/kselftest/files/debian/rules new file mode 100755 index 0000000..776d341 --- /dev/null +++ b/meta/recipes-kernel/kselftest/files/debian/rules @@ -0,0 +1,41 @@ +#!/usr/bin/make -f + +# Debian rules for Kselftest build +# +# This software is a part of ISAR. +# Copyright (c) Mentor, A Siemens Business +# +# SPDX-License-Identifier: MIT + +deb_top_dir:=$(CURDIR)/debian +kselftest_install_dir :=$(deb_top_dir)/kselftest/usr/libexec/kselftest +export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- + +ifeq ($(DEB_HOST_GNU_CPU), arm) +export ARCH=arm +endif +ifeq ($(DEB_HOST_GNU_CPU), aarch64) +export ARCH=arm64 +endif +ifeq ($(DEB_HOST_GNU_CPU), riscv64) +export ARCH=riscv +endif +ifneq (,$(findstring 86,$(DEB_HOST_GNU_CPU))) +export ARCH=x86 +endif + +PARALLEL_BUILD=-j $(shell echo $$(($$(nproc) * 2))) + +override_dh_auto_build: + $(MAKE) defconfig + $(MAKE) $(PARALLEL_BUILD) -C tools/testing/selftests/ ${KSELFTEST_ARGS} + +override_dh_auto_install: + mkdir -p ${kselftest_install_dir} + cd tools/testing/selftests/ && KSFT_INSTALL_PATH=${kselftest_install_dir} $(MAKE) $(PARALLEL_BUILD) install ${KSELFTEST_ARGS} + +override_dh_auto_clean: + rm -rf ${deb_top_dir}/kselftest/ + +%: + CFLAGS= LDFLAGS= dh $@ --parallel diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc new file mode 100644 index 0000000..46ca282 --- /dev/null +++ b/meta/recipes-kernel/kselftest/kselftest.inc @@ -0,0 +1,61 @@ +# Kselftest package for Linux +# +# This software is a part of ISAR. +# Copyright (c) Mentor Graphics, a Siemens Business, 2020 +# +# SPDX-License-Identifier: MIT + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +# Some test-cases like memfd compilation failed in cross-compilation. +# Force native compilation for now to have consistent output across +# ISAR native/cross compilation setups. +ISAR_CROSS_COMPILE = "0" + +DESCRIPTION ?= "Kernel selftests from Linux kernel ${PV}" + +DEBIAN_BUILD_DEPENDS ?= " \ + rsync, \ + flex, \ + bison, \ + fuse, \ + libelf-dev:native, \ + libcap-ng-dev:native, \ + libpopt-dev:native, \ + libcap-dev:native, \ + libmount-dev:native, \ + libnuma-dev:native, \ + libfuse-dev:native, \ + libmnl-dev:native, \ + pkg-config, \ + clang:native, \ + llvm:native, \ +" + +SRC_URI += "file://debian" +S = "${WORKDIR}/linux-${PV}" + +KSELFTEST_TARGETS ?= "" +KSELFTEST_SKIP_TARGETS ?= "" +KSELFTEST_FORCE_TARGETS ?= "0" + +inherit dpkg + +do_prepare_build() { + cp -rf ${WORKDIR}/debian ${S}/debian + deb_create_compat + deb_create_control + deb_add_changelog +} + +dpkg_runbuild_prepend() { + if [ -n "${KSELFTEST_TARGETS}" ];then + export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\"" + fi + if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then + export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1" + fi + if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then + export KSELFTEST_ARGS="${KSELFTEST_ARGS} SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" + fi +} -- 2.17.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] Add recipe for linux kselftest 2020-05-19 11:01 ` [PATCH v2] " Vijai Kumar K @ 2020-05-19 11:44 ` Jan Kiszka 2020-05-28 19:55 ` Baurzhan Ismagulov 1 sibling, 0 replies; 11+ messages in thread From: Jan Kiszka @ 2020-05-19 11:44 UTC (permalink / raw) To: Vijai Kumar K, isar-users On 19.05.20 13:01, Vijai Kumar K wrote: > Kselftest is a set of unit and regression tests under the > tools/testing/selftests/ directory of the Linux kernel. These are used > for testing individual code paths in the kernel. > > Kselftest is not debianized and is not available as part of the official > Debian repository. > > This patch provides a recipe to build kselftest from the linux source of > your choice. > > Sometimes developers/testers tend to use the latest version of selftests > from Linux upstream stable releases for testing and hence the need for a > separate recipe instead of being part of the linux recipe of ISAR. > > Some kselftest test cases build are known to break in certain linux > versions, this has to be addressed upstream. Right now kselftest build > succeeds even if atleast one of the testcase case build succeeds. > > You can change that by setting KSELFTEST_FORCE_TARGETS=1. > > TARGETS, TARGETS_SKIP, FORCE_TARGETS can be set using the appropriate > KSELFTEST_* recipe variable. > > Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com> > --- > Changes since v1: > - Addressed review comments in v1 > - Used debianize APIs for control, compat and changelog. > - Moved Depends & S definitions to include file. > - Added cross compilation bits in rules. > - Change clang, llvm to clang:native & llvm:native > > .../kselftest/kselftest_5.6.13.bb | 11 ++++ > .../kselftest/files/debian/rules | 41 +++++++++++++ > meta/recipes-kernel/kselftest/kselftest.inc | 61 +++++++++++++++++++ > 3 files changed, 113 insertions(+) > create mode 100644 meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > create mode 100755 meta/recipes-kernel/kselftest/files/debian/rules > create mode 100644 meta/recipes-kernel/kselftest/kselftest.inc > > diff --git a/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > new file mode 100644 > index 0000000..0c9818a > --- /dev/null > +++ b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > @@ -0,0 +1,11 @@ > +# Kselftest package > +# > +# This software is a part of ISAR. > +# Copyright (c) Mentor Graphics, a Siemens business, 2020 > +# > +# SPDX-License-Identifier: MIT > + > +require recipes-kernel/kselftest/kselftest.inc > + > +SRC_URI += "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${PV}.tar.xz" > +SRC_URI[sha256sum] = "f125d79c8f6974213638787adcad6b575bbd35a05851802fd83f622ec18ff987" > diff --git a/meta/recipes-kernel/kselftest/files/debian/rules b/meta/recipes-kernel/kselftest/files/debian/rules > new file mode 100755 > index 0000000..776d341 > --- /dev/null > +++ b/meta/recipes-kernel/kselftest/files/debian/rules > @@ -0,0 +1,41 @@ > +#!/usr/bin/make -f > + > +# Debian rules for Kselftest build > +# > +# This software is a part of ISAR. > +# Copyright (c) Mentor, A Siemens Business > +# > +# SPDX-License-Identifier: MIT > + > +deb_top_dir:=$(CURDIR)/debian > +kselftest_install_dir :=$(deb_top_dir)/kselftest/usr/libexec/kselftest > +export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- > + > +ifeq ($(DEB_HOST_GNU_CPU), arm) > +export ARCH=arm > +endif > +ifeq ($(DEB_HOST_GNU_CPU), aarch64) > +export ARCH=arm64 > +endif > +ifeq ($(DEB_HOST_GNU_CPU), riscv64) > +export ARCH=riscv > +endif > +ifneq (,$(findstring 86,$(DEB_HOST_GNU_CPU))) > +export ARCH=x86 > +endif > + > +PARALLEL_BUILD=-j $(shell echo $$(($$(nproc) * 2))) > + > +override_dh_auto_build: > + $(MAKE) defconfig > + $(MAKE) $(PARALLEL_BUILD) -C tools/testing/selftests/ ${KSELFTEST_ARGS} > + > +override_dh_auto_install: > + mkdir -p ${kselftest_install_dir} > + cd tools/testing/selftests/ && KSFT_INSTALL_PATH=${kselftest_install_dir} $(MAKE) $(PARALLEL_BUILD) install ${KSELFTEST_ARGS} > + > +override_dh_auto_clean: > + rm -rf ${deb_top_dir}/kselftest/ > + > +%: > + CFLAGS= LDFLAGS= dh $@ --parallel > diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc > new file mode 100644 > index 0000000..46ca282 > --- /dev/null > +++ b/meta/recipes-kernel/kselftest/kselftest.inc > @@ -0,0 +1,61 @@ > +# Kselftest package for Linux > +# > +# This software is a part of ISAR. > +# Copyright (c) Mentor Graphics, a Siemens Business, 2020 > +# > +# SPDX-License-Identifier: MIT > + > +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" > + > +# Some test-cases like memfd compilation failed in cross-compilation. > +# Force native compilation for now to have consistent output across > +# ISAR native/cross compilation setups. > +ISAR_CROSS_COMPILE = "0" > + > +DESCRIPTION ?= "Kernel selftests from Linux kernel ${PV}" > + > +DEBIAN_BUILD_DEPENDS ?= " \ > + rsync, \ > + flex, \ > + bison, \ > + fuse, \ > + libelf-dev:native, \ > + libcap-ng-dev:native, \ > + libpopt-dev:native, \ > + libcap-dev:native, \ > + libmount-dev:native, \ > + libnuma-dev:native, \ > + libfuse-dev:native, \ > + libmnl-dev:native, \ > + pkg-config, \ > + clang:native, \ > + llvm:native, \ > +" > + > +SRC_URI += "file://debian" > +S = "${WORKDIR}/linux-${PV}" > + > +KSELFTEST_TARGETS ?= "" > +KSELFTEST_SKIP_TARGETS ?= "" > +KSELFTEST_FORCE_TARGETS ?= "0" > + > +inherit dpkg > + > +do_prepare_build() { > + cp -rf ${WORKDIR}/debian ${S}/debian > + deb_create_compat > + deb_create_control > + deb_add_changelog Minor: those three (and only these) are also run when just calling deb_debianize. Rules will be skipped as you supplied that already. > +} > + > +dpkg_runbuild_prepend() { > + if [ -n "${KSELFTEST_TARGETS}" ];then > + export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\"" > + fi > + if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then > + export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1" > + fi > + if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then > + export KSELFTEST_ARGS="${KSELFTEST_ARGS} SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" > + fi > +} > LGTM, Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] Add recipe for linux kselftest 2020-05-19 11:01 ` [PATCH v2] " Vijai Kumar K 2020-05-19 11:44 ` Jan Kiszka @ 2020-05-28 19:55 ` Baurzhan Ismagulov 2020-05-28 20:36 ` vijai kumar 1 sibling, 1 reply; 11+ messages in thread From: Baurzhan Ismagulov @ 2020-05-28 19:55 UTC (permalink / raw) To: isar-users Hello Vijai Kumar, On Tue, May 19, 2020 at 04:31:47PM +0530, Vijai Kumar K wrote: > Kselftest is a set of unit and regression tests under the > tools/testing/selftests/ directory of the Linux kernel. These are used > for testing individual code paths in the kernel. Thanks, this is a useful addition. I'd suggest to address Jan's point and replace the individual commands with deb_debianize to provide a good in-tree example of using that functionality. To prevent bit rot, I think every component in the mainline should have a test case. We could add the package to e.g. isar-image-debug and build e.g. mc:qemuamd64-buster:isar-image-debug instead of mc:qemuamd64-buster:isar-image-base. What do you think? With kind regards, Baurzhan. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] Add recipe for linux kselftest 2020-05-28 19:55 ` Baurzhan Ismagulov @ 2020-05-28 20:36 ` vijai kumar 2020-05-29 10:15 ` [PATCH v3] " Vijai Kumar K 0 siblings, 1 reply; 11+ messages in thread From: vijai kumar @ 2020-05-28 20:36 UTC (permalink / raw) To: isar-users [-- Attachment #1: Type: text/plain, Size: 1364 bytes --] On Fri, May 29, 2020 at 1:25 AM Baurzhan Ismagulov <ibr@radix50.net> wrote: > Hello Vijai Kumar, > > On Tue, May 19, 2020 at 04:31:47PM +0530, Vijai Kumar K wrote: > > Kselftest is a set of unit and regression tests under the > > tools/testing/selftests/ directory of the Linux kernel. These are used > > for testing individual code paths in the kernel. > > Thanks, this is a useful addition. > > I'd suggest to address Jan's point and replace the individual commands with > deb_debianize to provide a good in-tree example of using that > functionality. > Sure. We could use deb_debianize. Will address in v3. To prevent bit rot, I think every component in the mainline should have a > test > case. We could add the package to e.g. isar-image-debug and build e.g. > mc:qemuamd64-buster:isar-image-debug instead of > mc:qemuamd64-buster:isar-image-base. > What do you think? > Looks good to me. Will address it in v3. Thanks, Vijai Kumar K > > With kind regards, > Baurzhan. > > -- > You received this message because you are subscribed to the Google Groups > "isar-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to isar-users+unsubscribe@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/isar-users/20200528195502.t3o7wypwck4gi4tr%40yssyq.m.ilbers.de > . > [-- Attachment #2: Type: text/html, Size: 2488 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3] Add recipe for linux kselftest 2020-05-28 20:36 ` vijai kumar @ 2020-05-29 10:15 ` Vijai Kumar K 2020-10-13 10:03 ` Jan Kiszka 0 siblings, 1 reply; 11+ messages in thread From: Vijai Kumar K @ 2020-05-29 10:15 UTC (permalink / raw) To: isar-users, ibr; +Cc: Vijai Kumar K Kselftest is a set of unit and regression tests under the tools/testing/selftests/ directory of the Linux kernel. These are used for testing individual code paths in the kernel. Kselftest is not debianized and is not available as part of the official Debian repository. This patch provides a recipe to build kselftest from the linux source of your choice. Sometimes developers/testers tend to use the latest version of selftests from Linux upstream stable releases for testing and hence the need for a separate recipe instead of being part of the linux recipe of ISAR. Some kselftest test cases build are known to break in certain linux versions, this has to be addressed upstream. Right now kselftest build succeeds even if atleast one of the testcase case build succeeds. You can change that by setting KSELFTEST_FORCE_TARGETS=1. TARGETS, TARGETS_SKIP, FORCE_TARGETS can be set using the appropriate KSELFTEST_* recipe variable. Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com> --- Changes since v2: - Use deb_debianize instead of individual calls for changelog, compat & control. - Add package to isar-image-debug Changes since v1: - Addressed review comments in v1 - Used debianize APIs for control, compat and changelog. - Moved Depends & S definitions to include file. - Added cross compilation bits in rules. - Change clang, llvm to clang:native & llvm:native .../recipes-core/images/isar-image-debug.bb | 2 + .../kselftest/kselftest_5.6.13.bb | 11 ++++ meta/recipes-kernel/kselftest/files/rules | 41 +++++++++++++ meta/recipes-kernel/kselftest/kselftest.inc | 59 +++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb create mode 100755 meta/recipes-kernel/kselftest/files/rules create mode 100644 meta/recipes-kernel/kselftest/kselftest.inc diff --git a/meta-isar/recipes-core/images/isar-image-debug.bb b/meta-isar/recipes-core/images/isar-image-debug.bb index 791d623..d0fe331 100644 --- a/meta-isar/recipes-core/images/isar-image-debug.bb +++ b/meta-isar/recipes-core/images/isar-image-debug.bb @@ -7,3 +7,5 @@ require recipes-core/images/isar-image-base.bb IMAGE_PREINSTALL += "gdb \ strace" + +IMAGE_INSTALL += "kselftest" diff --git a/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb new file mode 100644 index 0000000..0c9818a --- /dev/null +++ b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb @@ -0,0 +1,11 @@ +# Kselftest package +# +# This software is a part of ISAR. +# Copyright (c) Mentor Graphics, a Siemens business, 2020 +# +# SPDX-License-Identifier: MIT + +require recipes-kernel/kselftest/kselftest.inc + +SRC_URI += "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${PV}.tar.xz" +SRC_URI[sha256sum] = "f125d79c8f6974213638787adcad6b575bbd35a05851802fd83f622ec18ff987" diff --git a/meta/recipes-kernel/kselftest/files/rules b/meta/recipes-kernel/kselftest/files/rules new file mode 100755 index 0000000..776d341 --- /dev/null +++ b/meta/recipes-kernel/kselftest/files/rules @@ -0,0 +1,41 @@ +#!/usr/bin/make -f + +# Debian rules for Kselftest build +# +# This software is a part of ISAR. +# Copyright (c) Mentor, A Siemens Business +# +# SPDX-License-Identifier: MIT + +deb_top_dir:=$(CURDIR)/debian +kselftest_install_dir :=$(deb_top_dir)/kselftest/usr/libexec/kselftest +export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- + +ifeq ($(DEB_HOST_GNU_CPU), arm) +export ARCH=arm +endif +ifeq ($(DEB_HOST_GNU_CPU), aarch64) +export ARCH=arm64 +endif +ifeq ($(DEB_HOST_GNU_CPU), riscv64) +export ARCH=riscv +endif +ifneq (,$(findstring 86,$(DEB_HOST_GNU_CPU))) +export ARCH=x86 +endif + +PARALLEL_BUILD=-j $(shell echo $$(($$(nproc) * 2))) + +override_dh_auto_build: + $(MAKE) defconfig + $(MAKE) $(PARALLEL_BUILD) -C tools/testing/selftests/ ${KSELFTEST_ARGS} + +override_dh_auto_install: + mkdir -p ${kselftest_install_dir} + cd tools/testing/selftests/ && KSFT_INSTALL_PATH=${kselftest_install_dir} $(MAKE) $(PARALLEL_BUILD) install ${KSELFTEST_ARGS} + +override_dh_auto_clean: + rm -rf ${deb_top_dir}/kselftest/ + +%: + CFLAGS= LDFLAGS= dh $@ --parallel diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc new file mode 100644 index 0000000..ca9b882 --- /dev/null +++ b/meta/recipes-kernel/kselftest/kselftest.inc @@ -0,0 +1,59 @@ +# Kselftest package for Linux +# +# This software is a part of ISAR. +# Copyright (c) Mentor Graphics, a Siemens Business, 2020 +# +# SPDX-License-Identifier: MIT + +inherit dpkg + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +# Some test-cases like memfd compilation failed in cross-compilation. +# Force native compilation for now to have consistent output across +# ISAR native/cross compilation setups. +ISAR_CROSS_COMPILE = "0" + +DESCRIPTION ?= "Kernel selftests from Linux kernel ${PV}" + +DEBIAN_BUILD_DEPENDS ?= " \ + rsync, \ + flex, \ + bison, \ + fuse, \ + libelf-dev:native, \ + libcap-ng-dev:native, \ + libpopt-dev:native, \ + libcap-dev:native, \ + libmount-dev:native, \ + libnuma-dev:native, \ + libfuse-dev:native, \ + libmnl-dev:native, \ + pkg-config, \ + clang:native, \ + llvm:native, \ +" + +SRC_URI += "file://rules" +S = "${WORKDIR}/linux-${PV}" + +KSELFTEST_TARGETS ?= "" +KSELFTEST_SKIP_TARGETS ?= "" +KSELFTEST_FORCE_TARGETS ?= "0" + +do_prepare_build[cleandirs] += "${S}/debian" +do_prepare_build() { + deb_debianize +} + +dpkg_runbuild_prepend() { + if [ -n "${KSELFTEST_TARGETS}" ];then + export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\"" + fi + if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then + export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1" + fi + if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then + export KSELFTEST_ARGS="${KSELFTEST_ARGS} SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" + fi +} -- 2.17.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3] Add recipe for linux kselftest 2020-05-29 10:15 ` [PATCH v3] " Vijai Kumar K @ 2020-10-13 10:03 ` Jan Kiszka 2020-10-14 6:18 ` vijaikumar....@gmail.com 0 siblings, 1 reply; 11+ messages in thread From: Jan Kiszka @ 2020-10-13 10:03 UTC (permalink / raw) To: Vijai Kumar K, isar-users, ibr On 29.05.20 12:15, Vijai Kumar K wrote: > Kselftest is a set of unit and regression tests under the > tools/testing/selftests/ directory of the Linux kernel. These are used > for testing individual code paths in the kernel. > > Kselftest is not debianized and is not available as part of the official > Debian repository. > > This patch provides a recipe to build kselftest from the linux source of > your choice. > > Sometimes developers/testers tend to use the latest version of selftests > from Linux upstream stable releases for testing and hence the need for a > separate recipe instead of being part of the linux recipe of ISAR. > > Some kselftest test cases build are known to break in certain linux > versions, this has to be addressed upstream. Right now kselftest build > succeeds even if atleast one of the testcase case build succeeds. > > You can change that by setting KSELFTEST_FORCE_TARGETS=1. > > TARGETS, TARGETS_SKIP, FORCE_TARGETS can be set using the appropriate > KSELFTEST_* recipe variable. > > Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com> > --- > Changes since v2: > - Use deb_debianize instead of individual calls for changelog, compat & control. > - Add package to isar-image-debug > > Changes since v1: > - Addressed review comments in v1 > - Used debianize APIs for control, compat and changelog. > - Moved Depends & S definitions to include file. > - Added cross compilation bits in rules. > - Change clang, llvm to clang:native & llvm:native > .../recipes-core/images/isar-image-debug.bb | 2 + > .../kselftest/kselftest_5.6.13.bb | 11 ++++ > meta/recipes-kernel/kselftest/files/rules | 41 +++++++++++++ > meta/recipes-kernel/kselftest/kselftest.inc | 59 +++++++++++++++++++ > 4 files changed, 113 insertions(+) > create mode 100644 meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > create mode 100755 meta/recipes-kernel/kselftest/files/rules > create mode 100644 meta/recipes-kernel/kselftest/kselftest.inc > > diff --git a/meta-isar/recipes-core/images/isar-image-debug.bb b/meta-isar/recipes-core/images/isar-image-debug.bb > index 791d623..d0fe331 100644 > --- a/meta-isar/recipes-core/images/isar-image-debug.bb > +++ b/meta-isar/recipes-core/images/isar-image-debug.bb > @@ -7,3 +7,5 @@ require recipes-core/images/isar-image-base.bb > > IMAGE_PREINSTALL += "gdb \ > strace" > + > +IMAGE_INSTALL += "kselftest" > diff --git a/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > new file mode 100644 > index 0000000..0c9818a > --- /dev/null > +++ b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > @@ -0,0 +1,11 @@ > +# Kselftest package > +# > +# This software is a part of ISAR. > +# Copyright (c) Mentor Graphics, a Siemens business, 2020 > +# > +# SPDX-License-Identifier: MIT > + > +require recipes-kernel/kselftest/kselftest.inc > + > +SRC_URI += "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${PV}.tar.xz" > +SRC_URI[sha256sum] = "f125d79c8f6974213638787adcad6b575bbd35a05851802fd83f622ec18ff987" > diff --git a/meta/recipes-kernel/kselftest/files/rules b/meta/recipes-kernel/kselftest/files/rules > new file mode 100755 > index 0000000..776d341 > --- /dev/null > +++ b/meta/recipes-kernel/kselftest/files/rules > @@ -0,0 +1,41 @@ > +#!/usr/bin/make -f > + > +# Debian rules for Kselftest build > +# > +# This software is a part of ISAR. > +# Copyright (c) Mentor, A Siemens Business > +# > +# SPDX-License-Identifier: MIT > + > +deb_top_dir:=$(CURDIR)/debian > +kselftest_install_dir :=$(deb_top_dir)/kselftest/usr/libexec/kselftest > +export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- > + > +ifeq ($(DEB_HOST_GNU_CPU), arm) > +export ARCH=arm > +endif > +ifeq ($(DEB_HOST_GNU_CPU), aarch64) > +export ARCH=arm64 > +endif > +ifeq ($(DEB_HOST_GNU_CPU), riscv64) > +export ARCH=riscv > +endif > +ifneq (,$(findstring 86,$(DEB_HOST_GNU_CPU))) > +export ARCH=x86 > +endif > + > +PARALLEL_BUILD=-j $(shell echo $$(($$(nproc) * 2))) > + > +override_dh_auto_build: > + $(MAKE) defconfig > + $(MAKE) $(PARALLEL_BUILD) -C tools/testing/selftests/ ${KSELFTEST_ARGS} > + > +override_dh_auto_install: > + mkdir -p ${kselftest_install_dir} > + cd tools/testing/selftests/ && KSFT_INSTALL_PATH=${kselftest_install_dir} $(MAKE) $(PARALLEL_BUILD) install ${KSELFTEST_ARGS} > + > +override_dh_auto_clean: > + rm -rf ${deb_top_dir}/kselftest/ > + > +%: > + CFLAGS= LDFLAGS= dh $@ --parallel > diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc > new file mode 100644 > index 0000000..ca9b882 > --- /dev/null > +++ b/meta/recipes-kernel/kselftest/kselftest.inc > @@ -0,0 +1,59 @@ > +# Kselftest package for Linux > +# > +# This software is a part of ISAR. > +# Copyright (c) Mentor Graphics, a Siemens Business, 2020 > +# > +# SPDX-License-Identifier: MIT > + > +inherit dpkg > + > +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" > + > +# Some test-cases like memfd compilation failed in cross-compilation. > +# Force native compilation for now to have consistent output across > +# ISAR native/cross compilation setups. > +ISAR_CROSS_COMPILE = "0" > + > +DESCRIPTION ?= "Kernel selftests from Linux kernel ${PV}" > + > +DEBIAN_BUILD_DEPENDS ?= " \ > + rsync, \ > + flex, \ > + bison, \ > + fuse, \ > + libelf-dev:native, \ > + libcap-ng-dev:native, \ > + libpopt-dev:native, \ > + libcap-dev:native, \ > + libmount-dev:native, \ > + libnuma-dev:native, \ > + libfuse-dev:native, \ > + libmnl-dev:native, \ > + pkg-config, \ > + clang:native, \ > + llvm:native, \ > +" > + > +SRC_URI += "file://rules" > +S = "${WORKDIR}/linux-${PV}" > + > +KSELFTEST_TARGETS ?= "" > +KSELFTEST_SKIP_TARGETS ?= "" > +KSELFTEST_FORCE_TARGETS ?= "0" > + > +do_prepare_build[cleandirs] += "${S}/debian" > +do_prepare_build() { > + deb_debianize > +} > + > +dpkg_runbuild_prepend() { > + if [ -n "${KSELFTEST_TARGETS}" ];then > + export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\"" > + fi > + if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then > + export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1" > + fi > + if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then > + export KSELFTEST_ARGS="${KSELFTEST_ARGS} SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" > + fi > +} > Unless I'm missing something right now, this still lacks a test case. Jan -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3] Add recipe for linux kselftest 2020-10-13 10:03 ` Jan Kiszka @ 2020-10-14 6:18 ` vijaikumar....@gmail.com 0 siblings, 0 replies; 11+ messages in thread From: vijaikumar....@gmail.com @ 2020-10-14 6:18 UTC (permalink / raw) To: isar-users [-- Attachment #1.1: Type: text/plain, Size: 7104 bytes --] On Tuesday, October 13, 2020 at 3:33:35 PM UTC+5:30 Jan Kiszka wrote: > On 29.05.20 12:15, Vijai Kumar K wrote: > > Kselftest is a set of unit and regression tests under the > > tools/testing/selftests/ directory of the Linux kernel. These are used > > for testing individual code paths in the kernel. > > > > Kselftest is not debianized and is not available as part of the official > > Debian repository. > > > > This patch provides a recipe to build kselftest from the linux source of > > your choice. > > > > Sometimes developers/testers tend to use the latest version of selftests > > from Linux upstream stable releases for testing and hence the need for a > > separate recipe instead of being part of the linux recipe of ISAR. > > > > Some kselftest test cases build are known to break in certain linux > > versions, this has to be addressed upstream. Right now kselftest build > > succeeds even if atleast one of the testcase case build succeeds. > > > > You can change that by setting KSELFTEST_FORCE_TARGETS=1. > > > > TARGETS, TARGETS_SKIP, FORCE_TARGETS can be set using the appropriate > > KSELFTEST_* recipe variable. > > > > Signed-off-by: Vijai Kumar K <Vijaikumar_...@mentor.com> > > --- > > Changes since v2: > > - Use deb_debianize instead of individual calls for changelog, compat & > control. > > - Add package to isar-image-debug > > > > Changes since v1: > > - Addressed review comments in v1 > > - Used debianize APIs for control, compat and changelog. > > - Moved Depends & S definitions to include file. > > - Added cross compilation bits in rules. > > - Change clang, llvm to clang:native & llvm:native > > .../recipes-core/images/isar-image-debug.bb | 2 + > > .../kselftest/kselftest_5.6.13.bb | 11 ++++ > > meta/recipes-kernel/kselftest/files/rules | 41 +++++++++++++ > > meta/recipes-kernel/kselftest/kselftest.inc | 59 +++++++++++++++++++ > > 4 files changed, 113 insertions(+) > > create mode 100644 meta-isar/recipes-kernel/kselftest/ > kselftest_5.6.13.bb > > create mode 100755 meta/recipes-kernel/kselftest/files/rules > > create mode 100644 meta/recipes-kernel/kselftest/kselftest.inc > > > > diff --git a/meta-isar/recipes-core/images/isar-image-debug.bb > b/meta-isar/recipes-core/images/isar-image-debug.bb > > index 791d623..d0fe331 100644 > > --- a/meta-isar/recipes-core/images/isar-image-debug.bb > > +++ b/meta-isar/recipes-core/images/isar-image-debug.bb > > @@ -7,3 +7,5 @@ require recipes-core/images/isar-image-base.bb > > > > IMAGE_PREINSTALL += "gdb \ > > strace" > > + > > +IMAGE_INSTALL += "kselftest" > > diff --git a/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > > new file mode 100644 > > index 0000000..0c9818a > > --- /dev/null > > +++ b/meta-isar/recipes-kernel/kselftest/kselftest_5.6.13.bb > > @@ -0,0 +1,11 @@ > > +# Kselftest package > > +# > > +# This software is a part of ISAR. > > +# Copyright (c) Mentor Graphics, a Siemens business, 2020 > > +# > > +# SPDX-License-Identifier: MIT > > + > > +require recipes-kernel/kselftest/kselftest.inc > > + > > +SRC_URI += " > https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${PV}.tar.xz" > > +SRC_URI[sha256sum] = > "f125d79c8f6974213638787adcad6b575bbd35a05851802fd83f622ec18ff987" > > diff --git a/meta/recipes-kernel/kselftest/files/rules > b/meta/recipes-kernel/kselftest/files/rules > > new file mode 100755 > > index 0000000..776d341 > > --- /dev/null > > +++ b/meta/recipes-kernel/kselftest/files/rules > > @@ -0,0 +1,41 @@ > > +#!/usr/bin/make -f > > + > > +# Debian rules for Kselftest build > > +# > > +# This software is a part of ISAR. > > +# Copyright (c) Mentor, A Siemens Business > > +# > > +# SPDX-License-Identifier: MIT > > + > > +deb_top_dir:=$(CURDIR)/debian > > +kselftest_install_dir :=$(deb_top_dir)/kselftest/usr/libexec/kselftest > > +export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- > > + > > +ifeq ($(DEB_HOST_GNU_CPU), arm) > > +export ARCH=arm > > +endif > > +ifeq ($(DEB_HOST_GNU_CPU), aarch64) > > +export ARCH=arm64 > > +endif > > +ifeq ($(DEB_HOST_GNU_CPU), riscv64) > > +export ARCH=riscv > > +endif > > +ifneq (,$(findstring 86,$(DEB_HOST_GNU_CPU))) > > +export ARCH=x86 > > +endif > > + > > +PARALLEL_BUILD=-j $(shell echo $$(($$(nproc) * 2))) > > + > > +override_dh_auto_build: > > + $(MAKE) defconfig > > + $(MAKE) $(PARALLEL_BUILD) -C tools/testing/selftests/ > ${KSELFTEST_ARGS} > > + > > +override_dh_auto_install: > > + mkdir -p ${kselftest_install_dir} > > + cd tools/testing/selftests/ && > KSFT_INSTALL_PATH=${kselftest_install_dir} $(MAKE) $(PARALLEL_BUILD) > install ${KSELFTEST_ARGS} > > + > > +override_dh_auto_clean: > > + rm -rf ${deb_top_dir}/kselftest/ > > + > > +%: > > + CFLAGS= LDFLAGS= dh $@ --parallel > > diff --git a/meta/recipes-kernel/kselftest/kselftest.inc > b/meta/recipes-kernel/kselftest/kselftest.inc > > new file mode 100644 > > index 0000000..ca9b882 > > --- /dev/null > > +++ b/meta/recipes-kernel/kselftest/kselftest.inc > > @@ -0,0 +1,59 @@ > > +# Kselftest package for Linux > > +# > > +# This software is a part of ISAR. > > +# Copyright (c) Mentor Graphics, a Siemens Business, 2020 > > +# > > +# SPDX-License-Identifier: MIT > > + > > +inherit dpkg > > + > > +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" > > + > > +# Some test-cases like memfd compilation failed in cross-compilation. > > +# Force native compilation for now to have consistent output across > > +# ISAR native/cross compilation setups. > > +ISAR_CROSS_COMPILE = "0" > > + > > +DESCRIPTION ?= "Kernel selftests from Linux kernel ${PV}" > > + > > +DEBIAN_BUILD_DEPENDS ?= " \ > > + rsync, \ > > + flex, \ > > + bison, \ > > + fuse, \ > > + libelf-dev:native, \ > > + libcap-ng-dev:native, \ > > + libpopt-dev:native, \ > > + libcap-dev:native, \ > > + libmount-dev:native, \ > > + libnuma-dev:native, \ > > + libfuse-dev:native, \ > > + libmnl-dev:native, \ > > + pkg-config, \ > > + clang:native, \ > > + llvm:native, \ > > +" > > + > > +SRC_URI += "file://rules" > > +S = "${WORKDIR}/linux-${PV}" > > + > > +KSELFTEST_TARGETS ?= "" > > +KSELFTEST_SKIP_TARGETS ?= "" > > +KSELFTEST_FORCE_TARGETS ?= "0" > > + > > +do_prepare_build[cleandirs] += "${S}/debian" > > +do_prepare_build() { > > + deb_debianize > > +} > > + > > +dpkg_runbuild_prepend() { > > + if [ -n "${KSELFTEST_TARGETS}" ];then > > + export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\"" > > + fi > > + if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then > > + export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1" > > + fi > > + if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then > > + export KSELFTEST_ARGS="${KSELFTEST_ARGS} > SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" > > + fi > > +} > > > > Unless I'm missing something right now, this still lacks a test case. > Yes. Somehow I never sent that version of patch. Will send it. > > Jan > > -- > Siemens AG, T RDA IOT > Corporate Competence Center Embedded Linux > [-- Attachment #1.2: Type: text/html, Size: 11490 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-10-14 6:18 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-05-18 12:05 [PATCH] Add recipe for linux kselftest Vijai Kumar K 2020-05-18 15:12 ` Jan Kiszka 2020-05-18 15:57 ` vijai kumar 2020-05-18 16:06 ` Jan Kiszka 2020-05-19 11:01 ` [PATCH v2] " Vijai Kumar K 2020-05-19 11:44 ` Jan Kiszka 2020-05-28 19:55 ` Baurzhan Ismagulov 2020-05-28 20:36 ` vijai kumar 2020-05-29 10:15 ` [PATCH v3] " Vijai Kumar K 2020-10-13 10:03 ` Jan Kiszka 2020-10-14 6:18 ` vijaikumar....@gmail.com
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox