]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
selftests: mptcp: diag: fix bash warnings on older kernels
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Thu, 15 Feb 2024 18:25:36 +0000 (19:25 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 18 Feb 2024 10:25:00 +0000 (10:25 +0000)
Since the 'Fixes' commit mentioned below, the command that is executed
in __chk_nr() helper can return nothing if the feature is not supported.
This is the case when the MPTCP CURRESTAB counter is not supported.

To avoid this warning ...

  ./diag.sh: line 65: [: !=: unary operator expected

... we just need to surround '$nr' with double quotes, to support an
empty string when the feature is not supported.

Fixes: 81ab772819da ("selftests: mptcp: diag: check CURRESTAB counters")
Cc: stable@vger.kernel.org
Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/mptcp/diag.sh

index 04fcb8a077c995c768d222171c045caf2ab3c3b3..e0615c6ffb8d1c232466403a3e000dbc4b41bf92 100755 (executable)
@@ -62,8 +62,8 @@ __chk_nr()
        nr=$(eval $command)
 
        printf "%-50s" "$msg"
-       if [ $nr != $expected ]; then
-               if [ $nr = "$skip" ] && ! mptcp_lib_expect_all_features; then
+       if [ "$nr" != "$expected" ]; then
+               if [ "$nr" = "$skip" ] && ! mptcp_lib_expect_all_features; then
                        echo "[ skip ] Feature probably not supported"
                        mptcp_lib_result_skip "${msg}"
                else