kill dentry_update_name_case()
[sfrench/cifs-2.6.git] / tools / testing / selftests / bpf / test_kmod.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3
4 SRC_TREE=../../../../
5
6 test_run()
7 {
8         sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
9         sysctl -w net.core.bpf_jit_harden=$2 2>&1 > /dev/null
10
11         echo "[ JIT enabled:$1 hardened:$2 ]"
12         dmesg -C
13         if [ -f ${SRC_TREE}/lib/test_bpf.ko ]; then
14                 insmod ${SRC_TREE}/lib/test_bpf.ko 2> /dev/null
15                 if [ $? -ne 0 ]; then
16                         rc=1
17                 fi
18         else
19                 # Use modprobe dry run to check for missing test_bpf module
20                 if ! /sbin/modprobe -q -n test_bpf; then
21                         echo "test_bpf: [SKIP]"
22                 elif /sbin/modprobe -q test_bpf; then
23                         echo "test_bpf: ok"
24                 else
25                         echo "test_bpf: [FAIL]"
26                         rc=1
27                 fi
28         fi
29         rmmod  test_bpf 2> /dev/null
30         dmesg | grep FAIL
31 }
32
33 test_save()
34 {
35         JE=`sysctl -n net.core.bpf_jit_enable`
36         JH=`sysctl -n net.core.bpf_jit_harden`
37 }
38
39 test_restore()
40 {
41         sysctl -w net.core.bpf_jit_enable=$JE 2>&1 > /dev/null
42         sysctl -w net.core.bpf_jit_harden=$JH 2>&1 > /dev/null
43 }
44
45 rc=0
46 test_save
47 test_run 0 0
48 test_run 1 0
49 test_run 1 1
50 test_run 1 2
51 test_restore
52 exit $rc