[LTP] [PATCH 1/1] net/sendfile01.sh: Check with timeout

Li Wang liwang@redhat.com
Sat Apr 25 05:28:42 CEST 2020


Petr Vorel <pvorel@suse.cz> wrote:

...
>
> > > old api, not sure why exactly it was removed in the new one...
> > It was designed from scratch I guess.
> > But this patch makes sense to me, I'll test it tomorrow.
>
> Actually, I now consider a bit cleaner and safer solution to *not* use eval
> and require test to specify function. E.g.:
>

Why not use eval for that? It helps us to perform more commands directly
without wrap into function.


> +retry_fnc()
> +{
> +       tst_rhost_run -c 'ss -ltp' | grep -q "$port.*testsf"
> +}
> +
>  do_setup()
>  {
>
> @@ -28,7 +33,7 @@ do_setup()
>         tst_rhost_run -s -b -c "$server $(tst_ipaddr rhost) $port"
>         server_started=1
>         tst_res TINFO "wait for the server to start"
> -       sleep 1
> +       TST_RETRY_FUNC retry_fnc 0
>  }
>
> Instead of simple:
>
>  do_setup()
> @@ -28,7 +28,7 @@ do_setup()
>         tst_rhost_run -s -b -c "$server $(tst_ipaddr rhost) $port"
>         server_started=1
>         tst_res TINFO "wait for the server to start"
> -       sleep 1
> +       TST_RETRY_FUNC "tst_rhost_run -c 'ss -ltp' | grep -q
> '$port.*testsf'" 0
>  }
>
> But I don't have strong opinion on it.
> Cyril, Li, any preference?
>

If no more strict reasons I prefer to go the simpler way. And there is no
need to wrap a retry_fun() I think.

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200425/a8bc5114/attachment.htm>


More information about the ltp mailing list