Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: net: check jq command is supported

The jq command is used in vlan_bridge_binding.sh, if it is not supported,
the test will spam the following log.

# ./vlan_bridge_binding.sh: line 51: jq: command not found
# ./vlan_bridge_binding.sh: line 51: jq: command not found
# ./vlan_bridge_binding.sh: line 51: jq: command not found
# ./vlan_bridge_binding.sh: line 51: jq: command not found
# ./vlan_bridge_binding.sh: line 51: jq: command not found
# TEST: Test bridge_binding on->off when lower down [FAIL]
# Got operstate of , expected 0

The rtnetlink.sh has the same problem. It makes sense to check if jq is
installed before running these tests. After this patch, the
vlan_bridge_binding.sh skipped if jq is not supported:

# timeout set to 3600
# selftests: net: vlan_bridge_binding.sh
# TEST: jq not installed [SKIP]

Fixes: dca12e9ab760 ("selftests: net: Add a VLAN bridge binding selftest")
Fixes: 6a414fd77f61 ("selftests: rtnetlink: Add an address proto test")
Signed-off-by: Wang Liang <wangliang74@huawei.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://patch.msgid.link/20251013080039.3035898-1-wangliang74@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Wang Liang and committed by
Paolo Abeni
4f86eb0a bd5afca1

+4
+2
tools/testing/selftests/net/rtnetlink.sh
··· 1466 1466 EOF 1467 1467 } 1468 1468 1469 + require_command jq 1470 + 1469 1471 #check for needed privileges 1470 1472 if [ "$(id -u)" -ne 0 ];then 1471 1473 end_test "SKIP: Need root privileges"
+2
tools/testing/selftests/net/vlan_bridge_binding.sh
··· 249 249 do_test_binding_off : "on->off when upper down" 250 250 } 251 251 252 + require_command jq 253 + 252 254 trap defer_scopes_cleanup EXIT 253 255 setup_prepare 254 256 tests_run