* [PATCH net-next v2] selftests: net: vrf_strict_mode_test: add support to select a test to run
@ 2022-04-21 16:40 Jaehee Park
2022-04-24 3:48 ` Roopa Prabhu
0 siblings, 1 reply; 4+ messages in thread
From: Jaehee Park @ 2022-04-21 16:40 UTC (permalink / raw)
To: outreachy, Julia Denham, Roopa Prabhu, Stefano Brivio, netdev,
jhpark1013, Roopa Prabhu
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>
---
.../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
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] selftests: net: vrf_strict_mode_test: add support to select a test to run
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
2022-04-24 16:29 ` David Ahern
0 siblings, 1 reply; 4+ messages in thread
From: Roopa Prabhu @ 2022-04-24 3:48 UTC (permalink / raw)
To: Jaehee Park, outreachy, Julia Denham, Roopa Prabhu,
Stefano Brivio, netdev, David Ahern
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] selftests: net: vrf_strict_mode_test: add support to select a test to run
2022-04-24 3:48 ` Roopa Prabhu
@ 2022-04-24 16:29 ` David Ahern
2022-04-28 16:50 ` Jaehee
0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2022-04-24 16:29 UTC (permalink / raw)
To: Roopa Prabhu, Jaehee Park, outreachy, Julia Denham, Roopa Prabhu,
Stefano Brivio, netdev
On 4/23/22 9:48 PM, Roopa Prabhu wrote:
>
> 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
>> }
Add:
################################################################################
# usage
>> +usage()
>> +{
>> + cat <<EOF
>> +usage: ${0##*/} OPTS
>> +
>> + -t <test> Test(s) to run (default: all)
>> + (options: $TESTS)
>> +EOF
>> +}
Add:
################################################################################
# main
>> +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
This change makes vrf_strict_mode_tests unused. Move the log_section
before the tests in that function to the function handling the test.
e.g., move 'log_section "VRF strict_mode test on init network
namespace"' to vrf_strict_mode_tests_init.
Alsom, make sure you are using tabs for indentation vs spaces.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] selftests: net: vrf_strict_mode_test: add support to select a test to run
2022-04-24 16:29 ` David Ahern
@ 2022-04-28 16:50 ` Jaehee
0 siblings, 0 replies; 4+ messages in thread
From: Jaehee @ 2022-04-28 16:50 UTC (permalink / raw)
To: David Ahern
Cc: Roopa Prabhu, Outreachy Linux Kernel, Julia Denham, Roopa Prabhu,
Stefano Brivio, netdev
On Sun, Apr 24, 2022 at 12:29 PM David Ahern <dsahern@gmail.com> wrote:
>
> On 4/23/22 9:48 PM, Roopa Prabhu wrote:
> >
> > 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
> >> }
>
> Add:
>
> ################################################################################
> # usage
>
> >> +usage()
> >> +{
> >> + cat <<EOF
> >> +usage: ${0##*/} OPTS
> >> +
> >> + -t <test> Test(s) to run (default: all)
> >> + (options: $TESTS)
> >> +EOF
> >> +}
>
> Add:
>
> ################################################################################
> # main
>
> >> +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
>
> This change makes vrf_strict_mode_tests unused. Move the log_section
> before the tests in that function to the function handling the test.
> e.g., move 'log_section "VRF strict_mode test on init network
> namespace"' to vrf_strict_mode_tests_init.
>
> Alsom, make sure you are using tabs for indentation vs spaces.
Hi David,
Sorry about the delay in getting these fixes to you and thank you for
your review and comments! I've sent the revised patch just now.
Thanks,
Jaehee
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-28 16:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-04-24 16:29 ` David Ahern
2022-04-28 16:50 ` Jaehee
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.