Commit 4365f716 authored by Matthieu Baerts (NGI0)'s avatar Matthieu Baerts (NGI0) Committed by Geliang Tang
Browse files

selftests: mptcp: simult flows: fix shellcheck warnings

mainline inclusion
from mainline-v6.9-rc1
commit 2aebd3579d90e12cadc1bf93c524e2f422cd1c49
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9VYQ9
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=2aebd3579d90e12cadc1bf93c524e2f422cd1c49



--------------------------------

shellcheck recently helped to prevent issues. It is then good to fix the
other harmless issues in order to spot "real" ones later.

Here, two categories of warnings are now ignored:

- SC2317: Command appears to be unreachable. The cleanup() function is
  invoked indirectly via the EXIT trap.

- SC2086: Double quote to prevent globbing and word splitting. This is
  recommended, but the current usage is correct and there is no need to
  do all these modifications to be compliant with this rule.

For the modifications:

  - SC2034: ksft_skip appears unused.
  - SC2004: $/${} is unnecessary on arithmetic variables.

Now this script is shellcheck (0.9.0) compliant. We can easily spot new
issues.

Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-11-bc79e6e5e6a0@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarJackie Liu <liuyun01@kylinos.cn>
Signed-off-by: default avatarGeliang Tang <tanggeliang@kylinos.cn>
parent f3fa0071
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

# Double quotes to prevent globbing and word splitting is recommended in new
# code but we accept it, especially because there were too many before having
# address all other issues detected by shellcheck.
#shellcheck disable=SC2086

. "$(dirname "${0}")/mptcp_lib.sh"

ns1=""
ns2=""
ns3=""
capture=false
ksft_skip=4
timeout_poll=30
timeout_test=$((timeout_poll * 2 + 1))
test_cnt=1
@@ -28,6 +32,8 @@ usage() {
	echo -e "\t-d: debug this script"
}

# This function is used in the cleanup trap
#shellcheck disable=SC2317
cleanup()
{
	rm -f "$cout" "$sout"
@@ -120,7 +126,7 @@ do_transfer()
	local sin=$2
	local max_time=$3
	local port
	port=$((10000+$test_cnt))
	port=$((10000+test_cnt))
	test_cnt=$((test_cnt+1))

	:> "$cout"