Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Aaron Conole <aconole@redhat.com>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Pravin B Shelar <pshelar@ovn.org>,
	dev@openvswitch.org,  Ilya Maximets <i.maximets@ovn.org>,
	Simon Horman <horms@ovn.org>,
	Eelco Chaudron <echaudro@redhat.com>,
	 Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org
Subject: Re: [RFC 4/7] selftests: openvswitch: delete previously allocated netns
Date: Fri, 16 Feb 2024 17:31:53 +0100	[thread overview]
Message-ID: <7f51a2e2bfe1e3ee15f12f655e6d7ab5d9d73b5a.camel@redhat.com> (raw)
In-Reply-To: <20240216152846.1850120-5-aconole@redhat.com>

On Fri, 2024-02-16 at 10:28 -0500, Aaron Conole wrote:
> Many openvswitch test cases reused netns and interface names.  This works
> fine as long as the test case cleans up gracefully.  However, if there is
> some kind of ungraceful termination (such as an external signal) the netns
> or interfaces can be left lingering.  

It looks the openvswitch.sh test script is already trying quite hard to
delete the allocated resources on ungraceful termination via "trap...".

That is usually enough for other self-tests, could you please detail
when it fails here?

> This happens when the selftest
> timeout gets exceeded, while running under very slow debugging conditions.

'timeout' should send SIG_TERM, and the script already handle that
gracefully?

> The solution here is to cleanup the netns on executing the next test.

I suggest avoiding this, it could end up killing innocent alias netns.

You could consider using the 'setup_ns' helper from the
tools/testing/selftests/net/lib.sh library to always generate unique
netns names.

> Signed-off-by: Aaron Conole <aconole@redhat.com>
> ---
>  tools/testing/selftests/net/openvswitch/openvswitch.sh | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh
> index 678a72ad47c1..8dc315585710 100755
> --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh
> +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh
> @@ -115,6 +115,10 @@ ovs_netns_spawn_daemon() {
>  
>  ovs_add_netns_and_veths () {
>  	info "Adding netns attached: sbx:$1 dp:$2 {$3, $4, $5}"
> +	ntns_e=`ip netns list | grep $3`
> +	[ "$ntns_e" != "" ] && ip netns del "$3"
> +	if4_e=`ip link show $4 2>/dev/null`

Minor unrelated note: $() is preferable to `` for sub-shells, as it's
more friendly to nesting, string expansing, quotes, etc.


Cheers,

Paolo


  reply	other threads:[~2024-02-16 16:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 15:28 [RFC 0/7] selftests: openvswitch: cleanups for running as selftests Aaron Conole
2024-02-16 15:28 ` [RFC 1/7] selftests: openvswitch: add test case error directories to clean list Aaron Conole
2024-02-16 15:28 ` [RFC 2/7] selftests: openvswitch: be more verbose with selftest debugging Aaron Conole
2024-02-16 15:28 ` [RFC 3/7] selftests: openvswitch: use non-graceful kills when needed Aaron Conole
2024-02-21 17:32   ` [ovs-dev] " Adrian Moreno
2024-02-21 21:11     ` Aaron Conole
2024-02-16 15:28 ` [RFC 4/7] selftests: openvswitch: delete previously allocated netns Aaron Conole
2024-02-16 16:31   ` Paolo Abeni [this message]
2024-02-16 18:50     ` Aaron Conole
2024-02-16 15:28 ` [RFC 5/7] selftests: openvswitch: make arping test a bit 'slower' Aaron Conole
2024-02-16 15:28 ` [RFC 6/7] selftests: openvswitch: insert module when running the tests Aaron Conole
2024-02-16 15:28 ` [RFC 7/7] selftests: openvswitch: add config and timeout settings Aaron Conole
2024-02-19 20:28 ` [RFC 0/7] selftests: openvswitch: cleanups for running as selftests Jakub Kicinski
2024-02-20 18:02   ` Aaron Conole

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=7f51a2e2bfe1e3ee15f12f655e6d7ab5d9d73b5a.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=aconole@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=echaudro@redhat.com \
    --cc=edumazet@google.com \
    --cc=horms@ovn.org \
    --cc=i.maximets@ovn.org \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.org \
    --cc=shuah@kernel.org \
    /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