Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp218799pxh; Tue, 9 Nov 2021 09:37:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwG3Znc22SO6ZLQ63aehpmfJ0pWspscyubg1D3Qug98iUetJjTSXrh+Kdw+qb+CyXauzDnb X-Received: by 2002:a05:6e02:547:: with SMTP id i7mr6561175ils.298.1636479435302; Tue, 09 Nov 2021 09:37:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636479435; cv=none; d=google.com; s=arc-20160816; b=GBNpPwrWLOoomdUJOwHyN4g0UY7ouJCvC7+75SE+ZItSldICKo7Ja2YQGYcfEP+GoY U99zsRYmjYIHXMZYs/HI2uFR6VdwZFcBj4viBnsiv8Xs3lqlrt4T2n/Ao673SDFkUS8V KYmTUymaG7UXs/Q9pp28lfz605c2oUYimL32ncR/3y9q1MSOGGlKEpCGum7WLeNfs39b xCcUkxEoC2+KoErPuZxqLhsLK54P/VU/gGW0dYY8ZeInYflMnQTO89eJQhzr7Lul/OPQ hIi81gtvoP+tw/yHuxA/E84RSlk3EFw3On5W3KwuJU6I1LCkEH7L3pUP3T57tApyRhkl WJ/w== 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=uZ2CfaW01xVgN1ZygvdOuFHBrDybXxpr4MGBndBh4eg=; b=Rpsp/oOakLCj03vmtaJCvhTe1YkpNKJFbqXdEWPW9W2H0dgZOBybw5LJqS0NXordzY sPu/PukyCZIljSLxUO9PSfquyefGX47fx9jdKKzQQrLM9ZJ3xsmMgs1YrYmPAPFyTysb K+DKRkPw/WHq38BTkNk7cGReD45r1v+UTw7IfrGfsA4e6DK+BRa4KRSFhT1G4u3ZRGx9 /wSP2SlqpgLdxwdbyDr8nnYbcVKtJ9ZLC5ENNuAV09BXukWCCKWO/NstNTTPMiuPRHd4 xVj5H8vXRaU6OZ0erNB1fWP9blbAL330ohvL2O5dDRTzLVqZMphNPzD6UhehR6MGkVSe f2Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LiLsE92B; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s12si5051367ilv.122.2021.11.09.09.36.23; Tue, 09 Nov 2021 09:37:15 -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=@redhat.com header.s=mimecast20190719 header.b=LiLsE92B; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244898AbhKIJbh (ORCPT + 99 others); Tue, 9 Nov 2021 04:31:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56941 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244897AbhKIJbh (ORCPT ); Tue, 9 Nov 2021 04:31:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636450131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uZ2CfaW01xVgN1ZygvdOuFHBrDybXxpr4MGBndBh4eg=; b=LiLsE92BEFnSJhOPtQQQRR5IJdC8vOwB0eGY7CAD/uHmb2Z8huX5oX/zWeqksIu4WT6Ii6 f01My/adf2oOqsEKMOXt8+uTGLlkkxTVKAAnjdoDfg4gYZclVN8i9Nnr4UxZw053THrjyW oX9xn/Tuv8p3e6sUjwBUASxuF0UPew0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-430-dVJnCn5qNKe3KOxoMI8KqA-1; Tue, 09 Nov 2021 04:28:49 -0500 X-MC-Unique: dVJnCn5qNKe3KOxoMI8KqA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D02218125C2; Tue, 9 Nov 2021 09:28:48 +0000 (UTC) Received: from work (unknown [10.40.195.65]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5918360C17; Tue, 9 Nov 2021 09:28:47 +0000 (UTC) Date: Tue, 9 Nov 2021 10:28:43 +0100 From: Lukas Czerner To: "Darrick J. Wong" 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: <20211109090855.n3nceaez73laqvze@work> References: <20211108151916.27845-1-lczerner@redhat.com> <20211108210423.28980-1-lczerner@redhat.com> <20211108223132.GB24255@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211108223132.GB24255@magnolia> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Nov 08, 2021 at 02:31:32PM -0800, Darrick J. Wong wrote: > 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. The file uses a mixture of tabs and spaces. In this case I used tabs, the bullet point above uses spaces, that's why it looks kind of off in the patch. Otherwise I used the same indentation as some other bullet points so I don't think there is anything to fix in this patch. > > With that fixed: > Reviewed-by: Darrick J. Wong Thanks for the review. -Lukas > > --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 > > >