mbox series

[v2,0/3] selftests/net: deflake GRO tests and fix return value and output

Message ID 20250226192725.621969-1-krakauer@google.com
Headers show
Series selftests/net: deflake GRO tests and fix return value and output | expand

Message

Kevin Krakauer Feb. 26, 2025, 7:27 p.m. UTC
The GRO selftests can flake and have some confusing behavior. These
changes make the output and return value of GRO behave as expected, then
deflake the tests.

v2:
- Split into multiple commits.
- Reduced napi_defer_hard_irqs to 1.
- Reduced gro_flush_timeout to 100us.
- Fixed comment that wasn't updated.

v1: https://lore.kernel.org/netdev/20250218164555.1955400-1-krakauer@google.com/

Kevin Krakauer (3):
  selftests/net: have `gro.sh -t` return a correct exit code
  selftests/net: only print passing message in GRO tests when tests pass
  selftests/net: deflake GRO tests

 tools/testing/selftests/net/gro.c         | 8 +++++---
 tools/testing/selftests/net/gro.sh        | 7 ++++---
 tools/testing/selftests/net/setup_veth.sh | 3 ++-
 3 files changed, 11 insertions(+), 7 deletions(-)

Comments

Willem de Bruijn Feb. 27, 2025, 4:20 p.m. UTC | #1
Kevin Krakauer wrote:
> Modify gro.sh to return a useful exit code when the -t flag is used. It
> formerly returned 0 no matter what.
> 
> Tested: Ran `gro.sh -t large` and verified that test failures return 1.
> Signed-off-by: Kevin Krakauer <krakauer@google.com>

Reviewed-by: Willem de Bruijn <willemb@google.com>

> ---
>  tools/testing/selftests/net/gro.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/net/gro.sh b/tools/testing/selftests/net/gro.sh
> index 02c21ff4ca81..aabd6e5480b8 100755
> --- a/tools/testing/selftests/net/gro.sh
> +++ b/tools/testing/selftests/net/gro.sh
> @@ -100,5 +100,6 @@ trap cleanup EXIT
>  if [[ "${test}" == "all" ]]; then
>    run_all_tests
>  else
> -  run_test "${proto}" "${test}"
> +  exit_code=$(run_test "${proto}" "${test}")
> +  exit $exit_code
>  fi;

This is due to run_test ending with echo ${exit_code}, which itself
always succeeds. Rather than the actual exit_code of the process it
ran, right?

It looks a bit odd, but this is always how run_all_tests uses
run_test.
Willem de Bruijn Feb. 27, 2025, 9:31 p.m. UTC | #2
Kevin Krakauer wrote:
> On Thu, Feb 27, 2025 at 11:20:15AM -0500, Willem de Bruijn wrote:
> > > ---
> > >  tools/testing/selftests/net/gro.sh | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/tools/testing/selftests/net/gro.sh b/tools/testing/selftests/net/gro.sh
> > > index 02c21ff4ca81..aabd6e5480b8 100755
> > > --- a/tools/testing/selftests/net/gro.sh
> > > +++ b/tools/testing/selftests/net/gro.sh
> > > @@ -100,5 +100,6 @@ trap cleanup EXIT
> > >  if [[ "${test}" == "all" ]]; then
> > >    run_all_tests
> > >  else
> > > -  run_test "${proto}" "${test}"
> > > +  exit_code=$(run_test "${proto}" "${test}")
> > > +  exit $exit_code
> > >  fi;
> > 
> > This is due to run_test ending with echo ${exit_code}, which itself
> > always succeeds. Rather than the actual exit_code of the process it
> > ran, right?
> > 
> > It looks a bit odd, but this is always how run_all_tests uses
> > run_test.
> 
> Yep. I could change this to use exit codes and $? if that's desirable,
> but IME using echo to return is fairly common.

Thanks. No need to change it.