All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] net/sendfile01.sh: Check with timeout
Date: Sun, 26 Apr 2020 10:05:26 +0200	[thread overview]
Message-ID: <20200426080526.GA203542@x230> (raw)
In-Reply-To: <CAEemH2f1_6BFuTfrGZ2qpbLidFXxB2EQEO43TjucaMTPM9ghuw@mail.gmail.com>

Hi Li,

> > > > 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.

I'm a bit careful and try to avoid eval in scripts for security reasons.
But ok, LTP code is a bit different from running shell scripts on the server,
security does not matters on SUT, so I'm not against it. I just wanted to hear
more opinions on that, thanks for your comment.

Kind regards,
Petr

  reply	other threads:[~2020-04-26  8:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 18:00 [LTP] [PATCH 1/1] net/sendfile01.sh: Check with timeout Petr Vorel
2020-04-23 19:04 ` Alexey Kodanev
2020-04-23 22:12   ` Petr Vorel
2020-04-24 12:11     ` Petr Vorel
2020-04-25  3:28       ` Li Wang
2020-04-26  8:05         ` Petr Vorel [this message]
2020-04-24 12:53   ` Petr Vorel
2020-04-24 13:06     ` Petr Vorel

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=20200426080526.GA203542@x230 \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.