From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC PATCH v4 2/5] shell: Introduce TST_TIMEOUT variable, add checks
Date: Fri, 11 Oct 2019 10:12:01 +0200 [thread overview]
Message-ID: <20191011081201.GA31207@dell5510> (raw)
In-Reply-To: <20191009143434.GE7561@rei.lan>
Hi Cyril,
...
> > + if ! tst_is_int "$LTP_TIMEOUT_MUL"; then
> > + tst_test_cmds cut
> I do not think that it's necessary to check for the presense of the cut
> command.
I wouldn't check for cut in tests, but in library I tend to be careful.
But sure, I'll delete it.
BTW we already check for basic commands in tst_run():
tst_test_cmds cut tr wc
_tst_setup_timer() is called later.
Do you want to drop some of these checks?
> > + LTP_TIMEOUT_MUL=$(echo "$LTP_TIMEOUT_MUL" | cut -d. -f1)
> > + LTP_TIMEOUT_MUL=$((LTP_TIMEOUT_MUL+1))
> > + tst_res TINFO "ceiling LTP_TIMEOUT_MUL to $LTP_TIMEOUT_MUL"
> > + fi
> > + [ "$LTP_TIMEOUT_MUL" -ge 1 ] || tst_brk TCONF "$err ($LTP_TIMEOUT_MUL)"
> > +
> > + if ! tst_is_int "$TST_TIMEOUT" || [ "$TST_TIMEOUT" -lt 1 ]; then
> > + tst_brk TBROK "TST_TIMEOUT must be int >= 1! ($TST_TIMEOUT)"
> > + fi
> > +
> > + local sec
> > + if [ "$is_float" ]; then
> > + sec=`echo | awk '{printf("%d\n", '$TST_TIMEOUT' * '$LTP_TIMEOUT_MUL'+ 0.5)}'`
> > + else
> > + sec=$((TST_TIMEOUT * LTP_TIMEOUT_MUL))
> > + fi
> Is this a leftover? Now that LTP_TIMEOUT_MUL has been converted to int
> we can simply do what is done in the else branch.
Yes, thanks for catching this.
Kind regards,
Petr
next prev parent reply other threads:[~2019-10-11 8:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-30 14:59 [LTP] [RFC PATCH v4 0/5] shell: Introduce TST_TIMEOUT variable Petr Vorel
2019-09-30 14:59 ` [LTP] [RFC PATCH v4 1/5] shell: Add tst_is_num() Petr Vorel
2019-09-30 14:59 ` [LTP] [RFC PATCH v4 2/5] shell: Introduce TST_TIMEOUT variable, add checks Petr Vorel
2019-10-09 14:34 ` Cyril Hrubis
2019-10-11 8:12 ` Petr Vorel [this message]
2019-09-30 14:59 ` [LTP] [RFC PATCH v4 3/5] shell: Add timeout shell API tests Petr Vorel
2019-10-02 10:46 ` Petr Vorel
2019-10-09 14:36 ` Cyril Hrubis
2019-10-11 8:17 ` Petr Vorel
2019-09-30 14:59 ` [LTP] [RFC PATCH v4 4/5] memcg_stress_test.sh: use TST_TIMEOUT (replace LTP_TIMEOUT_MUL) Petr Vorel
2019-09-30 14:59 ` [LTP] [RFC PATCH v4 5/5] net/if-mtu-change.sh: set TST_TIMEOUT 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=20191011081201.GA31207@dell5510 \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox