From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC] tst_check_cmds to exit only current test
Date: Wed, 4 Apr 2018 15:15:01 +0200 [thread overview]
Message-ID: <20180404131501.GH32109@rei> (raw)
In-Reply-To: <20180329114536.vsmsjzatryu4h5dm@dell5510>
Hi!
> # TODO: find a better name
> # another option (maybe better would be to add getopt option to tst_check_cmds()
> tst_check_cmds_test()
Just call it tst_test_cmds() then.
> {
> local cmd
> for cmd in $*; do
> if ! command -v $cmd > /dev/null 2>&1; then
> tst_res TCONF "'$cmd' not found"
> return 32; # we don't have tst_flag2mask() in new API
> fi
> done
> }
>
> testcases/network/stress/interface/if-addr-adddel
> test_body()
> {
> local cmd_type=$1
>
> case $cmd_type in
> if_cmd) local cmd_name='ifconfig' ;;
> ip_cmd) local cmd_name='ip' ;;
> *) tst_brkm TBROK "Unknown test parameter '$cmd_type'"
> esac
> tst_check_cmds_test ifconfig || return
> ...
Huh, why do we even have the case here?
Why isn't the cmd_type either ip or ifconfig?
Then we can just do:
tst_test_cmds $1 || return
> Is it valid approach approach or should we use getopts to run the test twice?
That is a valid approach as well, we can just do:
if-addr-adddel_ifconfig if-addr-adddel ifconfig
if-addr-adddel_ip if-addr-adddel ip
in the runtest file, which would make the test results more detailed,
as it will be clear what was actually skipped, which is always nice.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2018-04-04 13:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-29 11:45 [LTP] [RFC] tst_check_cmds to exit only current test Petr Vorel
2018-04-04 13:15 ` Cyril Hrubis [this message]
2018-04-04 13:44 ` Petr Vorel
2018-04-04 13:51 ` Cyril Hrubis
2018-04-04 14:57 ` Petr Vorel
2018-04-04 13:46 ` Petr Vorel
2018-04-04 13:58 ` Alexey Kodanev
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=20180404131501.GH32109@rei \
--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