All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jian Yang <jianyang.kernel@gmail.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: Soheil Hassas Yeganeh <soheil@google.com>,
	Willem de Bruijn <willemb@google.com>,
	Jian Yang <jianyang@google.com>
Subject: [PATCH net-next 1/5] selftests: txtimestamp: allow individual txtimestamp tests.
Date: Tue, 17 Mar 2020 12:25:05 -0700	[thread overview]
Message-ID: <20200317192509.150725-2-jianyang.kernel@gmail.com> (raw)
In-Reply-To: <20200317192509.150725-1-jianyang.kernel@gmail.com>

From: Jian Yang <jianyang@google.com>

The wrapper script txtimestamp.sh executes a pre-defined list of testcases
sequentially without configuration options available.

Add an option (-r/--run) to setup the test namespace and pass remaining
arguments to txtimestamp binary. The script still runs all tests when no
argument is passed.

Signed-off-by: Jian Yang <jianyang@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
---
 .../networking/timestamping/txtimestamp.sh    | 31 +++++++++++++++++--
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/networking/timestamping/txtimestamp.sh b/tools/testing/selftests/networking/timestamping/txtimestamp.sh
index df0d86ca72b7..70a8cda7fd53 100755
--- a/tools/testing/selftests/networking/timestamping/txtimestamp.sh
+++ b/tools/testing/selftests/networking/timestamping/txtimestamp.sh
@@ -43,15 +43,40 @@ run_test_tcpudpraw() {
 }
 
 run_test_all() {
+	setup
 	run_test_tcpudpraw		# setsockopt
 	run_test_tcpudpraw -C		# cmsg
 	run_test_tcpudpraw -n		# timestamp w/o data
+	echo "OK. All tests passed"
+}
+
+run_test_one() {
+	setup
+	./txtimestamp $@
+}
+
+usage() {
+	echo "Usage: $0 [ -r | --run ] <txtimestamp args> | [ -h | --help ]"
+	echo "  (no args)  Run all tests"
+	echo "  -r|--run  Run an individual test with arguments"
+	echo "  -h|--help Help"
+}
+
+main() {
+	if [[ $# -eq 0 ]]; then
+		run_test_all
+	else
+		if [[ "$1" = "-r" || "$1" == "--run" ]]; then
+			shift
+			run_test_one $@
+		else
+			usage
+		fi
+	fi
 }
 
 if [[ "$(ip netns identify)" == "root" ]]; then
 	../../net/in_netns.sh $0 $@
 else
-	setup
-	run_test_all
-	echo "OK. All tests passed"
+	main $@
 fi
-- 
2.25.1.481.gfbce0eb801-goog


  reply	other threads:[~2020-03-17 19:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 19:25 [PATCH net-next 0/5] selftests: expand txtimestamp with new features Jian Yang
2020-03-17 19:25 ` Jian Yang [this message]
2020-03-17 19:25 ` [PATCH net-next 2/5] selftests: txtimestamp: allow printing latencies in nsec Jian Yang
2020-03-17 19:25 ` [PATCH net-next 3/5] selftests: txtimestamp: add new command-line flags Jian Yang
2020-03-17 19:25 ` [PATCH net-next 4/5] selftests: txtimestamp: add support for epoll() Jian Yang
2020-03-17 19:25 ` [PATCH net-next 5/5] selftests: txtimestamp: print statistics for timestamp events Jian Yang
2020-03-17 20:33 ` [PATCH net-next 0/5] selftests: expand txtimestamp with new features Jakub Kicinski
2020-03-17 20:39   ` Willem de Bruijn
2020-03-17 21:54     ` Jakub Kicinski
2020-03-22  3:13     ` David Miller
2020-03-22  3:13 ` David Miller

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=20200317192509.150725-2-jianyang.kernel@gmail.com \
    --to=jianyang.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jianyang@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=soheil@google.com \
    --cc=willemb@google.com \
    /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.