sysctl.sh (cdd5b5a9761fd66d17586e4f4ba6588c70e640ea) | sysctl.sh (777740779ec5bd05eac85d9bbbb6b11457cfd238) |
---|---|
1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0-or-later OR copyleft-next-0.3.1 3# Copyright (C) 2017 Luis R. Rodriguez <mcgrof@kernel.org> 4 5# This performs a series tests against the proc sysctl interface. 6 7# Kselftest framework requirement - SKIP code is 4. 8ksft_skip=4 --- 21 unchanged lines hidden (view full) --- 30ALL_TESTS="$ALL_TESTS 0003:1:1:int_0002:1" 31ALL_TESTS="$ALL_TESTS 0004:1:1:uint_0001:1" 32ALL_TESTS="$ALL_TESTS 0005:3:1:int_0003:1" 33ALL_TESTS="$ALL_TESTS 0006:50:1:bitmap_0001:1" 34ALL_TESTS="$ALL_TESTS 0007:1:1:boot_int:1" 35ALL_TESTS="$ALL_TESTS 0008:1:1:match_int:1" 36ALL_TESTS="$ALL_TESTS 0009:1:1:unregister_error:0" 37ALL_TESTS="$ALL_TESTS 0010:1:1:mnt/mnt_error:0" | 1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0-or-later OR copyleft-next-0.3.1 3# Copyright (C) 2017 Luis R. Rodriguez <mcgrof@kernel.org> 4 5# This performs a series tests against the proc sysctl interface. 6 7# Kselftest framework requirement - SKIP code is 4. 8ksft_skip=4 --- 21 unchanged lines hidden (view full) --- 30ALL_TESTS="$ALL_TESTS 0003:1:1:int_0002:1" 31ALL_TESTS="$ALL_TESTS 0004:1:1:uint_0001:1" 32ALL_TESTS="$ALL_TESTS 0005:3:1:int_0003:1" 33ALL_TESTS="$ALL_TESTS 0006:50:1:bitmap_0001:1" 34ALL_TESTS="$ALL_TESTS 0007:1:1:boot_int:1" 35ALL_TESTS="$ALL_TESTS 0008:1:1:match_int:1" 36ALL_TESTS="$ALL_TESTS 0009:1:1:unregister_error:0" 37ALL_TESTS="$ALL_TESTS 0010:1:1:mnt/mnt_error:0" |
38ALL_TESTS="$ALL_TESTS 0011:1:1:empty_add:0" |
|
38 39function allow_user_defaults() 40{ 41 if [ -z $DIR ]; then 42 DIR="/sys/module/test_sysctl/" 43 fi 44 if [ -z $DEFAULT_NUM_TESTS ]; then 45 DEFAULT_NUM_TESTS=50 --- 777 unchanged lines hidden (view full) --- 823 rc=1 824 test_rc 825 fi 826 827 echo "ok" 828 return 0 829} 830 | 39 40function allow_user_defaults() 41{ 42 if [ -z $DIR ]; then 43 DIR="/sys/module/test_sysctl/" 44 fi 45 if [ -z $DEFAULT_NUM_TESTS ]; then 46 DEFAULT_NUM_TESTS=50 --- 777 unchanged lines hidden (view full) --- 824 rc=1 825 test_rc 826 fi 827 828 echo "ok" 829 return 0 830} 831 |
832sysctl_test_0011() 833{ 834 TARGET="${SYSCTL}/$(get_test_target 0011)" 835 echo -n "Testing empty dir handling in ${TARGET} ... " 836 if [ ! -d ${TARGET} ]; then 837 echo -e "FAIL\nCould not create ${TARGET}" >&2 838 rc=1 839 test_rc 840 fi 841 842 TARGET2="${TARGET}/empty" 843 if [ ! -d ${TARGET2} ]; then 844 echo -e "FAIL\nCould not create ${TARGET2}" >&2 845 rc=1 846 test_rc 847 fi 848 849 echo "OK" 850 return 0 851} 852 |
|
831list_tests() 832{ 833 echo "Test ID list:" 834 echo 835 echo "TEST_ID x NUM_TEST" 836 echo "TEST_ID: Test ID" 837 echo "NUM_TESTS: Number of recommended times to run the test" 838 echo 839 echo "0001 x $(get_test_count 0001) - tests proc_dointvec_minmax()" 840 echo "0002 x $(get_test_count 0002) - tests proc_dostring()" 841 echo "0003 x $(get_test_count 0003) - tests proc_dointvec()" 842 echo "0004 x $(get_test_count 0004) - tests proc_douintvec()" 843 echo "0005 x $(get_test_count 0005) - tests proc_douintvec() array" 844 echo "0006 x $(get_test_count 0006) - tests proc_do_large_bitmap()" 845 echo "0007 x $(get_test_count 0007) - tests setting sysctl from kernel boot param" 846 echo "0008 x $(get_test_count 0008) - tests sysctl macro values match" 847 echo "0009 x $(get_test_count 0009) - tests sysct unregister" 848 echo "0010 x $(get_test_count 0010) - tests sysct mount point" | 853list_tests() 854{ 855 echo "Test ID list:" 856 echo 857 echo "TEST_ID x NUM_TEST" 858 echo "TEST_ID: Test ID" 859 echo "NUM_TESTS: Number of recommended times to run the test" 860 echo 861 echo "0001 x $(get_test_count 0001) - tests proc_dointvec_minmax()" 862 echo "0002 x $(get_test_count 0002) - tests proc_dostring()" 863 echo "0003 x $(get_test_count 0003) - tests proc_dointvec()" 864 echo "0004 x $(get_test_count 0004) - tests proc_douintvec()" 865 echo "0005 x $(get_test_count 0005) - tests proc_douintvec() array" 866 echo "0006 x $(get_test_count 0006) - tests proc_do_large_bitmap()" 867 echo "0007 x $(get_test_count 0007) - tests setting sysctl from kernel boot param" 868 echo "0008 x $(get_test_count 0008) - tests sysctl macro values match" 869 echo "0009 x $(get_test_count 0009) - tests sysct unregister" 870 echo "0010 x $(get_test_count 0010) - tests sysct mount point" |
871 echo "0011 x $(get_test_count 0011) - tests empty directories" |
|
849} 850 851usage() 852{ 853 NUM_TESTS=$(grep -o ' ' <<<"$ALL_TESTS" | grep -c .) 854 let NUM_TESTS=$NUM_TESTS+1 855 MAX_TEST=$(printf "%04d\n" $NUM_TESTS) 856 echo "Usage: $0 [ -t <4-number-digit> ] | [ -w <4-number-digit> ] |" --- 189 unchanged lines hidden --- | 872} 873 874usage() 875{ 876 NUM_TESTS=$(grep -o ' ' <<<"$ALL_TESTS" | grep -c .) 877 let NUM_TESTS=$NUM_TESTS+1 878 MAX_TEST=$(printf "%04d\n" $NUM_TESTS) 879 echo "Usage: $0 [ -t <4-number-digit> ] | [ -w <4-number-digit> ] |" --- 189 unchanged lines hidden --- |