From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6828154244872273920 X-Received: by 2002:a63:b146:: with SMTP id g6mr15280826pgp.396.1589817454694; Mon, 18 May 2020 08:57:34 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a63:5457:: with SMTP id e23ls2909199pgm.4.gmail; Mon, 18 May 2020 08:57:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycJkk+8ybSvdR+tiF6I8E8X547LEpOxNaIDTbDtxgEdhPZrWNGKsg6j018ZR3Q5PQV8JW/ X-Received: by 2002:a63:a062:: with SMTP id u34mr15827915pgn.62.1589817454093; Mon, 18 May 2020 08:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589817454; cv=none; d=google.com; s=arc-20160816; b=lPIYzm2ewU7KBYiFZuSLSHKuHBwspdFWfjV4hGaNbLq4T5yMp/MBUGgRkAevP0p86S GreTYuYiw2vio8lS+UhUNqIg/PnI9UD4xcF77kCJfu/qYicPOOzwYQmVTh41g2iYQ11g tCCLtHYHqLEkEoX+jek0mXbJyWCDefkBBSbUJ0ynT0VmktkEB0kqVSzoMYQPdIk3vyZW AqDmyl/uNcdJH+EG+qg39gs7SjhVk3z8PKgOcEBk0las5pw7/CpVyu0iIg9dm7CpE+SP PmncSbeVBStByQjedxfM6sugA1eBP4x+fy9zTeOtVGiDAhvDg8lnlT0NOERi0jWQJjhq rxeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=IguXMPMRieDJBLLP6IOINN8NiEpjpQ/Svm94nY0vItI=; b=WxYYFCScSQbAnatZkUZzcyGa7DSS5Nmq1kxVxOm1sIUalaasxP9zylqysujUkECFsF 2ajT79zInOowWAjb5BaIW71tac7+QI2+6WusQpzsPcF2XpA+CmIzKV8rLdIf/AZhhX1e T7gPupNdxWmUA8QpfFb3QCGsZis7B99JP2EFSHo6mVFcPiF64o5YTIFBj5xPM9Ke8fIa i0fF6kEtne3xkrB7CrN8YpX3aYXMoSzSEifhCi8e8Jrisj+dpqtUY3MWkd1OtFNEAiIT SgB+wPQ6eY96NebWweb6F2ANpyx7QsEbYAn06OA0ZYequfpegFCgYWLTVSR2NVREQigk zZiw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MhphYRv5; spf=pass (google.com: domain of vijaikumar.kanagarajan@gmail.com designates 2607:f8b0:4864:20::842 as permitted sender) smtp.mailfrom=vijaikumar.kanagarajan@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com. [2607:f8b0:4864:20::842]) by gmr-mx.google.com with ESMTPS id g23si790127pgi.5.2020.05.18.08.57.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2020 08:57:34 -0700 (PDT) Received-SPF: pass (google.com: domain of vijaikumar.kanagarajan@gmail.com designates 2607:f8b0:4864:20::842 as permitted sender) client-ip=2607:f8b0:4864:20::842; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MhphYRv5; spf=pass (google.com: domain of vijaikumar.kanagarajan@gmail.com designates 2607:f8b0:4864:20::842 as permitted sender) smtp.mailfrom=vijaikumar.kanagarajan@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: by mail-qt1-x842.google.com with SMTP id v4so8495626qte.3 for ; Mon, 18 May 2020 08:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IguXMPMRieDJBLLP6IOINN8NiEpjpQ/Svm94nY0vItI=; b=MhphYRv5PkynYYwntMLOfNfClSQ3tqijlPlq1sqAcN/p/zFOoSMkb/5xI/+Kcxezem YLLQgxr/e5OzvucdBkdpb0nzY0ugywvs9inMZaXLiuXgTFAX7gquuUz7SLU1ZKf0tYNw 91wUs2/3VJKMLdz/gTY/DJcN8ItlQ19UWZBzu2cwFXGkz/jHD3Q8z3MHoQbwI8JANLxH sKwFnp3i2GJWf9J30t1w6QMxDQpuXgbXUh0euuqLkGBtN24Q3ecGkj3JJ+ugwP1U3Ohu w3h42WaBbRmQSyZVGT6/1aTP/WFYFu3M2ADXSz9u3dfjb5k9pAQedVypxM1+9fLz4Iiw O1sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IguXMPMRieDJBLLP6IOINN8NiEpjpQ/Svm94nY0vItI=; b=lNe2Hls0Z+070EaL+FaYjiR/espHVoyJXj3ZUMtQSPh9dQcD3aNP0zvGIT+33XXjYF xOIFqAGPuHH6BAFD1KuDwye+0DaYp+MeorpD35pTlYXCno94xgh0tmlErQxZir24HdHl RN/Df61tXRfANu5sbF4pr2llIrfXYaZsb/qdPYcA9vd4jBtMDia0dew4pT1XzE3eU4WM T1Yc2PP6Pjy2bOWWJ2vcczw2WvqkSl3adE2hW4rZuVcLmQ5kb4oZrX0KJY0CCoJj/iaa z3BxcQv7xFbKho0hlHiXWw8wF1+oeSr9YAfTWGIU0SJ8Qkq83Mbds818gbbhZcT2UREe j0ZA== X-Gm-Message-State: AOAM531BAL3OQUluCvoobD+rdvI3WAa6xJrL+e9d2IJ0GOu/mJcie6mR /wtzuiUMCXbkSruSa2HKzgizBchW7dwjM5gCKJk= X-Received: by 2002:ac8:4403:: with SMTP id j3mr14488446qtn.186.1589817453220; Mon, 18 May 2020 08:57:33 -0700 (PDT) MIME-Version: 1.0 References: <20200518120526.8279-1-Vijaikumar_Kanagarajan@mentor.com> <42ea0194-db8d-09eb-2157-2b1af59bcad9@siemens.com> In-Reply-To: <42ea0194-db8d-09eb-2157-2b1af59bcad9@siemens.com> From: vijai kumar Date: Mon, 18 May 2020 21:27:21 +0530 Message-ID: Subject: Re: [PATCH] Add recipe for linux kselftest To: Jan Kiszka Cc: isar-users Content-Type: text/plain; charset="UTF-8" X-TUID: iHGSH9RK6DQO On Mon, May 18, 2020 at 8:43 PM Jan Kiszka 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 > > --- > > .../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 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 > > + > > +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.