Lines Matching +full:proc +full:- +full:id
2 # SPDX-License-Identifier: GPL-2.0-or-later OR copyleft-next-0.3.1
28 set -e
38 # TEST_ID: is the test id number
42 # Once these are enabled please leave them as-is. Write your own test,
58 # Kselftest framework requirement - SKIP code is 4.
63 if [ ! -d $DIR ]; then
73 if [ -z $DEFAULT_KMOD_DRIVER ]; then
77 if [ -z $DEFAULT_KMOD_FS ]; then
81 if [ -z $PROC_DIR ]; then
82 PROC_DIR="/proc/sys/kernel/"
85 if [ -z $MODPROBE_LIMIT ]; then
89 if [ -z $DIR ]; then
93 if [ -z $DEFAULT_NUM_TESTS ]; then
97 MODPROBE_LIMIT_FILE="${PROC_DIR}/kmod-limit"
116 # A work around is possible in-kernel but its rather
118 KMOD_VERSION=$(kmod --version | awk '{print $3}')
119 if [[ $KMOD_VERSION -le 19 ]]; then
122 …echo "https://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/libkmod/libkmod-module.c?id=fd…
126 uid=$(id -u)
127 if [ $uid -ne 0 ]; then
137 if [ ! -d $DIR ]; then
145 echo "$MODPROBE" > /proc/sys/kernel/modprobe
159 -EPERM)
160 echo -1;;
161 -ENOENT)
162 echo -2;;
163 -EINVAL)
164 echo -22;;
165 -ERR_ANY)
166 echo -123456;;
178 -1)
179 echo -EPERM;;
180 -2)
181 echo -ENOENT;;
182 -22)
183 echo -EINVAL;;
184 -123456)
185 echo -ERR_ANY;;
192 if ! echo -n 1 >$DIR/config_test_case; then
200 if ! echo -n 2 >$DIR/config_test_case; then
208 if ! echo -n $1 >$DIR/config_num_threads; then
216 if [[ -f ${MODPROBE_LIMIT_FILE} ]] ; then
233 if ! echo -n $1 >$DIR/config_test_driver; then
241 if ! echo -n $1 >$DIR/config_test_fs; then
259 if ! echo -n "1" >"$DIR"/reset; then
267 echo "----------------------------------------------------"
269 echo "----------------------------------------------------"
274 if ! echo -n "1" >"$DIR"/trigger_config 2>/dev/null; then
275 echo "$1: FAIL - loading should have worked"
279 echo "$1: OK! - loading kmod test"
285 echo "$1: FAIL - test case was expected to fail"
289 echo "$1: OK! - kmod test case failed as expected"
300 if [[ $ERRNO_NAME = "-ERR_ANY" ]]; then
301 if [[ $RC -ge 0 ]]; then
302 echo "$1: FAIL, test expects $ERRNO_NAME - got $RC_NAME ($RC)" >&2
307 echo "$1: FAIL, test expects $ERRNO_NAME ($ERRNO) - got $RC_NAME ($RC)" >&2
311 echo "$1: OK! - Return value: $RC ($RC_NAME), expected $ERRNO_NAME"
317 modprobe -r $DEFAULT_KMOD_DRIVER
324 modprobe -r $DEFAULT_KMOD_FS
348 config_expect_result ${FUNCNAME[0]} -EINVAL
359 NAME="nope-$DEFAULT_KMOD_DRIVER"
370 NAME="nope-$DEFAULT_KMOD_FS"
375 config_expect_result ${FUNCNAME[0]} -EINVAL
444 echo "/KMOD_TEST_NONEXISTENT" > /proc/sys/kernel/modprobe
446 config_expect_result ${FUNCNAME[0]} -ENOENT
447 echo "$MODPROBE" > /proc/sys/kernel/modprobe
455 # code is still -ENOENT like when modprobe doesn't exist, so we can't
458 echo > /proc/sys/kernel/modprobe
460 config_expect_result ${FUNCNAME[0]} -ENOENT
461 echo "$MODPROBE" > /proc/sys/kernel/modprobe
472 local unpriv=$(capsh --drop=CAP_SYSLOG -- -c "$cmd")
486 kmod_check_visibility /proc/modules \
487 "grep '^${DEFAULT_KMOD_DRIVER}\b' /proc/modules | awk '{print \$NF}'"
493 "cat /sys/module/${DEFAULT_KMOD_DRIVER}/sections/.*text | head -n1"
498 echo "Test ID list:"
501 echo "TEST_ID: Test ID"
504 echo "0001 x $(get_test_count 0001) - Simple test - 1 thread for empty string"
505 …echo "0002 x $(get_test_count 0002) - Simple test - 1 thread for modules/filesystems that do not …
506 echo "0003 x $(get_test_count 0003) - Simple test - 1 thread for get_fs_type() only"
507 echo "0004 x $(get_test_count 0004) - Simple test - 2 threads for get_fs_type() only"
508 …echo "0005 x $(get_test_count 0005) - multithreaded tests with default setup - request_module() on…
509 echo "0006 x $(get_test_count 0006) - multithreaded tests with default setup - get_fs_type() only"
510 …echo "0007 x $(get_test_count 0007) - multithreaded tests with default setup test request_module()…
511 …echo "0008 x $(get_test_count 0008) - multithreaded - push kmod_concurrent over max_modprobes for …
512 …echo "0009 x $(get_test_count 0009) - multithreaded - push kmod_concurrent over max_modprobes for …
513 echo "0010 x $(get_test_count 0010) - test nonexistent modprobe path"
514 echo "0011 x $(get_test_count 0011) - test completely disabling module autoloading"
515 echo "0012 x $(get_test_count 0012) - test /proc/modules address visibility under CAP_SYSLOG"
516 echo "0013 x $(get_test_count 0013) - test /sys/module/*/sections/* visibility under CAP_SYSLOG"
521 NUM_TESTS=$(grep -o ' ' <<<"$ALL_TESTS" | grep -c .)
524 echo "Usage: $0 [ -t <4-number-digit> ] | [ -w <4-number-digit> ] |"
525 echo " [ -s <4-number-digit> ] | [ -c <4-number-digit> <test- count>"
526 echo " [ all ] [ -h | --help ] [ -l ]"
528 echo "Valid tests: 0001-$MAX_TEST"
531 echo " -t Run test ID the number amount of times is recommended"
532 echo " -w Watch test ID run until it runs into an error"
533 echo " -s Run test ID once"
534 echo " -c Run test ID x test-count number of times"
535 echo " -l List all test ID list"
536 echo " -h|--help Help"
539 echo "If you are adding a new test try using -w <test-ID> first to"
544 echo "${TEST_NAME}.sh -- executes all tests"
545 echo "${TEST_NAME}.sh -t 0008 -- Executes test ID 0008 number of times is recommended"
546 echo "${TEST_NAME}.sh -w 0008 -- Watch test ID 0008 run until an error occurs"
547 echo "${TEST_NAME}.sh -s 0008 -- Run test ID 0008 once"
548 echo "${TEST_NAME}.sh -c 0008 3 -- Run test ID 0008 three times"
556 re='^[0-9]+$'
588 if [[ $ENABLED -eq "1" ]]; then
596 if [ $# -ne 3 ]; then
600 echo "Running test: $2 - run #$1"
608 if [ $# -eq 1 ]; then
623 if [ $# -eq 2 ]; then
628 while [ $i -lt $NUM_TESTS ]; do
639 if [ $# -eq 0 ]; then
644 elif [[ "$1" = "-w" ]]; then
647 elif [[ "$1" = "-t" ]]; then
651 elif [[ "$1" = "-c" ]]; then
656 elif [[ "$1" = "-s" ]]; then
659 elif [[ "$1" = "-l" ]]; then
661 elif [[ "$1" = "-h" || "$1" = "--help" ]]; then
673 MODPROBE=$(</proc/sys/kernel/modprobe)