~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/bpf/test_kmod.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/bpf/test_kmod.sh (Version linux-6.12-rc7) and /tools/testing/selftests/bpf/test_kmod.sh (Version linux-5.17.15)


  1 #!/bin/sh                                           1 #!/bin/sh
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3                                                     3 
  4 # Usage:                                       << 
  5 # ./test_kmod.sh [module_param]...             << 
  6 # Ex.: ./test_kmod.sh test_range=1,3           << 
  7 # All the parameters are passed to the kernel  << 
  8                                                << 
  9 # Kselftest framework requirement - SKIP code       4 # Kselftest framework requirement - SKIP code is 4.
 10 ksft_skip=4                                         5 ksft_skip=4
 11                                                     6 
 12 msg="skip all tests:"                               7 msg="skip all tests:"
 13 if [ "$(id -u)" != "0" ]; then                      8 if [ "$(id -u)" != "0" ]; then
 14         echo $msg please run this as root >&2       9         echo $msg please run this as root >&2
 15         exit $ksft_skip                            10         exit $ksft_skip
 16 fi                                                 11 fi
 17                                                    12 
 18 if [ "$building_out_of_srctree" ]; then            13 if [ "$building_out_of_srctree" ]; then
 19         # We are in linux-build/kselftest/bpf      14         # We are in linux-build/kselftest/bpf
 20         OUTPUT=../../                              15         OUTPUT=../../
 21 else                                               16 else
 22         # We are in linux/tools/testing/selfte     17         # We are in linux/tools/testing/selftests/bpf
 23         OUTPUT=../../../../                        18         OUTPUT=../../../../
 24 fi                                                 19 fi
 25                                                    20 
 26 test_run()                                         21 test_run()
 27 {                                                  22 {
 28         sysctl -w net.core.bpf_jit_enable=$1 2     23         sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
 29         sysctl -w net.core.bpf_jit_harden=$2 2     24         sysctl -w net.core.bpf_jit_harden=$2 2>&1 > /dev/null
 30                                                    25 
 31         echo "[ JIT enabled:$1 hardened:$2 ]"      26         echo "[ JIT enabled:$1 hardened:$2 ]"
 32         shift 2                                << 
 33         dmesg -C                                   27         dmesg -C
 34         if [ -f ${OUTPUT}/lib/test_bpf.ko ]; t     28         if [ -f ${OUTPUT}/lib/test_bpf.ko ]; then
 35                 insmod ${OUTPUT}/lib/test_bpf. !!  29                 insmod ${OUTPUT}/lib/test_bpf.ko 2> /dev/null
 36                 if [ $? -ne 0 ]; then              30                 if [ $? -ne 0 ]; then
 37                         rc=1                       31                         rc=1
 38                 fi                                 32                 fi
 39         else                                       33         else
 40                 # Use modprobe dry run to chec     34                 # Use modprobe dry run to check for missing test_bpf module
 41                 if ! /sbin/modprobe -q -n test !!  35                 if ! /sbin/modprobe -q -n test_bpf; then
 42                         echo "test_bpf: [SKIP]     36                         echo "test_bpf: [SKIP]"
 43                 elif /sbin/modprobe -q test_bp !!  37                 elif /sbin/modprobe -q test_bpf; then
 44                         echo "test_bpf: ok"        38                         echo "test_bpf: ok"
 45                 else                               39                 else
 46                         echo "test_bpf: [FAIL]     40                         echo "test_bpf: [FAIL]"
 47                         rc=1                       41                         rc=1
 48                 fi                                 42                 fi
 49         fi                                         43         fi
 50         rmmod  test_bpf 2> /dev/null               44         rmmod  test_bpf 2> /dev/null
 51         dmesg | grep FAIL                          45         dmesg | grep FAIL
 52 }                                                  46 }
 53                                                    47 
 54 test_save()                                        48 test_save()
 55 {                                                  49 {
 56         JE=`sysctl -n net.core.bpf_jit_enable`     50         JE=`sysctl -n net.core.bpf_jit_enable`
 57         JH=`sysctl -n net.core.bpf_jit_harden`     51         JH=`sysctl -n net.core.bpf_jit_harden`
 58 }                                                  52 }
 59                                                    53 
 60 test_restore()                                     54 test_restore()
 61 {                                                  55 {
 62         sysctl -w net.core.bpf_jit_enable=$JE      56         sysctl -w net.core.bpf_jit_enable=$JE 2>&1 > /dev/null
 63         sysctl -w net.core.bpf_jit_harden=$JH      57         sysctl -w net.core.bpf_jit_harden=$JH 2>&1 > /dev/null
 64 }                                                  58 }
 65                                                    59 
 66 rc=0                                               60 rc=0
 67 test_save                                          61 test_save
 68 test_run 0 0 "$@"                              !!  62 test_run 0 0
 69 test_run 1 0 "$@"                              !!  63 test_run 1 0
 70 test_run 1 1 "$@"                              !!  64 test_run 1 1
 71 test_run 1 2 "$@"                              !!  65 test_run 1 2
 72 test_restore                                       66 test_restore
 73 exit $rc                                           67 exit $rc
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php