summaryrefslogtreecommitdiff
path: root/samples/bpf/test_cgrp2_sock2.sh
diff options
context:
space:
mode:
authorDaniel T. Lee <danieltimlee@gmail.com>2023-01-15 16:16:05 +0900
committerAlexei Starovoitov <ast@kernel.org>2023-01-15 13:32:45 -0800
commitf20f064e84eb9c9229a7044e30f9b99720a8c2ea (patch)
treea854809a4c4a57d218cc855dc202dd88bcecee65 /samples/bpf/test_cgrp2_sock2.sh
parentd982a2e306954c9269a5e53561b38259e26f08bc (diff)
samples/bpf: refactor BPF functionality testing scripts
Currently, some test scripts are experiencing minor errors related to executing tests. $ sudo ./test_cgrp2_sock.sh ./test_cgrp2_sock.sh: 22: test_cgrp2_sock: not found This problem occurs because the path to the execution target is not properly specified. Therefore, this commit solves this problem by specifying a relative path to its executables. This commit also makes a concise refactoring of hard-coded BPF program names. Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com> Link: https://lore.kernel.org/r/20230115071613.125791-3-danieltimlee@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'samples/bpf/test_cgrp2_sock2.sh')
-rwxr-xr-xsamples/bpf/test_cgrp2_sock2.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/samples/bpf/test_cgrp2_sock2.sh b/samples/bpf/test_cgrp2_sock2.sh
index ac45828ed2bd..00cc8d15373c 100755
--- a/samples/bpf/test_cgrp2_sock2.sh
+++ b/samples/bpf/test_cgrp2_sock2.sh
@@ -2,7 +2,10 @@
# SPDX-License-Identifier: GPL-2.0
BPFFS=/sys/fs/bpf
+MY_DIR=$(dirname $0)
+TEST=$MY_DIR/test_cgrp2_sock2
LINK_PIN=$BPFFS/test_cgrp2_sock2
+BPF_PROG=$MY_DIR/sock_flags_kern.o
function config_device {
ip netns add at_ns0
@@ -36,7 +39,7 @@ function config_bpffs {
}
function attach_bpf {
- ./test_cgrp2_sock2 /tmp/cgroupv2/foo sock_flags_kern.o $1
+ $TEST /tmp/cgroupv2/foo $BPF_PROG $1
[ $? -ne 0 ] && exit 1
}