Re: [PATCH] tests: add skips when IPv6 is not supported

Masatake YAMATO <[email protected]>
Newsgroups org.kernel.vger.util-linux
Organization Red Hat Japan, K.K.
Message-ID <[email protected]>
From: LiviaMedeiros <[email protected]>
Subject: [PATCH] tests: add skips when IPv6 is not supported
Date: Fri, 13 Dec 2024 20:38:27 +0800

> From: LiviaMedeiros <[email protected]>
> 
> Before this change on systems with disabled IPv6 (e.g. `CONFIG_IPV6 is
> not set` in kernel config), `lsfd/mkfds-tcp6` and `lsfd/mkfds-udp6`
> were failing, and `lsfd/option-inet` was hanging forever, making it
> impossible to complete the tests.
> 
> Signed-off-by: LiviaMedeiros <[email protected]>
> ---
>  tests/functions.sh        | 6 ++++++
>  tests/ts/lsfd/mkfds-tcp6  | 1 +
>  tests/ts/lsfd/mkfds-udp6  | 1 +
>  tests/ts/lsfd/option-inet | 1 +
>  4 files changed, 9 insertions(+)
> 
> diff --git a/tests/functions.sh b/tests/functions.sh
> index 630166871..add50440b 100644
> --- a/tests/functions.sh
> +++ b/tests/functions.sh
> @@ -1195,3 +1195,9 @@ function ts_check_enosys_syscalls {
>  function ts_skip_docker {
>         test -e /.dockerenv && ts_skip "unsupported in docker environment"
>  }
> +
> +function ts_check_ipv6 {
> +       if [ ! -e /proc/net/if_inet6 ]; then
> +               ts_skip "IPv6 is not supported"
> +       fi
> +}
> diff --git a/tests/ts/lsfd/mkfds-tcp6 b/tests/ts/lsfd/mkfds-tcp6
> index bffa630c4..414777f4a 100755
> --- a/tests/ts/lsfd/mkfds-tcp6
> +++ b/tests/ts/lsfd/mkfds-tcp6
> @@ -23,6 +23,7 @@ ts_init "$*"
>  ts_check_test_command "$TS_CMD_LSFD"
>  ts_check_test_command "$TS_HELPER_MKFDS"
>  ts_check_native_byteorder
> +ts_check_ipv6
>  ts_skip_docker
> 
>  ts_cd "$TS_OUTDIR"
> diff --git a/tests/ts/lsfd/mkfds-udp6 b/tests/ts/lsfd/mkfds-udp6
> index 26bdacd7c..59b1c06a2 100755
> --- a/tests/ts/lsfd/mkfds-udp6
> +++ b/tests/ts/lsfd/mkfds-udp6
> @@ -23,6 +23,7 @@ ts_init "$*"
>  ts_check_test_command "$TS_CMD_LSFD"
>  ts_check_test_command "$TS_HELPER_MKFDS"
>  ts_check_native_byteorder
> +ts_check_ipv6
>  ts_skip_docker
> 
>  ts_cd "$TS_OUTDIR"
> diff --git a/tests/ts/lsfd/option-inet b/tests/ts/lsfd/option-inet
> index 7ca883751..f679f121d 100755
> --- a/tests/ts/lsfd/option-inet
> +++ b/tests/ts/lsfd/option-inet
> @@ -24,6 +24,7 @@ ts_skip_docker
> 
>  ts_check_test_command "$TS_CMD_LSFD"
>  ts_check_test_command "$TS_HELPER_MKFDS"
> +ts_check_ipv6
> 
>  ts_check_prog "mkfifo"
> 
> --
> 2.47.1
> 

Looks good to me.
Reviewed-by: Masatake YAMATO <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.