netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roopa Prabhu <roopa@nvidia.com>
To: Jaehee Park <jhpark1013@gmail.com>,
	outreachy@lists.linux.dev, Julia Denham <jdenham@redhat.com>,
	Roopa Prabhu <roopa.prabhu@gmail.com>,
	Stefano Brivio <sbrivio@redhat.com>,
	netdev@vger.kernel.org, David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH net-next v2] selftests: net: vrf_strict_mode_test: add support to select a test to run
Date: Sat, 23 Apr 2022 20:48:29 -0700	[thread overview]
Message-ID: <c2eb6a8a-531e-7a6e-267c-23577f2e95e8@nvidia.com> (raw)
In-Reply-To: <20220421164022.GA3485225@jaehee-ThinkPad-X1-Extreme>


On 4/21/22 09:40, Jaehee Park wrote:
> Add a boilerplate test loop to run all tests in
> vrf_strict_mode_test.sh. Add a -t flag that allows a selected test to
> run.
>
> Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
> ---

Thanks Jaehee.

CC, David Ahern

David, this might be an overkill for this test. But nonetheless a step 
towards bringing some uniformity in the tests.

next step is to ideally move this to a library to remove repeating this 
boilerplate loop in every test.


.../selftests/net/vrf_strict_mode_test.sh | 31 ++++++++++++++++++-

>   1 file changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/vrf_strict_mode_test.sh b/tools/testing/selftests/net/vrf_strict_mode_test.sh
> index 865d53c1781c..ca4379265706 100755
> --- a/tools/testing/selftests/net/vrf_strict_mode_test.sh
> +++ b/tools/testing/selftests/net/vrf_strict_mode_test.sh
> @@ -14,6 +14,8 @@ INIT_NETNS_NAME="init"
>   
>   PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no}
>   
> +TESTS="init testns mix"
> +
>   log_test()
>   {
>   	local rc=$1
> @@ -353,6 +355,23 @@ vrf_strict_mode_tests()
>   	vrf_strict_mode_tests_mix
>   }
>   
> +usage()
> +{
> +	cat <<EOF
> +usage: ${0##*/} OPTS
> +
> +	-t <test> Test(s) to run (default: all)
> +		  (options: $TESTS)
> +EOF
> +}
> +while getopts ":t:h" opt; do
> +	case $opt in
> +		t) TESTS=$OPTARG;;
> +		h) usage; exit 0;;
> +		*) usage; exit 1;;
> +	esac
> +done
> +
>   vrf_strict_mode_check_support()
>   {
>   	local nsname=$1
> @@ -391,7 +410,17 @@ fi
>   cleanup &> /dev/null
>   
>   setup
> -vrf_strict_mode_tests
> +for t in $TESTS
> +do
> +	case $t in
> +	vrf_strict_mode_tests_init|init) vrf_strict_mode_tests_init;;
> +	vrf_strict_mode_tests_testns|testns) vrf_strict_mode_tests_testns;;
> +	vrf_strict_mode_tests_mix|mix) vrf_strict_mode_tests_mix;;
> +
> +	help) echo "Test names: $TESTS"; exit 0;;
> +
> +	esac
> +done
>   cleanup
>   
>   print_log_test_results

  reply	other threads:[~2022-04-24  3:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 16:40 [PATCH net-next v2] selftests: net: vrf_strict_mode_test: add support to select a test to run Jaehee Park
2022-04-24  3:48 ` Roopa Prabhu [this message]
2022-04-24 16:29   ` David Ahern
2022-04-28 16:50     ` Jaehee

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=c2eb6a8a-531e-7a6e-267c-23577f2e95e8@nvidia.com \
    --to=roopa@nvidia.com \
    --cc=dsahern@gmail.com \
    --cc=jdenham@redhat.com \
    --cc=jhpark1013@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=outreachy@lists.linux.dev \
    --cc=roopa.prabhu@gmail.com \
    --cc=sbrivio@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).