Skip to content

Commit

Permalink
selftests: mptcp: diag: fix bash warnings on older kernels
Browse files Browse the repository at this point in the history
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: 81ab772 ("selftests: mptcp: diag: check CURRESTAB counters")
Cc: [email protected]
Reviewed-by: Geliang Tang <[email protected]>
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
matttbe authored and davem330 committed Feb 18, 2024
1 parent 662f084 commit 694bd45
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/net/mptcp/diag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 694bd45

Please sign in to comment.