Re: [PATCH net-next v2 5/7] selftests: drv-net: add a way to wait for a local process

Joe Damato
2025-02-20T19:28:10Z

On Wed, Feb 19, 2025 at 03:49:54PM -0800, Jakub Kicinski wrote:
> We use wait_port_listen() extensively to wait for a process
> we spawned to be ready. Not all processes will open listening
> sockets. Add a method of explicitly waiting for a child to
> be ready. Pass a FD to the spawned process and wait for it
> to write a message to us. FD number is passed via KSFT_READY_FD
> env variable.
>
> Similarly use KSFT_WAIT_FD to let the child process for a sign
> that we are done and child should exit. Sending a signal to
> a child with shell=True can get tricky.
>
> Make use of this method in the queues test to make it less flaky.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> v2:
> - use fd for exit, too
> - warn if env variables are bad
> v1: https://lore.kernel.org/20250218195048.74692-3-kuba@kernel.org
> ---
> .../selftests/drivers/net/xdp_helper.c | 54 +++++++++++++--
> tools/testing/selftests/drivers/net/queues.py | 43 ++++++------
> tools/testing/selftests/net/lib/py/utils.py | 68 +++++++++++++++++--
> 3 files changed, 133 insertions(+), 32 deletions(-)

This appears to have fixed the test on my system and the hang is
gone. Thanks.

Acked-by: Joe Damato <jdamato@fastly.com>