tests: shell: Add socat availability feature test
Phil Sutter
reviewerPATCH 1/1 tests: shell: Add socat availability feature test
Several tests did this manually and skipped if unavail, others just implicitly depended on the tool.
Note that for the sake of simplicity, this will skip packetpath/tcp_options test entirely when it did a partial run before.
--- tests/shell/features/socat.sh | 4 ++++ tests/shell/testcases/packetpath/cgroupv2 | 7 ++----- tests/shell/testcases/packetpath/flowtables | 1 + tests/shell/testcases/packetpath/match_l4proto | 1 + tests/shell/testcases/packetpath/payload | 1 + tests/shell/testcases/packetpath/tcp_options | 9 +-------- tests/shell/testcases/packetpath/tcp_reset | 4 ++-- 7 files changed, 12 insertions(+), 15 deletions(-) create mode 100755 tests/shell/features/socat.sh
tests/shell/features/socat.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh + +# check whether socat is installed +socat -h >/dev/null 2>&1
tests/shell/testcases/packetpath/cgroupv2 +2 -5
@@ -1,5 +1,7 @@ #!/bin/bash +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_socat) + doit="$1" rc=0
@@ -11,11 +13,6 @@ rc=0 # should never match, it only exists so we # can create cgroupv2 match rules. -if ! socat -h > /dev/null ; then - echo "socat tool is missing" - exit 77 -fi - if [ ! -r /sys/fs/cgroup/cgroup.procs ] ;then echo "cgroup filesystem not available" exit 77
tests/shell/testcases/packetpath/flowtables +1 -0
@@ -1,5 +1,6 @@ #!/bin/bash +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_socat) # NFT_TEST_SKIP(NFT_TEST_SKIP_slow) set -x
tests/shell/testcases/packetpath/match_l4proto +1 -0
@@ -1,6 +1,7 @@ #!/bin/bash # NFT_TEST_REQUIRES(NFT_TEST_HAVE_netdev_egress) +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_socat) rnd=$(mktemp -u XXXXXXXX) ns1="nft1payload-$rnd"
tests/shell/testcases/packetpath/payload +1 -0
@@ -1,6 +1,7 @@ #!/bin/bash # NFT_TEST_REQUIRES(NFT_TEST_HAVE_netdev_egress) +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_socat) rnd=$(mktemp -u XXXXXXXX) ns1="nft1payload-$rnd"
tests/shell/testcases/packetpath/tcp_options +1 -8
@@ -1,9 +1,7 @@ #!/bin/bash # NFT_TEST_REQUIRES(NFT_TEST_HAVE_reset_tcp_options) - -have_socat="no" -socat -h > /dev/null && have_socat="yes" +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_socat) ip link set lo up
@@ -33,11 +31,6 @@ if [ $? -ne 0 ]; then exit 1 fi -if [ $have_socat != "yes" ]; then - echo "Ran partial test, socat not available (skipped)" - exit 77 -fi - # This will fail (drop in output -> connect fails with eperm) socat -u STDIN TCP:127.0.0.1:22345,connect-timeout=1 < /dev/null > /dev/null
tests/shell/testcases/packetpath/tcp_reset +2 -2
@@ -1,10 +1,10 @@ #!/bin/bash +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_socat) + # regression check for kernel commit # netfilter: nf_reject: init skb->dev for reset packet -socat -h > /dev/null || exit 77 - ip link set lo up $NFT -f - <<EOF
Signature · 1 line
2.48.1
Quoted 5 lines · Phil Sutter
Several tests did this manually and skipped if unavail, others just implicitly depended on the tool.
Note that for the sake of simplicity, this will skip packetpath/tcp_options test entirely when it did a partial run before.
I don't mind skipping it entirely.
Phil Sutter
reviewerQuoted 10 lines · Florian Westphal
Quoted 5 lines · Phil Sutter
Several tests did this manually and skipped if unavail, others just implicitly depended on the tool.
Note that for the sake of simplicity, this will skip packetpath/tcp_options test entirely when it did a partial run before.
I don't mind skipping it entirely.
Reviewed-by Florian Westphal <[email protected]>
Thanks, patch applied.