sysctl.sh (a40b702789a480904b15f5843c4ed79f969ee4d5) sysctl.sh (35576438591e8d37c7651e6ff56f2e07c7f9615a)
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

--- 17 unchanged lines hidden (view full) ---

26ALL_TESTS="0001:1:1:int_0001"
27ALL_TESTS="$ALL_TESTS 0002:1:1:string_0001"
28ALL_TESTS="$ALL_TESTS 0003:1:1:int_0002"
29ALL_TESTS="$ALL_TESTS 0004:1:1:uint_0001"
30ALL_TESTS="$ALL_TESTS 0005:3:1:int_0003"
31ALL_TESTS="$ALL_TESTS 0006:50:1:bitmap_0001"
32ALL_TESTS="$ALL_TESTS 0007:1:1:boot_int"
33ALL_TESTS="$ALL_TESTS 0008:1:1:match_int"
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

--- 17 unchanged lines hidden (view full) ---

26ALL_TESTS="0001:1:1:int_0001"
27ALL_TESTS="$ALL_TESTS 0002:1:1:string_0001"
28ALL_TESTS="$ALL_TESTS 0003:1:1:int_0002"
29ALL_TESTS="$ALL_TESTS 0004:1:1:uint_0001"
30ALL_TESTS="$ALL_TESTS 0005:3:1:int_0003"
31ALL_TESTS="$ALL_TESTS 0006:50:1:bitmap_0001"
32ALL_TESTS="$ALL_TESTS 0007:1:1:boot_int"
33ALL_TESTS="$ALL_TESTS 0008:1:1:match_int"
34ALL_TESTS="$ALL_TESTS 0009:1:1:unregister_error"
34
35function allow_user_defaults()
36{
37 if [ -z $DIR ]; then
38 DIR="/sys/module/test_sysctl/"
39 fi
40 if [ -z $DEFAULT_NUM_TESTS ]; then
41 DEFAULT_NUM_TESTS=50

--- 750 unchanged lines hidden (view full) ---

792 rc=1
793 test_rc
794 fi
795
796 echo "ok"
797 return 0
798}
799
35
36function allow_user_defaults()
37{
38 if [ -z $DIR ]; then
39 DIR="/sys/module/test_sysctl/"
40 fi
41 if [ -z $DEFAULT_NUM_TESTS ]; then
42 DEFAULT_NUM_TESTS=50

--- 750 unchanged lines hidden (view full) ---

793 rc=1
794 test_rc
795 fi
796
797 echo "ok"
798 return 0
799}
800
801sysctl_test_0009()
802{
803 TARGET="${SYSCTL}/$(get_test_target 0009)"
804 echo -n "Testing if $TARGET unregistered correctly ..."
805 if [ -d $TARGET ]; then
806 echo "TEST FAILED"
807 rc=1
808 test_rc
809 fi
810
811 echo "ok"
812 return 0
813}
814
800list_tests()
801{
802 echo "Test ID list:"
803 echo
804 echo "TEST_ID x NUM_TEST"
805 echo "TEST_ID: Test ID"
806 echo "NUM_TESTS: Number of recommended times to run the test"
807 echo
808 echo "0001 x $(get_test_count 0001) - tests proc_dointvec_minmax()"
809 echo "0002 x $(get_test_count 0002) - tests proc_dostring()"
810 echo "0003 x $(get_test_count 0003) - tests proc_dointvec()"
811 echo "0004 x $(get_test_count 0004) - tests proc_douintvec()"
812 echo "0005 x $(get_test_count 0005) - tests proc_douintvec() array"
813 echo "0006 x $(get_test_count 0006) - tests proc_do_large_bitmap()"
814 echo "0007 x $(get_test_count 0007) - tests setting sysctl from kernel boot param"
815 echo "0008 x $(get_test_count 0008) - tests sysctl macro values match"
815list_tests()
816{
817 echo "Test ID list:"
818 echo
819 echo "TEST_ID x NUM_TEST"
820 echo "TEST_ID: Test ID"
821 echo "NUM_TESTS: Number of recommended times to run the test"
822 echo
823 echo "0001 x $(get_test_count 0001) - tests proc_dointvec_minmax()"
824 echo "0002 x $(get_test_count 0002) - tests proc_dostring()"
825 echo "0003 x $(get_test_count 0003) - tests proc_dointvec()"
826 echo "0004 x $(get_test_count 0004) - tests proc_douintvec()"
827 echo "0005 x $(get_test_count 0005) - tests proc_douintvec() array"
828 echo "0006 x $(get_test_count 0006) - tests proc_do_large_bitmap()"
829 echo "0007 x $(get_test_count 0007) - tests setting sysctl from kernel boot param"
830 echo "0008 x $(get_test_count 0008) - tests sysctl macro values match"
831 echo "0009 x $(get_test_count 0009) - tests sysct unregister"
816}
817
818usage()
819{
820 NUM_TESTS=$(grep -o ' ' <<<"$ALL_TESTS" | grep -c .)
821 let NUM_TESTS=$NUM_TESTS+1
822 MAX_TEST=$(printf "%04d\n" $NUM_TESTS)
823 echo "Usage: $0 [ -t <4-number-digit> ] | [ -w <4-number-digit> ] |"

--- 168 unchanged lines hidden ---
832}
833
834usage()
835{
836 NUM_TESTS=$(grep -o ' ' <<<"$ALL_TESTS" | grep -c .)
837 let NUM_TESTS=$NUM_TESTS+1
838 MAX_TEST=$(printf "%04d\n" $NUM_TESTS)
839 echo "Usage: $0 [ -t <4-number-digit> ] | [ -w <4-number-digit> ] |"

--- 168 unchanged lines hidden ---