Re: [PATCH v2 2/2] selftests: add option to list all available tests

From: lizhijian@xxxxxxxxxxx
Date: Thu Jan 13 2022 - 00:53:22 EST


ping


On 02/12/2021 10:29, Li Zhijian wrote:
> $ ./fcnal-test.sh -l
> Test names: ipv4_ping ipv4_tcp ipv4_udp ipv4_bind ipv4_runtime ipv4_netfilter
> ipv6_ping ipv6_tcp ipv6_udp ipv6_bind ipv6_runtime ipv6_netfilter
> use_cases
>
> Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxxxxx>
> ---
> tools/testing/selftests/net/fcnal-test.sh | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
> index 5cb59947eed2..7e78be99aa4c 100755
> --- a/tools/testing/selftests/net/fcnal-test.sh
> +++ b/tools/testing/selftests/net/fcnal-test.sh
> @@ -3993,6 +3993,7 @@ usage: ${0##*/} OPTS
> -4 IPv4 tests only
> -6 IPv6 tests only
> -t <test> Test name/set to run
> + -l List all available tests
> -p Pause on fail
> -P Pause after each test
> -v Be verbose
> @@ -4006,10 +4007,15 @@ TESTS_IPV4="ipv4_ping ipv4_tcp ipv4_udp ipv4_bind ipv4_runtime ipv4_netfilter"
> TESTS_IPV6="ipv6_ping ipv6_tcp ipv6_udp ipv6_bind ipv6_runtime ipv6_netfilter"
> TESTS_OTHER="use_cases"
>
> +list()
> +{
> + echo "Test names: $TESTS_IPV4 $TESTS_IPV6 $TESTS_OTHER"
> +}
> +
> PAUSE_ON_FAIL=no
> PAUSE=no
>
> -while getopts :46t:pPvh o
> +while getopts :46lt:pPvh o
> do
> case $o in
> 4) TESTS=ipv4;;
> @@ -4018,6 +4024,7 @@ do
> p) PAUSE_ON_FAIL=yes;;
> P) PAUSE=yes;;
> v) VERBOSE=1;;
> + l) list; exit 0;;
> h) usage; exit 0;;
> *) usage; exit 1;;
> esac