test_sysctl: add dedicated proc sysctl test driver
Subsystems (3)
[email protected]
maintainerPATCH 14/96 test_sysctl: add dedicated proc sysctl test driver
From: "Luis R. Rodriguez" <[email protected]>
Subject: test_sysctl: add dedicated proc sysctl test driver
The existing tools/testing/selftests/sysctl/ tests include two test cases, but these use existing production kernel sysctl interfaces. We want to expand test coverage but we can't just be looking for random safe production values to poke at, that's just insane!
Instead just dedicate a test driver for debugging purposes and port the existing scripts to use it. This will make it easier for further tests to be added.
Subsequent patches will extend our test coverage for sysctl.
The stress test driver uses a new license (GPL on Linux, copyleft-next outside of Linux). Linus was fine with this [0] and later due to Ted's and Alans's request ironed out an "or" language clause to use [1] which is already present upstream.
[0] https://lkml.kernel.org/r/CA+55aFyhxcvD+q7tp+-yrSFDKfR0mOHgyEAe=f_94aKLsOu0Og@mail.gmail.com
[1] https://lkml.kernel.org/r/[email protected]
---
lib/Kconfig.debug | 11 + lib/Makefile | 1 lib/test_sysctl.c | 113 ++++++++++++++ tools/testing/selftests/sysctl/config | 1 tools/testing/selftests/sysctl/run_numerictests | 4 tools/testing/selftests/sysctl/run_stringtests | 4 6 files changed, 130 insertions(+), 4 deletions(-)
lib/Kconfig.debug renamed from lib/Kconfig.debug~test_sysctl-add-dedicated-proc-sysctl-test-driver +11 -0
@@ -1785,6 +1785,17 @@ config TEST_FIRMWARE If unsure, say N. +config TEST_SYSCTL + tristate "sysctl test driver" + default n + depends on PROC_SYSCTL + help + This builds the "test_sysctl" module. This driver enables to test the + proc sysctl interfaces available to drivers safely without affecting + production knobs which might alter system functionality. + + If unsure, say N. + config TEST_UDELAY tristate "udelay test driver" default n
lib/Makefile renamed from lib/Makefile~test_sysctl-add-dedicated-proc-sysctl-test-driver +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_TEST_HEXDUMP) += test_hexdu obj-y += kstrtox.o obj-$(CONFIG_TEST_BPF) += test_bpf.o obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o +obj-$(CONFIG_TEST_SYSCTL) += test_sysctl.o obj-$(CONFIG_TEST_HASH) += test_hash.o test_siphash.o obj-$(CONFIG_TEST_KASAN) += test_kasan.o obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
lib/test_sysctl.c new file +113 -0
113 lines not on this page · raw message
tools/testing/selftests/sysctl/config new file +1 -0
@@ -0,0 +1 @@ +CONFIG_TEST_SYSCTL=y
tools/testing/selftests/sysctl/run_numerictests renamed from tools/testing/selftests/sysctl/run_numerictests~test_sysctl-add-dedicated-proc-sysctl-test-driver +2 -2
@@ -1,7 +1,7 @@ #!/bin/sh -SYSCTL="/proc/sys" -TARGET="${SYSCTL}/vm/swappiness" +SYSCTL="/proc/sys/debug/test_sysctl/" +TARGET="${SYSCTL}/int_0001" ORIG=$(cat "${TARGET}") TEST_STR=$(( $ORIG + 1 ))
tools/testing/selftests/sysctl/run_stringtests renamed from tools/testing/selftests/sysctl/run_stringtests~test_sysctl-add-dedicated-proc-sysctl-test-driver +2 -2
@@ -1,7 +1,7 @@ #!/bin/sh -SYSCTL="/proc/sys" -TARGET="${SYSCTL}/kernel/domainname" +SYSCTL="/proc/sys/debug/test_sysctl/" +TARGET="${SYSCTL}/string_0001" ORIG=$(cat "${TARGET}") TEST_STR="Testing sysctl"
_