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

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

Version: ~ [ linux-6.0-rc1 ] ~ [ linux-5.19.1 ] ~ [ linux-5.18.17 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.60 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.136 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.210 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.255 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.290 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.325 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/sh
  2 # SPDX-License-Identifier: GPL-2.0
  3 #
  4 # Run installed kselftest tests.
  5 #
  6 BASE_DIR=$(realpath $(dirname $0))
  7 cd $BASE_DIR
  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
 11         available=""
 12 else
 13         available="$(cat "$TESTS")"
 14 fi
 15 
 16 . ./kselftest/runner.sh
 17 ROOT=$PWD
 18 
 19 usage()
 20 {
 21         cat <<EOF
 22 Usage: $0 [OPTIONS]
 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
 29 EOF
 30         exit $1
 31 }
 32 
 33 COLLECTIONS=""
 34 TESTS=""
 35 dryrun=""
 36 while true; do
 37         case "$1" in
 38                 -s | --summary)
 39                         logfile="$BASE_DIR"/output.log
 40                         cat /dev/null > $logfile
 41                         shift ;;
 42                 -t | --test)
 43                         TESTS="$TESTS $2"
 44                         shift 2 ;;
 45                 -c | --collection)
 46                         COLLECTIONS="$COLLECTIONS $2"
 47                         shift 2 ;;
 48                 -l | --list)
 49                         echo "$available"
 50                         exit 0 ;;
 51                 -d | --dry-run)
 52                         dryrun="echo"
 53                         shift ;;
 54                 -h | --help)
 55                         usage 0 ;;
 56                 "")
 57                         break ;;
 58                 *)
 59                         usage 1 ;;
 60         esac
 61 done
 62 
 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
 69                         exit 1
 70                 fi
 71                 TESTS="$TESTS $found"
 72         done
 73 fi
 74 # Replace available test list with explicitly selected tests.
 75 if [ -n "$TESTS" ]; then
 76         valid=""
 77         for test in $TESTS ; do
 78                 found="$(echo "$available" | grep "^${test}$")"
 79                 if [ -z "$found" ] ; then
 80                         echo "No such test '$test'" >&2
 81                         exit 1
 82                 fi
 83                 valid="$valid $found"
 84         done
 85         available="$(echo "$valid" | sed -e 's/ /\n/g')"
 86 fi
 87 
 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)
 93 done

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp