lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 18 Apr 2024 10:41:36 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Lukasz Majewski <lukma@...x.de>, netdev@...r.kernel.org
Cc: Andrew Lunn <andrew@...n.ch>, Eric Dumazet <edumazet@...gle.com>, 
 Vladimir Oltean <olteanv@...il.com>, "David S. Miller"
 <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,  Oleksij Rempel
 <o.rempel@...gutronix.de>, Tristram.Ha@...rochip.com, Sebastian Andrzej
 Siewior <bigeasy@...utronix.de>, Ravi Gunasekaran <r-gunasekaran@...com>,
 Simon Horman <horms@...nel.org>, Nikita Zhandarovich
 <n.zhandarovich@...tech.ru>, Murali Karicheri <m-karicheri2@...com>, Jiri
 Pirko <jiri@...nulli.us>, Dan Carpenter <dan.carpenter@...aro.org>,  Ziyang
 Xuan <william.xuanziyang@...wei.com>, Shigeru Yoshida
 <syoshida@...hat.com>, "Ricardo B. Marliere" <ricardo@...liere.net>,
 linux-kernel@...r.kernel.org
Subject: Re: [net-next PATCH v5 2/4] test: hsr: Move common code to
 hsr_common.sh file

On Mon, 2024-04-15 at 14:49 +0200, Lukasz Majewski wrote:
> Some of the code already present in the hsr_ping.sh test program can be
> moved to a separate script file, so it can be reused by other HSR
> functionality (like HSR-SAN) tests.
> 
> Signed-off-by: Lukasz Majewski <lukma@...x.de>
> ---
>  tools/testing/selftests/net/hsr/hsr_common.sh | 96 +++++++++++++++++++
>  tools/testing/selftests/net/hsr/hsr_ping.sh   | 93 +-----------------
>  2 files changed, 99 insertions(+), 90 deletions(-)
>  create mode 100644 tools/testing/selftests/net/hsr/hsr_common.sh
> 
> diff --git a/tools/testing/selftests/net/hsr/hsr_common.sh b/tools/testing/selftests/net/hsr/hsr_common.sh
> new file mode 100644
> index 000000000000..822165391573
> --- /dev/null
> +++ b/tools/testing/selftests/net/hsr/hsr_common.sh
> @@ -0,0 +1,96 @@
> +# SPDX-License-Identifier: GPL-2.0
> +# Common code for HSR testing scripts
> +
> +ret=0
> +ksft_skip=4
> +
> +sec=$(date +%s)
> +rndh=$(printf %x $sec)-$(mktemp -u XXXXXX)
> +ns1="ns1-$rndh"
> +ns2="ns2-$rndh"
> +ns3="ns3-$rndh"

Since you are touching the initialization code, please move it to using
the lib.sh helpers. The above will become:

setup_ns ns1 ns2 ns3

> +
> +cleanup()
> +{
> +	local netns
> +	for netns in "$ns1" "$ns2" "$ns3" ;do
> +		ip netns del $netns
> +	done
> +}

And this:

	cleanup_all_ns


Thanks,

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ