Skip to content

Commit 223c0fa

Browse files
committed
testing/test_runner: Always mount new bpffs
Since we run in a separate mount namespace, we should always mount a new bpffs during setup. This way, we are sure the bpffs instance will be removed once we exit the test run, which ensures that no pinned programs are left at the end of the test. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
1 parent 9f9170b commit 223c0fa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/testing/test_runner.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ check_prereq()
242242
if [ "$max_locked_mem" != "unlimited" ]; then
243243
ulimit -l unlimited || die "Unable to set ulimit"
244244
fi
245+
246+
mount -t bpf bpf /sys/fs/bpf/ || die "Unable to mount bpffs"
245247
}
246248

247249
gen_nsname()
@@ -301,10 +303,6 @@ init_ns()
301303
OUTSIDE_IP6="${IP6_PREFIX}1"
302304
OUTSIDE_IP4="${IP4_PREFIX}1"
303305

304-
if ! mount | grep -q /sys/fs/bpf; then
305-
mount -t bpf bpf /sys/fs/bpf/
306-
fi
307-
308306
ip netns add "$nsname"
309307
ip link add dev "$nsname" type veth peer name "$peername"
310308
set_sysctls $nsname

0 commit comments

Comments
 (0)