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
24 -t | --test COLLECTION:TEST Run TEST from COLLECTION
25 -c | --collection COLLECTION Run all tests from COLLECTION
26 -l | --list List the available collection:test entries
27 -d | --dry-run Don't actually run any tests
28 -h | --help Show this usage info
39 logfile="$BASE_DIR"/output.log
40 cat /dev/null > $logfile
46 COLLECTIONS="$COLLECTIONS $2"
63 # Add all selected collections to the explicit test list.
64 if [ -n "$COLLECTIONS" ]; then
65 for collection in $COLLECTIONS ; do
66 found="$(echo "$available" | grep "^$collection:")"
67 if [ -z "$found" ] ; then
68 echo "No such collection '$collection'" >&2
74 # Replace available test list with explicitly selected tests.
75 if [ -n "$TESTS" ]; then
77 for test in $TESTS ; do
78 found="$(echo "$available" | grep "^${test}$")"
79 if [ -z "$found" ] ; then
80 echo "No such test '$test'" >&2
85 available="$(echo "$valid" | sed -e 's/ /\n/g')"
88 collections=$(echo "$available" | cut -d: -f1 | uniq)
89 for collection in $collections ; do
90 [ -w /dev/kmsg ] && echo "kselftest: Running tests in $collection" >> /dev/kmsg
91 tests=$(echo "$available" | grep "^$collection:" | cut -d: -f2)
92 ($dryrun cd "$collection" && $dryrun run_many $tests)