Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp481666pxb; Mon, 8 Nov 2021 17:05:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCByPimnmAftjCurkJ2iu/xu7NQDOz2+km99eJenM+qlZPqtY4qj8Waa1EPzyNDXEm4aZW X-Received: by 2002:a05:6638:2045:: with SMTP id t5mr2512066jaj.127.1636419909182; Mon, 08 Nov 2021 17:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636419909; cv=none; d=google.com; s=arc-20160816; b=b0Bp9TQFsNGs5xkPbN25klgOV0nZkgNfVqCSL+jGKx3D3q4aE6W01PZaWynEJ9bNLY eQ57N68DKrAxaMmgoMzX/DxmMsKp5tWsPx0FZM21OufmQTRUx6y2B4B1HCyYhFhBtAkr bXLSROB/hwzWSI8hCqWokTaffRQE+slM8hhx7meLLWszbnlV6HMJR+XaditIoXfL3nGr k4ZKIXKo7SeTzWFMi/g1aPSvZZloAoTeHJHoHOJM/I86C4oKeiC3T3JEfK7Er2S9z06B BryiF4z6Sjb6Hvwp2la45ruVs15k8IysPxNRkf8ze3MtaJVH41onHRMdJT39NhADiHT0 fahw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LhWmxLU/whVC1IIpM4eIIhUa6gTfMbrTrr5lbH3cce8=; b=0vwVAG5ApilXAZ2HYy7kJqsd4l0H6B2SARZ88XEiCIa+EPgFEuO1T5s/lOmw1wWapf 4a0eu7XcBQYAZF+1S/M5mJY6RpJKjE+WFKzxzqFpZbbDkDM5QZggDjGzJGYqmuc53vnO oevg+EVVZRBfnyaIK9n9SumrmYnOtv0Mk97p2aQ/ZdpMeHwPhrjtIk/9GnzscS+uG4od 869l9clmKY8r0bl5Bmp0dKZo7MV+3aiAvtRHJgl3yOHO9tGk4BILyyDiQ7GasHgjksVo igugFY6lJEBpat6g5lPbrcKqHA4xDmBSmN9Yfhw79mnZeQ51wJAdJr0O1W6LhRouayIz IEcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="GrOJ/dTo"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si28117466iok.86.2021.11.08.17.04.56; Mon, 08 Nov 2021 17:05:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="GrOJ/dTo"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240711AbhKHWeS (ORCPT + 99 others); Mon, 8 Nov 2021 17:34:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:33154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239746AbhKHWeS (ORCPT ); Mon, 8 Nov 2021 17:34:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4DEA161994; Mon, 8 Nov 2021 22:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636410693; bh=0viScEuCXruHkpBXs/F8VA07Mw4ZXfpFWlr+/Q16EFA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GrOJ/dTo4cbHJ41cR59E2J35blfnM9QPx9/vS7LEQx3MKi5lW7mn7uB8xtvQulVa9 6a2wn4ZKWfI4bnVu28HSuc6VHQyni1QyD/97/3WQc8xOKzc7vjW91XOUwX2Hcb7YBO frB8nMOam3dob+t4EMdx4e/WJB7crDvPNlhhQN/zADe8VIaQ1BePVzLGWFhMiA9edh kzjwN99ZqG4tt5kAeo8derqw8AZvtXbHFnWlOh5ZUNe5E1O/S5lgor5VSQPSXd6ohF SRZ2XJccWB1TvKH7Ql+xLzREiJO44fOQtsQigKCurwe2EzxohWeaCo6lpTQ/2YW08L 3t5LZL4zVj4OA== Date: Mon, 8 Nov 2021 14:31:32 -0800 From: "Darrick J. Wong" To: Lukas Czerner Cc: fstests@vger.kernel.org, linux-ext4@vger.kernel.org, guan@eryu.me Subject: Re: [PATCH v2 1/2] common/rc: add _require_kernel_config and _has_kernel_config Message-ID: <20211108223132.GB24255@magnolia> References: <20211108151916.27845-1-lczerner@redhat.com> <20211108210423.28980-1-lczerner@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211108210423.28980-1-lczerner@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Nov 08, 2021 at 10:04:23PM +0100, Lukas Czerner wrote: > Add _require_kernel_config() and _has_kernel_config() helpers to check > whether a specific kernel configuration is enabled on the kernel. > > Signed-off-by: Lukas Czerner > --- > v2: Document KCONFIG_PATH in README > > README | 2 ++ > common/config | 1 + > common/rc | 29 +++++++++++++++++++++++++++++ > 3 files changed, 32 insertions(+) > > diff --git a/README b/README > index 63f0641a..e9284b22 100644 > --- a/README > +++ b/README > @@ -129,6 +129,8 @@ Preparing system for tests: > xfs_check to check the filesystem. As of August 2021, > xfs_repair finds all filesystem corruptions found by xfs_check, > and more, which means that xfs_check is no longer run by default. > + - Set KCONFIG_PATH to specify your preferred location of kernel > + config file. The indentation here looks kind of off, but the core logic looks correct. With that fixed: Reviewed-by: Darrick J. Wong --D > > - or add a case to the switch in common/config assigning > these variables based on the hostname of your test > diff --git a/common/config b/common/config > index 164381b7..e0a5c5df 100644 > --- a/common/config > +++ b/common/config > @@ -226,6 +226,7 @@ export OPENSSL_PROG="$(type -P openssl)" > export ACCTON_PROG="$(type -P accton)" > export E2IMAGE_PROG="$(type -P e2image)" > export BLKZONE_PROG="$(type -P blkzone)" > +export GZIP_PROG="$(type -P gzip)" > > # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled. > # newer systems have udevadm command but older systems like RHEL5 don't. > diff --git a/common/rc b/common/rc > index 0d261184..84154868 100644 > --- a/common/rc > +++ b/common/rc > @@ -4703,6 +4703,35 @@ _require_names_are_bytes() { > esac > } > > +_has_kernel_config() > +{ > + option=$1 > + uname=$(uname -r) > + config_list="$KCONFIG_PATH > + /proc/config.gz > + /lib/modules/$uname/build/.config > + /boot/config-$uname > + /lib/kernel/config-$uname" > + > + for config in $config_list; do > + [ ! -f $config ] && continue > + [ $config = "/proc/config.gz" ] && break > + grep -qE "^${option}=[my]" $config > + return > + done > + > + [ ! -f $config ] && _notrun "Could not locate kernel config file" > + > + # We can only get here with /proc/config.gz > + _require_command "$GZIP_PROG" gzip > + $GZIP_PROG -cd $config | grep -qE "^${option}=[my]" > +} > + > +_require_kernel_config() > +{ > + _has_kernel_config $1 || _notrun "Installed kernel not built with $1" > +} > + > init_rc > > ################################################################################ > -- > 2.31.1 >