From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D4D7C54E8E for ; Mon, 11 May 2020 18:32:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2119420736 for ; Mon, 11 May 2020 18:32:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2119420736 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A85A7900076; Mon, 11 May 2020 14:31:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A371E900036; Mon, 11 May 2020 14:31:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94D5A900076; Mon, 11 May 2020 14:31:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 7EA33900036 for ; Mon, 11 May 2020 14:31:59 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3573A1260 for ; Mon, 11 May 2020 18:31:59 +0000 (UTC) X-FDA: 76805282358.09.rate99_85afc2f0cf95e X-HE-Tag: rate99_85afc2f0cf95e X-Filterd-Recvd-Size: 6386 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Mon, 11 May 2020 18:31:58 +0000 (UTC) Received: by mail-pj1-f67.google.com with SMTP id hi11so8302308pjb.3 for ; Mon, 11 May 2020 11:31:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5XI6huZ8/68IV3V+dfcxfIXPMcxaK1o+Eheo7UEu6z4=; b=cSDuouDPwlILqz6jtOioRZB11hNasxNGqZ7+WRpYGtQm6FE2eZ3/y+OTWNJy9qN7gi p7LRYQnN2NbAEsVYTHeBWTbMIPBQIttB7sCCVnEz3B6OCFM4BhKIUlI+8QFdRmUC0Hx4 L6IC/MGIGN3SFmpZGsVf3rF0o53avGgIdSmRgT5YhXr8vttxYb3exK8t35441QNGxviv GlFcNGUKr/HMQFmJpIRVy2CggzfTz8CqDgD/4KZWr7rghzXxCUbhaSqjyQ/S8ymejDH2 UNm8aZDN1lnS69O75BFIsgu077+pSXXX0TGjm40dVtSdD9+ZOh2sGuG0DlGH47DUnR21 AqAQ== X-Gm-Message-State: AGi0PuaAAW2PFOjbcbTkFNU0wRvTzKrPfgMl6s+jV/GExT8HFrX/nBjg r/IeZjEq1ADHP6AhQU3O5ok= X-Google-Smtp-Source: APiQypJBdyCSHrHdNSwPrrMpX+IeBN7BoplK36lldntx1+VO+CkznBZq/KxCG3ByOwg/kdNYOBuwIA== X-Received: by 2002:a17:90b:3018:: with SMTP id hg24mr23689052pjb.130.1589221917631; Mon, 11 May 2020 11:31:57 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id cp22sm10790760pjb.28.2020.05.11.11.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 11:31:56 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id ACD8D40605; Mon, 11 May 2020 18:31:55 +0000 (UTC) Date: Mon, 11 May 2020 18:31:55 +0000 From: Luis Chamberlain To: Vlastimil Babka Cc: Andrew Morton , Kees Cook , Iurii Zaikin , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-mm@kvack.org, Ivan Teterevkov , Michal Hocko , David Rientjes , Matthew Wilcox , "Eric W . Biederman" , "Guilherme G . Piccoli" , Alexey Dobriyan , Thomas Gleixner , Greg Kroah-Hartman , Christian Brauner , Masami Hiramatsu Subject: Re: [PATCH v3 5/5] lib/test_sysctl: support testing of sysctl. boot parameter Message-ID: <20200511183155.GT11244@42.do-not-panic.com> References: <20200427180433.7029-1-vbabka@suse.cz> <20200427180433.7029-6-vbabka@suse.cz> <20200427183913.GH11244@42.do-not-panic.com> <028d1996-9f4c-20c6-fb2a-706baa919dde@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <028d1996-9f4c-20c6-fb2a-706baa919dde@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, May 11, 2020 at 01:05:22PM +0200, Vlastimil Babka wrote: > > On 4/27/20 8:39 PM, Luis Chamberlain wrote: > > On Mon, Apr 27, 2020 at 08:04:33PM +0200, Vlastimil Babka wrote: > > Nice, also we could just require > > > > diff --git a/tools/testing/selftests/sysctl/config b/tools/testing/selftests/sysctl/config > > index 6ca14800d755..34461cc99a2b 100644 > > --- a/tools/testing/selftests/sysctl/config > > +++ b/tools/testing/selftests/sysctl/config > > @@ -1 +1,3 @@ > > CONFIG_TEST_SYSCTL=y > > +CONFIG_IKCONFIG=y > > +CONFIG_IKCONFIG_PROC=y > > > > tools/testing/selftests/firmware/fw_lib.sh then has a kconfig_has() > > which can verify the exact config. > > Hmm but it also has a (firmware area specific) fallback for case where > IKCONFIG_PROC doesn't exist. So it's simpler to just keep checking the module > dir, IMHO, as that would be the fallback. As you wish. > >> + > >> + echo -n "Testing if $TARGET is set to 1 ..." > >> + ORIG=$(cat "${TARGET}") > > > > This would fail if someone uses this script to test an older kernel, and > > the scripts in selftests are supposed to work with older kernels. > > Oh, I didn't know that it's supposed to. Yeap, that's how they are used. > > One > > way to address this would be to just see if the file exists first and > > ignore the test if the $SYSCTL directory exists but the file $TARGET > > does not. > > > > For now we can just do this: > > > > if [ ! -d $TARGET ]; then > > echo "Skipping test for $TARGET as it is not present ..." > > return 0 > > fi > > OK, just the -d test needs to be fixed :) Andrew can you please apply: > > ----8<---- > From a999e993a89e521b152bbd4b1466f69e62879c30 Mon Sep 17 00:00:00 2001 > From: Vlastimil Babka > Date: Mon, 11 May 2020 12:59:49 +0200 > Subject: [PATCH] lib/test_sysctl: support testing of sysctl. boot parameter - > fix > > Skip the new test if boot_int sysctl is not present, otherwise, per Luis, > "This would fail if someone uses this script to test an older kernel, and > the scripts in selftests are supposed to work with older kernels." > > Suggested-by: Luis Chamberlain > Signed-off-by: Vlastimil Babka > --- > tools/testing/selftests/sysctl/sysctl.sh | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh > index ef6417b8067b..148704f465b5 100755 > --- a/tools/testing/selftests/sysctl/sysctl.sh > +++ b/tools/testing/selftests/sysctl/sysctl.sh > @@ -756,6 +756,11 @@ sysctl_test_0006() You want to: # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 > sysctl_test_0007() > { > TARGET="${SYSCTL}/boot_int" > + if [ ! -f $TARGET ]; then > + echo "Skipping test for $TARGET as it is not present ..." > + return 0 > + fi And return 4 instead. Luis > + > if [ -d $DIR ]; then > echo "Boot param test only possible sysctl_test is built-in, not module:" > cat $TEST_DIR/config >&2 > -- > 2.26.2 >