From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 4/4] lib/test: run ROD_BASE() & tst_rod() with 'timeout' cmd
Date: Tue, 27 Jun 2017 16:53:33 +0200 [thread overview]
Message-ID: <20170627145333.GA2625@rei.lan> (raw)
In-Reply-To: <1495615230-29045-5-git-send-email-alexey.kodanev@oracle.com>
Hi!
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 087adda..c4fbe86 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -116,7 +116,7 @@ tst_brk()
>
> ROD_SILENT()
> {
> - tst_rod $@ > /dev/null 2>&1
> + $TST_TIMECMD tst_rod $@ > /dev/null 2>&1
It would be a bit cleaner to add the timeout capability to the tst_rod
and pass timeout to tst_rod as a first parameter here. Which would fix
the second (below) that I have for this patch.
> if [ $? -ne 0 ]; then
> tst_brk TBROK "$@ failed"
> fi
> @@ -124,7 +124,7 @@ ROD_SILENT()
>
> ROD()
> {
> - tst_rod "$@"
> + $TST_TIMECMD tst_rod "$@"
> if [ $? -ne 0 ]; then
> tst_brk TBROK "$@ failed"
> fi
> @@ -132,7 +132,7 @@ ROD()
>
> EXPECT_PASS()
> {
> - tst_rod "$@"
> + $TST_TIMECMD tst_rod "$@"
> if [ $? -eq 0 ]; then
> tst_res TPASS "$@ passed as expected"
> else
> @@ -143,7 +143,7 @@ EXPECT_PASS()
> EXPECT_FAIL()
> {
> # redirect stderr since we expect the command to fail
> - tst_rod "$@" 2> /dev/null
> + $TST_TIMECMD tst_rod "$@" 2> /dev/null
> if [ $? -ne 0 ]; then
> tst_res TPASS "$@ failed as expected"
> else
> @@ -430,3 +430,6 @@ else
> tst_brk TBROK "Unexpected positional arguments '$@'"
> fi
> fi
> +
> +command -v timeout > /dev/null 2>&1 && \
> + TST_TIMECMD="timeout -s 9 $((300 * ${LTP_TIMEOUT_MUL:-1}))s"
I do not like that we silently disable the timeout if 'timeout' command
is not available. I would rather add tst_timeout.c helper to the lib/ as
we do for instance for tst_sleep to support sub-second sleep intervals.
--
Cyril Hrubis
chrubis@suse.cz
prev parent reply other threads:[~2017-06-27 14:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-24 8:40 [LTP] [PATCH 0/4] lib/shell: run commands with 'timeout' Alexey Kodanev
2017-05-24 8:40 ` [LTP] [PATCH 1/4] lib/test_net: print TPASS/TFAIL inside tst_ping() Alexey Kodanev
2017-05-24 8:40 ` [LTP] [PATCH 2/4] net: remove EXPECT_PASS usage with tst_ping() Alexey Kodanev
2017-09-11 12:57 ` Alexey Kodanev
2017-05-24 8:40 ` [LTP] [PATCH 3/4] net/virt_lib.sh: don't use ROD_SILENT with shell function Alexey Kodanev
2017-05-24 8:40 ` [LTP] [PATCH 4/4] lib/test: run ROD_BASE() & tst_rod() with 'timeout' cmd Alexey Kodanev
2017-06-27 14:53 ` Cyril Hrubis [this message]
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=20170627145333.GA2625@rei.lan \
--to=chrubis@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