[Devel] [PATCH vz10 4/4] selftests: net: skip test_bpf if kernel module is unavailable

Aleksei Oladko aleksey.oladko at virtuozzo.com
Sun Jan 4 04:50:28 MSK 2026


The test_bpf.sh kselftest relies on the test_bpf kernel module to be
present and loadable. If the module in not built or not available on
the system, modprobe fails and the test is reported as a failure.

Add an explicit check for the availability of the test_bpf module
and skip the test when the module is missing.

https://virtuozzo.atlassian.net/browse/VSTOR-121804

Signed-off-by: Aleksei Oladko <aleksey.oladko at virtuozzo.com>
---
 tools/testing/selftests/net/test_bpf.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/test_bpf.sh b/tools/testing/selftests/net/test_bpf.sh
index 65677909c574..cfa9d676123c 100755
--- a/tools/testing/selftests/net/test_bpf.sh
+++ b/tools/testing/selftests/net/test_bpf.sh
@@ -1,7 +1,10 @@
-#!/bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 # Runs bpf test using test_bpf kernel module
 
+source lib.sh
+modinfo test_bpf || exit $ksft_skip
+
 if /sbin/modprobe -q test_bpf ; then
 	/sbin/modprobe -q -r test_bpf;
 	echo "test_bpf: ok";
-- 
2.43.0



More information about the Devel mailing list