From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6828154244872273920 X-Received: by 2002:a17:902:59d0:: with SMTP id d16mr15495728plj.181.1589803547275; Mon, 18 May 2020 05:05:47 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:902:44c:: with SMTP id 70ls3348673ple.10.gmail; Mon, 18 May 2020 05:05:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5dlTu6ZtGFLWUAgn25wTE2XHQozKwnpAQRW5JwBEHuWbzgEE3u+A4nIFMMdHgarotO3W8 X-Received: by 2002:a17:90a:2305:: with SMTP id f5mr19204250pje.57.1589803546791; Mon, 18 May 2020 05:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589803546; cv=none; d=google.com; s=arc-20160816; b=ExG3q8V12A4H4YbTHKlgyyAajfqMRndUNeHC1Ewp26p0MJrpyd0JNyc0Sp2wZVnd4Q hQ1nylKWm9ihNkliqb1a9WtxFgzSwYAslHwA1hDqzR0hmkTg4E9AHP2OJn5Nm7DpJqgo nzoi3pbEUNWL6Jw600jkUL/m261Fgx+8hW4dtsEhEY6CD3tgpl8X2qVSrNAZc1h+D228 Z81mHAU/huVNMRKap8oWIHGb9uS3WBJ5GkZZ+Vz0vaVRkyZhQc9F4YpBqvGIV6MU/s5E Z79hyYRazFOTp5OQjOBXvsuuF+OK4jaJ0xRBb37ZWWUl0yikO2j2DMclJA+U2WVqYBsm nWLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=nGoPL87q5SvBDCiGrYrlpyulNj+5AnW+P68f2BwXWTA=; b=V8Q/4E6DEHyQER1Mkp6mowfb23lTNu615xav5RKMex7MFO4DFSfQMfQjzXVRSvyBTp p16LgISgJBX8Pa/m0uUBHpwpcRkJjAX6snF8JBlWZ4UHv1SO+HAN4ZAAjwqhlaWO0neN 8SMvCq4EMT4S5P8jl0fwN/75waKk7BLw5lJIPLf9mSNu5vqyS8bIjcLAOSQnMUQYLADw D/FTEqJmDQ1v649bp4ETBY0PzNyVSu+YFhlP8hp14SJSOkQ5VW/ztF9ALN9dwrJmZQIu PQR0lr+ac8EvMGon9lZn8Vb8AwGpy+SnrF702JmBrjIHlkfK9YRTABxTlXueq97AfvOg vbbQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.129.153 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com. [68.232.129.153]) by gmr-mx.google.com with ESMTPS id e6si1264631pjp.3.2020.05.18.05.05.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 May 2020 05:05:46 -0700 (PDT) Received-SPF: pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.129.153 as permitted sender) client-ip=68.232.129.153; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.129.153 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com IronPort-SDR: UrZc9Mj2a6d3bhO5g/U1DiL3wfbSOfkMGwCceO//WTqHyTxFfODPTca6WYoUnTKEdoRlsgWHbf HOfxh+kN7Bzpjvccw3Dyz4sP/r10SFUzevGFudektZy+n6UNQQIiuJtWR5GiTIook37oYemi9/ 0zPBnnvP4B5vbwbcD0lXVfgM1GqtKeFTZRUoRkAcMwe4MVRSeoGXUQqzDomumvSzUMxCsooF0Z 8I6u9TqqTMHzyrydsng61cNGsoCXUmU2Xee71dzkStiE+Lyc2UpuAJ0K2Gi8HcNr1P8FZTFwMb rJw= X-IronPort-AV: E=Sophos;i="5.73,407,1583222400"; d="scan'208";a="50970652" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 18 May 2020 04:05:46 -0800 IronPort-SDR: BGcqPhjYTgCgoBUqh536+cGdJJHhh9MczpfIt8R7Gw+FgsmNnzi1rB5D46HQlnwmNQWq5pU0hD NKWlCbWz7Nx9X/rG5TY1+lFWrMkan64jOrK548b5kQ30BrRpEDcWwPnyuUnln6Mq4+qeCLz6qC zxsjaeL/eTXtjdIEtsL+7YOaHPHvbRI9tpni9axkhXDKtFQ2jOh5aHAvpQK1aUvUvOhS656KFj wLTeD/nKPXgmQ/+77Bq86vnSLhjgpyurgeM6KUIBbTQm2IXXLPUP9JCKOEg+b5MvB/aJMNwhPD vhs= From: Vijai Kumar K To: CC: Vijai Kumar K Subject: [PATCH] Add recipe for linux kselftest Date: Mon, 18 May 2020 17:35:26 +0530 Message-ID: <20200518120526.8279-1-Vijaikumar_Kanagarajan@mentor.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain Return-Path: Vijaikumar_Kanagarajan@mentor.com X-ClientProxiedBy: svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) To svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) X-TUID: rRbU8Kbzvxdb 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, \ + " + +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 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 + +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