]> www.infradead.org Git - users/hch/misc.git/commitdiff
selftests: net: check jq command is supported
authorWang Liang <wangliang74@huawei.com>
Mon, 13 Oct 2025 08:00:39 +0000 (16:00 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 14 Oct 2025 13:12:18 +0000 (15:12 +0200)
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>
tools/testing/selftests/net/rtnetlink.sh
tools/testing/selftests/net/vlan_bridge_binding.sh

index dbf77513f6179b06733c1c1faf19290cfc149136..163a084d525d5f7f6aecf74b61830a62d7ae1e21 100755 (executable)
@@ -1466,6 +1466,8 @@ usage: ${0##*/} OPTS
 EOF
 }
 
+require_command jq
+
 #check for needed privileges
 if [ "$(id -u)" -ne 0 ];then
        end_test "SKIP: Need root privileges"
index db481af9b6b34098e291481d9d331b6b3c512c5a..e8c02c64e03a47a3e1b71686f7d80c1a0f48b034 100755 (executable)
@@ -249,6 +249,8 @@ test_binding_toggle_off_when_upper_down()
        do_test_binding_off : "on->off when upper down"
 }
 
+require_command jq
+
 trap defer_scopes_cleanup EXIT
 setup_prepare
 tests_run