selftests: mptcp: diag: avoid extra waiting
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Fri, 1 Mar 2024 17:11:23 +0000 (18:11 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Mar 2024 13:05:15 +0000 (13:05 +0000)
commitf05d2283d11187675569d3a0286dbaf45d8eb70c
tree50111ef2f6d9419056184733a36ac136e1543033
parent45bcc0346561daa3f59e19a753cc7f3e08e8dff1
selftests: mptcp: diag: avoid extra waiting

When creating a lot of listener sockets, it is enough to wait only for
the last one, like we are doing before in diag.sh for other subtests.

If we do a check for each listener sockets, each time listing all
available sockets, it can take a very long time in very slow
environments, at the point we can reach some timeout.

When using the debug kconfig, the waiting time switches from more than
8 sec to 0.1 sec on my side. In slow/busy environments, and with a poll
timeout set to 30 ms, the waiting time could go up to ~100 sec because
the listener socket would timeout and stop, while the script would still
be checking one by one if all sockets are ready. The result is that
after having waited for everything to be ready, all sockets have been
stopped due to a timeout, and it is too late for the script to check how
many there were.

While at it, also removed ss options we don't need: we only need the
filtering options, to count how many listener sockets have been created.
We don't need to ask ss to display internal TCP information, and the
memory if the output is dropped by the 'wc -l' command anyway.

Fixes: b4b51d36bbaa ("selftests: mptcp: explicitly trigger the listener diag code-path")
Reported-by: Jakub Kicinski <kuba@kernel.org>
Closes: https://lore.kernel.org/r/20240301063754.2ecefecf@kernel.org
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/mptcp/diag.sh