test_sysctl: add generic script to expand on tests
Subsystems (2)
PATCH 15/96 test_sysctl: add generic script to expand on tests
From: "Luis R. Rodriguez" <[email protected]>
Subject: test_sysctl: add generic script to expand on tests
This adds a generic script to let us more easily add more tests cases. Since we really have only two types of tests cases just fold them into the one file. Each test unit is now identified into its separate function:
# ./sysctl.sh -l Test ID list:
TEST_ID x NUM_TEST
TEST_ID: Test ID NUM_TESTS: Number of recommended times to run the test
0001 x 1 - tests proc_dointvec_minmax()
0002 x 1 - tests proc_dostring()
For now we start off with what we had before, and run only each test once. We can now watch a test case until it fails:
./sysctl.sh -w 0002
We can also run a test case x number of times, say we want to run a test case 100 times:
./sysctl.sh -c 0001 100
To run a test case only once, for example:
./sysctl.sh -s 0002
The default settings are specified at the top of sysctl.sh.
---
tools/testing/selftests/sysctl/Makefile | 3 tools/testing/selftests/sysctl/common_tests | 131 --- tools/testing/selftests/sysctl/run_numerictests | 10 tools/testing/selftests/sysctl/run_stringtests | 77 -- tools/testing/selftests/sysctl/sysctl.sh | 494 ++++++++++++++ 5 files changed, 495 insertions(+), 220 deletions(-)
tools/testing/selftests/sysctl/Makefile renamed from tools/testing/selftests/sysctl/Makefile~test_sysctl-add-generic-script-to-expand-on-tests +1 -2
@@ -4,8 +4,7 @@ # No binaries, but make sure arg-less "make" doesn't trigger "run_tests". all: -TEST_PROGS := run_numerictests run_stringtests -TEST_FILES := common_tests +TEST_PROGS := sysctl.sh include ../lib.mk
tools/testing/selftests/sysctl/common_tests deleted +0 -131
131 lines not on this page · raw message
tools/testing/selftests/sysctl/run_numerictests deleted +0 -10
@@ -1,10 +0,0 @@ -#!/bin/sh - -SYSCTL="/proc/sys/debug/test_sysctl/" -TARGET="${SYSCTL}/int_0001" -ORIG=$(cat "${TARGET}") -TEST_STR=$(( $ORIG + 1 )) - -. ./common_tests - -exit_test
tools/testing/selftests/sysctl/run_stringtests deleted +0 -77
77 lines not on this page · raw message
tools/testing/selftests/sysctl/sysctl.sh new file +494 -0
494 lines not on this page · raw message
_