From: Petr Machata <petrm@nvidia.com>
To: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Cc: Ido Schimmel <idosch@nvidia.com>, <netdev@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH v1 01/11] selftests: forwarding: custom_multipath_hash.sh: add cleanup for SIGTERM sent by timeout
Date: Tue, 25 Jul 2023 10:44:32 +0200 [thread overview]
Message-ID: <87mszkjrvc.fsf@nvidia.com> (raw)
In-Reply-To: <20230722003609.380549-1-mirsad.todorovac@alu.unizg.hr>
Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> writes:
> Add trap and cleanup for SIGTERM sent by timeout and SIGINT from
> keyboard, for the test times out and leaves incoherent network stack.
>
> Fixes: 511e8db54036c ("selftests: forwarding: Add test for custom multipath hash")
> Cc: Ido Schimmel <idosch@nvidia.com>
> Cc: netdev@vger.kernel.org
> ---
> tools/testing/selftests/net/forwarding/custom_multipath_hash.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh b/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
> index 56eb83d1a3bd..c7ab883d2515 100755
> --- a/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
> +++ b/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
> @@ -363,7 +363,7 @@ custom_hash()
> custom_hash_v6
> }
>
> -trap cleanup EXIT
> +trap cleanup INT TERM EXIT
>
> setup_prepare
> setup_wait
I believe the EXIT trap covers whatever the cause of the exit was, i.e.
INT and TERM are implicitly covered:
$ vim tmp/x.sh
$ cat tmp/x.sh
foo() { date; }
trap foo EXIT
read -p Ready.
$ bash tmp/x.sh
Ready.^CTue Jul 25 10:44:20 AM CEST 2023
Also, the interrupt trap seems to prevent the exit actually:
$ cat tmp/x.sh
foo() { date; }
trap foo INT TERM EXIT
read -p Ready.
[petr@yaviefel ~]$ bash tmp/x.sh
Ready.^CTue Jul 25 10:43:35 AM CEST 2023
^CTue Jul 25 10:43:35 AM CEST 2023
^CTue Jul 25 10:43:36 AM CEST 2023
^CTue Jul 25 10:43:36 AM CEST 2023
(I see the same when I kill -TERM the script.)
This would call cleanup, which would dismantle the configuration, but
then would happilly proceed in the script. I might be missing something,
but I don't see how this can work.
next prev parent reply other threads:[~2023-07-25 8:54 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-22 0:36 [PATCH v1 01/11] selftests: forwarding: custom_multipath_hash.sh: add cleanup for SIGTERM sent by timeout Mirsad Todorovac
2023-07-22 0:36 ` [PATCH v1 02/11] selftests: forwarding: gre_custom_multipath_hash.sh: " Mirsad Todorovac
2023-07-22 0:36 ` [PATCH v1 03/11] selftests: forwarding: gre_inner_v4_multipath.sh: " Mirsad Todorovac
2023-07-22 0:36 ` [PATCH v1 04/11] selftests: forwarding: gre_multipath_nh_res.sh: " Mirsad Todorovac
2023-07-22 0:36 ` [PATCH v1 05/11] selftests: forwarding: gre_multipath_nh.sh: " Mirsad Todorovac
2023-07-22 0:36 ` [PATCH v1 06/11] selftests: forwarding: ip6gre_custom_multipath_hash.sh: " Mirsad Todorovac
2023-07-22 0:36 ` [PATCH v1 07/11] selftests: forwarding: ip6gre_inner_v4_multipath.sh: " Mirsad Todorovac
2023-07-22 0:36 ` [PATCH v1 08/11] selftests: forwarding: no_forwarding.sh: " Mirsad Todorovac
2023-07-22 0:36 ` [PATCH v1 09/11] selftests: forwarding: router_mpath_nh_res.sh: " Mirsad Todorovac
2023-07-22 0:36 ` [PATCH v1 10/11] selftests: forwarding: router_mpath_nh.sh: " Mirsad Todorovac
2023-07-22 0:36 ` [PATCH v1 11/11] selftests: forwarding: router_multipath.sh: " Mirsad Todorovac
2023-07-23 8:25 ` [PATCH v1 01/11] selftests: forwarding: custom_multipath_hash.sh: " Ido Schimmel
2023-07-23 17:27 ` Ido Schimmel
2023-07-23 18:50 ` Mirsad Todorovac
2023-07-23 18:54 ` Mirsad Todorovac
2023-07-23 21:37 ` Mirsad Todorovac
2023-07-24 14:45 ` Ido Schimmel
2023-07-24 20:46 ` Mirsad Todorovac
2023-07-26 12:22 ` Ido Schimmel
2023-07-26 16:57 ` Ido Schimmel
2023-07-27 3:48 ` Mirsad Todorovac
2023-07-27 19:26 ` Mirsad Todorovac
2023-07-30 7:53 ` Ido Schimmel
2023-07-30 16:48 ` Mirsad Todorovac
2023-07-31 7:54 ` Ido Schimmel
2023-07-31 9:24 ` Mirsad Todorovac
2023-07-31 12:02 ` Ido Schimmel
2023-07-31 15:13 ` Mirsad Todorovac
2023-07-31 15:48 ` Ido Schimmel
2023-08-01 20:41 ` Mirsad Todorovac
2023-07-31 15:23 ` Mirsad Todorovac
2023-08-01 11:08 ` Petr Machata
2023-08-01 16:54 ` Mirsad Todorovac
2023-08-02 10:33 ` Petr Machata
2023-08-02 11:06 ` Mirsad Todorovac
2023-07-25 8:44 ` Petr Machata [this message]
2023-07-25 16:23 ` Mirsad Todorovac
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=87mszkjrvc.fsf@nvidia.com \
--to=petrm@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mirsad.todorovac@alu.unizg.hr \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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