2 # SPDX-License-Identifier: GPL-2.0
4 # Run installed kselftest tests.
6 BASE_DIR
=$
(realpath $
(dirname $0))
8 TESTS
="$BASE_DIR"/kselftest-list.txt
9 if [ ! -r "$TESTS" ] ; then
10 echo "$0: Could not find list of tests to run ($TESTS)" >&2
13 available
="$(cat "$TESTS")"
16 . .
/kselftest
/runner.sh
23 -s | --summary Print summary with detailed log in output.log (conflict with -p)
24 -p | --per_test_log Print test log in /tmp with each test name (conflict with -s)
25 -t | --test COLLECTION:TEST Run TEST from COLLECTION
26 -c | --collection COLLECTION Run all tests from COLLECTION
27 -l | --list List the available collection:test entries
28 -d | --dry-run Don't actually run any tests
29 -n | --netns Run each test in namespace
30 -h | --help Show this usage info
31 -o | --override-timeout Number of seconds after which we timeout
39 kselftest_override_timeout
=""
43 logfile
="$BASE_DIR"/output.log
44 cat /dev
/null
> $logfile
53 COLLECTIONS
="$COLLECTIONS $2"
64 -o |
--override-timeout)
65 kselftest_override_timeout
="$2"
76 # Add all selected collections to the explicit test list.
77 if [ -n "$COLLECTIONS" ]; then
78 for collection
in $COLLECTIONS ; do
79 found
="$(echo "$available" | grep "^
$collection:")"
80 if [ -z "$found" ] ; then
81 echo "No such collection '$collection'" >&2
87 # Replace available test list with explicitly selected tests.
88 if [ -n "$TESTS" ]; then
90 for test in $TESTS ; do
91 found
="$(echo "$available" | grep "^
${test}$
")"
92 if [ -z "$found" ] ; then
93 echo "No such test '$test'" >&2
98 available
="$(echo "$valid" | sed -e 's/ /\n/g')"
101 collections
=$
(echo "$available" | cut
-d: -f1 |
sort |
uniq)
102 for collection
in $collections ; do
103 [ -w /dev
/kmsg
] && echo "kselftest: Running tests in $collection" >> /dev
/kmsg
104 tests
=$
(echo "$available" |
grep "^$collection:" | cut
-d: -f2)
105 ($dryrun cd "$collection" && $dryrun run_many
$tests)