~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/run_kselftest.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/run_kselftest.sh (Architecture alpha) and /tools/testing/selftests/run_kselftest.sh (Architecture ppc)


  1 #!/bin/sh                                           1 #!/bin/sh
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3 #                                                   3 #
  4 # Run installed kselftest tests.                    4 # Run installed kselftest tests.
  5 #                                                   5 #
  6 BASE_DIR=$(realpath $(dirname $0))                  6 BASE_DIR=$(realpath $(dirname $0))
  7 cd $BASE_DIR                                        7 cd $BASE_DIR
  8 TESTS="$BASE_DIR"/kselftest-list.txt                8 TESTS="$BASE_DIR"/kselftest-list.txt
  9 if [ ! -r "$TESTS" ] ; then                         9 if [ ! -r "$TESTS" ] ; then
 10         echo "$0: Could not find list of tests     10         echo "$0: Could not find list of tests to run ($TESTS)" >&2
 11         available=""                               11         available=""
 12 else                                               12 else
 13         available="$(cat "$TESTS")"                13         available="$(cat "$TESTS")"
 14 fi                                                 14 fi
 15                                                    15 
 16 . ./kselftest/runner.sh                            16 . ./kselftest/runner.sh
 17 ROOT=$PWD                                          17 ROOT=$PWD
 18                                                    18 
 19 usage()                                            19 usage()
 20 {                                                  20 {
 21         cat <<EOF                                  21         cat <<EOF
 22 Usage: $0 [OPTIONS]                                22 Usage: $0 [OPTIONS]
 23   -s | --summary                Print summary      23   -s | --summary                Print summary with detailed log in output.log (conflict with -p)
 24   -p | --per_test_log           Print test log     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      25   -t | --test COLLECTION:TEST   Run TEST from COLLECTION
 26   -c | --collection COLLECTION  Run all tests      26   -c | --collection COLLECTION  Run all tests from COLLECTION
 27   -l | --list                   List the avail     27   -l | --list                   List the available collection:test entries
 28   -d | --dry-run                Don't actually     28   -d | --dry-run                Don't actually run any tests
 29   -n | --netns                  Run each test      29   -n | --netns                  Run each test in namespace
 30   -h | --help                   Show this usag     30   -h | --help                   Show this usage info
 31   -o | --override-timeout       Number of seco     31   -o | --override-timeout       Number of seconds after which we timeout
 32 EOF                                                32 EOF
 33         exit $1                                    33         exit $1
 34 }                                                  34 }
 35                                                    35 
 36 COLLECTIONS=""                                     36 COLLECTIONS=""
 37 TESTS=""                                           37 TESTS=""
 38 dryrun=""                                          38 dryrun=""
 39 kselftest_override_timeout=""                      39 kselftest_override_timeout=""
 40 while true; do                                     40 while true; do
 41         case "$1" in                               41         case "$1" in
 42                 -s | --summary)                    42                 -s | --summary)
 43                         logfile="$BASE_DIR"/ou     43                         logfile="$BASE_DIR"/output.log
 44                         cat /dev/null > $logfi     44                         cat /dev/null > $logfile
 45                         shift ;;                   45                         shift ;;
 46                 -p | --per-test-log)               46                 -p | --per-test-log)
 47                         per_test_logging=1         47                         per_test_logging=1
 48                         shift ;;                   48                         shift ;;
 49                 -t | --test)                       49                 -t | --test)
 50                         TESTS="$TESTS $2"          50                         TESTS="$TESTS $2"
 51                         shift 2 ;;                 51                         shift 2 ;;
 52                 -c | --collection)                 52                 -c | --collection)
 53                         COLLECTIONS="$COLLECTI     53                         COLLECTIONS="$COLLECTIONS $2"
 54                         shift 2 ;;                 54                         shift 2 ;;
 55                 -l | --list)                       55                 -l | --list)
 56                         echo "$available"          56                         echo "$available"
 57                         exit 0 ;;                  57                         exit 0 ;;
 58                 -d | --dry-run)                    58                 -d | --dry-run)
 59                         dryrun="echo"              59                         dryrun="echo"
 60                         shift ;;                   60                         shift ;;
 61                 -n | --netns)                      61                 -n | --netns)
 62                         RUN_IN_NETNS=1             62                         RUN_IN_NETNS=1
 63                         shift ;;                   63                         shift ;;
 64                 -o | --override-timeout)           64                 -o | --override-timeout)
 65                         kselftest_override_tim     65                         kselftest_override_timeout="$2"
 66                         shift 2 ;;                 66                         shift 2 ;;
 67                 -h | --help)                       67                 -h | --help)
 68                         usage 0 ;;                 68                         usage 0 ;;
 69                 "")                                69                 "")
 70                         break ;;                   70                         break ;;
 71                 *)                                 71                 *)
 72                         usage 1 ;;                 72                         usage 1 ;;
 73         esac                                       73         esac
 74 done                                               74 done
 75                                                    75 
 76 # Add all selected collections to the explicit     76 # Add all selected collections to the explicit test list.
 77 if [ -n "$COLLECTIONS" ]; then                     77 if [ -n "$COLLECTIONS" ]; then
 78         for collection in $COLLECTIONS ; do        78         for collection in $COLLECTIONS ; do
 79                 found="$(echo "$available" | g     79                 found="$(echo "$available" | grep "^$collection:")"
 80                 if [ -z "$found" ] ; then          80                 if [ -z "$found" ] ; then
 81                         echo "No such collecti     81                         echo "No such collection '$collection'" >&2
 82                         exit 1                     82                         exit 1
 83                 fi                                 83                 fi
 84                 TESTS="$TESTS $found"              84                 TESTS="$TESTS $found"
 85         done                                       85         done
 86 fi                                                 86 fi
 87 # Replace available test list with explicitly      87 # Replace available test list with explicitly selected tests.
 88 if [ -n "$TESTS" ]; then                           88 if [ -n "$TESTS" ]; then
 89         valid=""                                   89         valid=""
 90         for test in $TESTS ; do                    90         for test in $TESTS ; do
 91                 found="$(echo "$available" | g     91                 found="$(echo "$available" | grep "^${test}$")"
 92                 if [ -z "$found" ] ; then          92                 if [ -z "$found" ] ; then
 93                         echo "No such test '$t     93                         echo "No such test '$test'" >&2
 94                         exit 1                     94                         exit 1
 95                 fi                                 95                 fi
 96                 valid="$valid $found"              96                 valid="$valid $found"
 97         done                                       97         done
 98         available="$(echo "$valid" | sed -e 's     98         available="$(echo "$valid" | sed -e 's/ /\n/g')"
 99 fi                                                 99 fi
100                                                   100 
101 collections=$(echo "$available" | cut -d: -f1     101 collections=$(echo "$available" | cut -d: -f1 | sort | uniq)
102 for collection in $collections ; do               102 for collection in $collections ; do
103         [ -w /dev/kmsg ] && echo "kselftest: R    103         [ -w /dev/kmsg ] && echo "kselftest: Running tests in $collection" >> /dev/kmsg
104         tests=$(echo "$available" | grep "^$co    104         tests=$(echo "$available" | grep "^$collection:" | cut -d: -f2)
105         ($dryrun cd "$collection" && $dryrun r    105         ($dryrun cd "$collection" && $dryrun run_many $tests)
106 done                                              106 done
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php