[PATCH] lib/test_sysctl: support testing of sysctl. boot parameter - fix

From: Vlastimil Babka
Date: Mon May 11 2020 - 06:59:49 EST


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@xxxxxxxxxx>
Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
---
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