All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Baerts <matthieu.baerts@tessares.net>
To: mptcp@lists.linux.dev
Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
Subject: [PATCH mptcp-next 2/9] selftests: mptcp: join: exit after usage()
Date: Wed,  9 Feb 2022 22:25:13 +0100	[thread overview]
Message-ID: <20220209212520.2989291-3-matthieu.baerts@tessares.net> (raw)
In-Reply-To: <20220209212520.2989291-1-matthieu.baerts@tessares.net>

With an error if it is an unknown option.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 9bbb95837f73..327f4ace5153 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -2194,8 +2194,14 @@ all_tests()
 	userspace_tests
 }
 
+# [$1: error message]
 usage()
 {
+	if [ -n "${1}" ]; then
+		echo "${1}"
+		ret=1
+	fi
+
 	echo "mptcp_join usage:"
 	echo "  -f subflows_tests"
 	echo "  -e subflows_error_tests"
@@ -2217,6 +2223,8 @@ usage()
 	echo "  -C enable data checksum"
 	echo "  -i use ip mptcp"
 	echo "  -h help"
+
+	exit ${ret}
 }
 
 sin=$(mktemp)
@@ -2308,9 +2316,12 @@ while getopts 'fesltra64bpkdmuchCSi' opt; do
 			;;
 		i)
 			;;
-		h | *)
+		h)
 			usage
 			;;
+		*)
+			usage "Unknown option: -${opt}"
+			;;
 	esac
 done
 
-- 
2.34.1


  parent reply	other threads:[~2022-02-09 21:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 21:25 [PATCH mptcp-next 0/9] Refactor mptcp_join.sh Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 1/9] selftests: mptcp: join: allow running -cCi Matthieu Baerts
2022-02-10 14:53   ` Paolo Abeni
2022-02-11 17:30     ` Matthieu Baerts
2022-02-11 18:56       ` Paolo Abeni
2022-02-09 21:25 ` Matthieu Baerts [this message]
2022-02-09 21:25 ` [PATCH mptcp-next 3/9] selftests: mptcp: join: option to execute specific tests Matthieu Baerts
2022-02-10  0:36   ` Mat Martineau
2022-02-10 10:04     ` Paolo Abeni
2022-02-10 10:42       ` Matthieu Baerts
2022-02-10 15:11         ` Paolo Abeni
2022-02-16 15:50           ` Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 4/9] selftests: mptcp: join: remove unused vars Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 5/9] selftests: mptcp: join: create tmp files only if needed Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 6/9] selftests: mptcp: join: check for tools " Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 7/9] selftests: mptcp: join: clarify local/global vars Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 8/9] selftests: mptcp: join: avoid backquotes Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 9/9] selftests: mptcp: join: make it shellcheck compliant Matthieu Baerts
2022-02-10  0:22 ` [PATCH mptcp-next 0/9] Refactor mptcp_join.sh Mat Martineau
2022-02-11 17:34   ` Matthieu Baerts

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=20220209212520.2989291-3-matthieu.baerts@tessares.net \
    --to=matthieu.baerts@tessares.net \
    --cc=mptcp@lists.linux.dev \
    /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.