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.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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 50294C433E0 for ; Fri, 15 May 2020 16:02:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 05855206C0 for ; Fri, 15 May 2020 16:02:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05855206C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 510748E0003; Fri, 15 May 2020 12:02:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C08F8E0001; Fri, 15 May 2020 12:02:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D5DB8E0003; Fri, 15 May 2020 12:02:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2460F8E0001 for ; Fri, 15 May 2020 12:02:23 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CC616184C0525 for ; Fri, 15 May 2020 16:02:22 +0000 (UTC) X-FDA: 76819420524.15.eyes60_4ee612a51ef39 X-HE-Tag: eyes60_4ee612a51ef39 X-Filterd-Recvd-Size: 4541 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 May 2020 16:02:22 +0000 (UTC) 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 37AFCABC2; Fri, 15 May 2020 16:02:21 +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 , linux-mm , 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> <028d1996-9f4c-20c6-fb2a-706baa919dde@suse.cz> <20200511183155.GT11244@42.do-not-panic.com> <20200513131532.GO11244@42.do-not-panic.com> From: Vlastimil Babka Message-ID: <305af605-1e60-cf84-fada-6ce1ca37c102@suse.cz> Date: Fri, 15 May 2020 18:02:16 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 5/13/20 3:17 PM, Luis Chamberlain wrote: > On Wed, May 13, 2020 at 7:15 AM Luis Chamberlain wrote: >> > > >> > > 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. >> > >> > If I return it from the function, nobody will care, AFAICS. If I 'exit >> > $ksft_skip', is that correct if it's just a single test out of 7? >> >> yes please do that. > > Ah but once we add test_0008() it may be supported.. so I think return > would be OK OK ----8<---- >From 4311b356f177aaa4e21bd3d2a2169e5bd50ab62d 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh index ef6417b8067b..ab44d3e65986 100755 --- a/tools/testing/selftests/sysctl/sysctl.sh +++ b/tools/testing/selftests/sysctl/sysctl.sh @@ -756,10 +756,15 @@ 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 $ksft_skip + fi + if [ -d $DIR ]; then echo "Boot param test only possible sysctl_test is built-in, not module:" cat $TEST_DIR/config >&2 - return 0 + return $ksft_skip fi echo -n "Testing if $TARGET is set to 1 ..." @@ -785,6 +790,7 @@ sysctl_test_0007() echo "Skipping test, expected kernel parameter missing." echo "To perform this test, make sure kernel is booted with parameter: sysctl.debug.test_sysctl.boot_int=1" + return $ksft_skip } list_tests() -- 2.26.2