Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1777525ybk; Mon, 11 May 2020 04:07:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgN7SkZO1bIqSmMhh7HVj9UNn1egjbD4WgkWmHvsVKF+EFRIaAgDZxwDvbOHmHeNwqvOwj X-Received: by 2002:a17:906:4d0d:: with SMTP id r13mr617782eju.282.1589195274914; Mon, 11 May 2020 04:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589195274; cv=none; d=google.com; s=arc-20160816; b=JUxXyiYYnUqcj4uN1eXoLUZtWKyqOlyB8Vnleek/GUEAS/0q1x+2srVHXI025CoXXL OGtObHfXo9hUZ6ZHj6rglF9nx4WSa4U8gAIndqz0s0Sq9qIBwXHi5vIL658D5FuEUyBG luoEEmgBWLhtCNZB3GoOCm6VbhsFWbYAWerbT/kYqwDbIrWIG+qTbVY22nTcMQEh18lV 2SuP6h/jbJjnWp2szm5pa5KIicculVrlyOdvA7DfAAqcuMKvcWE1BN+8ycEMRJuA2Nq7 6GqEQEW8jTsSUVmcR20zTyzMiLb1Vkkz08L2pclcvgyAfEBPOtMA7Wi4ut1wqJ35N04R Wmrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=QIuxruaPt9uPN8+w0sQb/qNS2VMiG20YQ2bKEplZMTc=; b=e1VdMCKdZgJ6mK5ZFCc7Q35j5Ek9skknrTjd7cmYhhN8gqlFdXTuWa/h7X7AWWV6LG c49oXsKwWjERMYFloY8r0UO2TwFO6VmuCiZY+N3Qyb6J12LSnR2+ncfBLLFAfmtJDaIG W2xYr8yrR48reoDUw6DRzBibt+uHoJwKLczsmKsJeupQkvYlUz6UPXKlExqnj5crG6pq UxpcJmFQEawcJuRgRO2KIEnSGfPuNOAZECZwMnbCbWacCmWzY1JoM59CN1seltLq1cer ZhyQhccMpCZwyyBdi/0g3e9Bz/eebeyWABZI8mfvOh4raPMCOP9pikI3oR4AS8FGM2PL F+HQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t26si5685435edf.183.2020.05.11.04.07.31; Mon, 11 May 2020 04:07:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729507AbgEKLF1 (ORCPT + 99 others); Mon, 11 May 2020 07:05:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:36522 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728136AbgEKLF1 (ORCPT ); Mon, 11 May 2020 07:05:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4EB16AC64; Mon, 11 May 2020 11:05:27 +0000 (UTC) Subject: Re: [PATCH v3 5/5] lib/test_sysctl: support testing of sysctl. boot parameter To: Luis Chamberlain 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 References: <20200427180433.7029-1-vbabka@suse.cz> <20200427180433.7029-6-vbabka@suse.cz> <20200427183913.GH11244@42.do-not-panic.com> From: Vlastimil Babka Message-ID: <028d1996-9f4c-20c6-fb2a-706baa919dde@suse.cz> Date: Mon, 11 May 2020 13:05:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200427183913.GH11244@42.do-not-panic.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. >> + >> + 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. > 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() sysctl_test_0007() { TARGET="${SYSCTL}/boot_int" + if [ ! -f $TARGET ]; then + echo "Skipping test for $TARGET as it is not present ..." + return 0 + fi + 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