Lines Matching +full:proc +full:- +full:id

13 # under the terms of copyleft-next (version 0.3.1 or later) as published
14 # at http://copyleft-next.org/.
39 set -e
49 # TEST_ID: is the test id number
53 # Once these are enabled please leave them as-is. Write your own test,
69 # Kselftest framework requirement - SKIP code is 4.
74 if [ ! -d $DIR ]; then
84 if [ -z $DEFAULT_KMOD_DRIVER ]; then
88 if [ -z $DEFAULT_KMOD_FS ]; then
92 if [ -z $PROC_DIR ]; then
93 PROC_DIR="/proc/sys/kernel/"
96 if [ -z $MODPROBE_LIMIT ]; then
100 if [ -z $DIR ]; then
104 if [ -z $DEFAULT_NUM_TESTS ]; then
108 MODPROBE_LIMIT_FILE="${PROC_DIR}/kmod-limit"
127 # A work around is possible in-kernel but its rather
129 KMOD_VERSION=$(kmod --version | awk '{print $3}')
130 if [[ $KMOD_VERSION -le 19 ]]; then
133 …echo "https://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/libkmod/libkmod-module.c?id=fd…
137 uid=$(id -u)
138 if [ $uid -ne 0 ]; then
148 if [ ! -d $DIR ]; then
156 echo "$MODPROBE" > /proc/sys/kernel/modprobe
170 -EPERM)
171 echo -1;;
172 -ENOENT)
173 echo -2;;
174 -EINVAL)
175 echo -22;;
176 -ERR_ANY)
177 echo -123456;;
189 -1)
190 echo -EPERM;;
191 -2)
192 echo -ENOENT;;
193 -22)
194 echo -EINVAL;;
195 -123456)
196 echo -ERR_ANY;;
203 if ! echo -n 1 >$DIR/config_test_case; then
211 if ! echo -n 2 >$DIR/config_test_case; then
219 if ! echo -n $1 >$DIR/config_num_threads; then
227 if [[ -f ${MODPROBE_LIMIT_FILE} ]] ; then
244 if ! echo -n $1 >$DIR/config_test_driver; then
252 if ! echo -n $1 >$DIR/config_test_fs; then
270 if ! echo -n "1" >"$DIR"/reset; then
278 echo "----------------------------------------------------"
280 echo "----------------------------------------------------"
285 if ! echo -n "1" >"$DIR"/trigger_config 2>/dev/null; then
286 echo "$1: FAIL - loading should have worked"
290 echo "$1: OK! - loading kmod test"
296 echo "$1: FAIL - test case was expected to fail"
300 echo "$1: OK! - kmod test case failed as expected"
311 if [[ $ERRNO_NAME = "-ERR_ANY" ]]; then
312 if [[ $RC -ge 0 ]]; then
313 echo "$1: FAIL, test expects $ERRNO_NAME - got $RC_NAME ($RC)" >&2
318 echo "$1: FAIL, test expects $ERRNO_NAME ($ERRNO) - got $RC_NAME ($RC)" >&2
322 echo "$1: OK! - Return value: $RC ($RC_NAME), expected $ERRNO_NAME"
328 modprobe -r $DEFAULT_KMOD_DRIVER
335 modprobe -r $DEFAULT_KMOD_FS
359 config_expect_result ${FUNCNAME[0]} -EINVAL
370 NAME="nope-$DEFAULT_KMOD_DRIVER"
381 NAME="nope-$DEFAULT_KMOD_FS"
386 config_expect_result ${FUNCNAME[0]} -EINVAL
455 echo "/KMOD_TEST_NONEXISTENT" > /proc/sys/kernel/modprobe
457 config_expect_result ${FUNCNAME[0]} -ENOENT
458 echo "$MODPROBE" > /proc/sys/kernel/modprobe
466 # code is still -ENOENT like when modprobe doesn't exist, so we can't
469 echo > /proc/sys/kernel/modprobe
471 config_expect_result ${FUNCNAME[0]} -ENOENT
472 echo "$MODPROBE" > /proc/sys/kernel/modprobe
483 local unpriv=$(capsh --drop=CAP_SYSLOG -- -c "$cmd")
497 kmod_check_visibility /proc/modules \
498 "grep '^${DEFAULT_KMOD_DRIVER}\b' /proc/modules | awk '{print \$NF}'"
504 "cat /sys/module/${DEFAULT_KMOD_DRIVER}/sections/.*text | head -n1"
509 echo "Test ID list:"
512 echo "TEST_ID: Test ID"
515 echo "0001 x $(get_test_count 0001) - Simple test - 1 thread for empty string"
516 …echo "0002 x $(get_test_count 0002) - Simple test - 1 thread for modules/filesystems that do not …
517 echo "0003 x $(get_test_count 0003) - Simple test - 1 thread for get_fs_type() only"
518 echo "0004 x $(get_test_count 0004) - Simple test - 2 threads for get_fs_type() only"
519 …echo "0005 x $(get_test_count 0005) - multithreaded tests with default setup - request_module() on…
520 echo "0006 x $(get_test_count 0006) - multithreaded tests with default setup - get_fs_type() only"
521 …echo "0007 x $(get_test_count 0007) - multithreaded tests with default setup test request_module()…
522 …echo "0008 x $(get_test_count 0008) - multithreaded - push kmod_concurrent over max_modprobes for …
523 …echo "0009 x $(get_test_count 0009) - multithreaded - push kmod_concurrent over max_modprobes for …
524 echo "0010 x $(get_test_count 0010) - test nonexistent modprobe path"
525 echo "0011 x $(get_test_count 0011) - test completely disabling module autoloading"
526 echo "0012 x $(get_test_count 0012) - test /proc/modules address visibility under CAP_SYSLOG"
527 echo "0013 x $(get_test_count 0013) - test /sys/module/*/sections/* visibility under CAP_SYSLOG"
532 NUM_TESTS=$(grep -o ' ' <<<"$ALL_TESTS" | grep -c .)
535 echo "Usage: $0 [ -t <4-number-digit> ] | [ -w <4-number-digit> ] |"
536 echo " [ -s <4-number-digit> ] | [ -c <4-number-digit> <test- count>"
537 echo " [ all ] [ -h | --help ] [ -l ]"
539 echo "Valid tests: 0001-$MAX_TEST"
542 echo " -t Run test ID the number amount of times is recommended"
543 echo " -w Watch test ID run until it runs into an error"
544 echo " -s Run test ID once"
545 echo " -c Run test ID x test-count number of times"
546 echo " -l List all test ID list"
547 echo " -h|--help Help"
550 echo "If you are adding a new test try using -w <test-ID> first to"
555 echo "${TEST_NAME}.sh -- executes all tests"
556 echo "${TEST_NAME}.sh -t 0008 -- Executes test ID 0008 number of times is recommended"
557 echo "${TEST_NAME}.sh -w 0008 -- Watch test ID 0008 run until an error occurs"
558 echo "${TEST_NAME}.sh -s 0008 -- Run test ID 0008 once"
559 echo "${TEST_NAME}.sh -c 0008 3 -- Run test ID 0008 three times"
567 re='^[0-9]+$'
599 if [[ $ENABLED -eq "1" ]]; then
607 if [ $# -ne 3 ]; then
611 echo "Running test: $2 - run #$1"
619 if [ $# -eq 1 ]; then
634 if [ $# -eq 2 ]; then
639 while [ $i -lt $NUM_TESTS ]; do
650 if [ $# -eq 0 ]; then
655 elif [[ "$1" = "-w" ]]; then
658 elif [[ "$1" = "-t" ]]; then
662 elif [[ "$1" = "-c" ]]; then
667 elif [[ "$1" = "-s" ]]; then
670 elif [[ "$1" = "-l" ]]; then
672 elif [[ "$1" = "-h" || "$1" = "--help" ]]; then
684 MODPROBE=$(</proc/sys/kernel/modprobe)