Skip to content

Commit c44e276

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 4ceb4fc commit c44e276

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()
@@ -294,10 +296,6 @@ init_ns()
294296
OUTSIDE_IP6="${IP6_PREFIX}1"
295297
OUTSIDE_IP4="${IP4_PREFIX}1"
296298

297-
if ! mount | grep -q /sys/fs/bpf; then
298-
mount -t bpf bpf /sys/fs/bpf/
299-
fi
300-
301299
ip netns add "$nsname"
302300
ip link add dev "$nsname" type veth peer name "$peername"
303301
set_sysctls $nsname

0 commit comments

Comments
 (0)