[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <305af605-1e60-cf84-fada-6ce1ca37c102@suse.cz>
Date: Fri, 15 May 2020 18:02:16 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
Iurii Zaikin <yzaikin@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>,
Ivan Teterevkov <ivan.teterevkov@...anix.com>,
Michal Hocko <mhocko@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Matthew Wilcox <willy@...radead.org>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
"Guilherme G . Piccoli" <gpiccoli@...onical.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Christian Brauner <christian.brauner@...ntu.com>,
Masami Hiramatsu <mhiramat@...nel.org>
Subject: Re: [PATCH v3 5/5] lib/test_sysctl: support testing of sysctl. boot
parameter
On 5/13/20 3:17 PM, Luis Chamberlain wrote:
> On Wed, May 13, 2020 at 7:15 AM Luis Chamberlain <mcgrof@...nel.org> 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 <vbabka@...e.cz>
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 <mcgrof@...nel.org>
Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
---
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
Powered by blists - more mailing lists