All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrei Gherzan <andrei.gherzan@canonical.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Shuah Khan <shuah@kernel.org>, Lina Wang <lina.wang@mediatek.com>,
	Maciej enczykowski <maze@google.com>
Cc: Andrei Gherzan <andrei.gherzan@canonical.com>,
	netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 3/3] selftests: net: Fix udpgro_frglist.sh shellcheck warnings and errors
Date: Fri, 27 Jan 2023 14:09:44 +0000	[thread overview]
Message-ID: <20230127140944.265135-3-andrei.gherzan@canonical.com> (raw)
In-Reply-To: <20230127140944.265135-1-andrei.gherzan@canonical.com>

This change fixes the following shellcheck warnings and errors:

* SC2155 (warning): Declare and assign separately to avoid masking return
  values.
* SC2124 (warning): Assigning an array to a string! Assign as array, or use
  instead of @ to concatenate.
* SC2034 (warning): ipv4_args appears unused. Verify use (or export if used
  externally).
* SC2242 (error): Can only exit with status 0-255. Other data should be
  written to stdout/stderr.
* SC2068 (error): Double quote array expansions to avoid re-splitting
  elements.

Fixes: edae34a3ed92 ("selftests net: add UDP GRO fraglist + bpf self-tests")
Signed-off-by: Andrei Gherzan <andrei.gherzan@canonical.com>
---
 tools/testing/selftests/net/udpgro_frglist.sh | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/testing/selftests/net/udpgro_frglist.sh b/tools/testing/selftests/net/udpgro_frglist.sh
index e1ca49de2491..97bf20e9afd8 100755
--- a/tools/testing/selftests/net/udpgro_frglist.sh
+++ b/tools/testing/selftests/net/udpgro_frglist.sh
@@ -3,7 +3,8 @@
 #
 # Run a series of udpgro benchmarks
 
-readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
+PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
+readonly PEER_NS
 
 BPF_FILE="../bpf/xdp_dummy.bpf.o"
 BPF_NAT6TO4_FILE="nat6to4.o"
@@ -19,7 +20,7 @@ trap cleanup EXIT
 
 run_one() {
 	# use 'rx' as separator between sender args and receiver args
-	local -r all="$@"
+	local -r all="$*"
 	local -r tx_args=${all%rx*}
 	local rx_args=${all#*rx}
 
@@ -56,13 +57,13 @@ run_one() {
 }
 
 run_in_netns() {
-	local -r args=$@
+	local -r args="$*"
   echo ${args}
 	./in_netns.sh $0 __subprocess ${args}
 }
 
 run_udp() {
-	local -r args=$@
+	local -r args="$*"
 
 	echo "udp gso - over veth touching data"
 	run_in_netns ${args} -u -S 0 rx -4 -v
@@ -72,7 +73,7 @@ run_udp() {
 }
 
 run_tcp() {
-	local -r args=$@
+	local -r args="$*"
 
 	echo "tcp - over veth touching data"
 	run_in_netns ${args} -t rx -4 -t
@@ -80,7 +81,6 @@ run_tcp() {
 
 run_all() {
 	local -r core_args="-l 4"
-	local -r ipv4_args="${core_args} -4  -D 192.168.1.1"
 	local -r ipv6_args="${core_args} -6  -D 2001:db8::1"
 
 	echo "ipv6"
@@ -90,19 +90,19 @@ run_all() {
 
 if [ ! -f ${BPF_FILE} ]; then
 	echo "Missing ${BPF_FILE}. Build bpf selftest first"
-	exit -1
+	exit 1
 fi
 
 if [ ! -f "$BPF_NAT6TO4_FILE" ]; then
 	echo "Missing nat6to4 helper. Build bpf nat6to4.o selftest first"
-	exit -1
+	exit 1
 fi
 
 if [[ $# -eq 0 ]]; then
 	run_all
 elif [[ $1 == "__subprocess" ]]; then
 	shift
-	run_one $@
+	run_one "$@"
 else
-	run_in_netns $@
+	run_in_netns "$@"
 fi
-- 
2.34.1


  parent reply	other threads:[~2023-01-27 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 14:09 [PATCH v3 1/3] selftests: net: .gitignore the scratch directory of bpf Andrei Gherzan
2023-01-27 14:09 ` [PATCH v3 2/3] selftests: net: Unify references to nat6to4.o when running udpgro_frglist.sh Andrei Gherzan
2023-01-27 14:09 ` Andrei Gherzan [this message]
2023-01-27 14:32   ` [PATCH v3 3/3] selftests: net: Fix udpgro_frglist.sh shellcheck warnings and errors Maciej Żenczykowski
2023-01-27 18:43     ` Andrei Gherzan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230127140944.265135-3-andrei.gherzan@canonical.com \
    --to=andrei.gherzan@canonical.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=lina.wang@mediatek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.