Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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