From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Cc: Xiao Yang <yangx.jy@cn.fujitsu.com>
Subject: Re: [LTP] [PATCH 1/1] tst_test.sh: Print help ASAP
Date: Tue, 23 Nov 2021 19:26:54 +0100 [thread overview]
Message-ID: <YZ0ybqlqV/D8fqAJ@pevik> (raw)
In-Reply-To: <20211123180711.30274-1-pvorel@suse.cz>
Hi,
[ Cc Alexey ]
> There is no need to run setup before printing help.
This is wrong approach (=> reject status), it should be fixed in tst_net.sh,
which should probably run netns initialization:
[ -n "$TST_USE_NETNS" -a "$TST_INIT_NETNS" != "no" ] && init_ltp_netspace
as part of the setup function (tst_net_setup).
Because 1) running help immediately breaks redefining help in nfs07.sh [1]:
. nfs_lib.sh
TST_USAGE="show_usage"
(yes, having help for tst_net.sh, nfs_lib.sh and for some of the tests
which use it is maybe complicated flow, but it should work).
2) code works as expected for tests which use just tst_test.sh (or other
libraries which does *not* use tst_net.sh).
Sorry for the noise.
Kind regards,
Petr
[1] https://lore.kernel.org/ltp/20211123151537.14913-3-mdoucha@suse.cz/T/#u
> Before this change root was required for network tests also for -h:
> $ PATH="$lb:$PATH" nfs01 -h
> nfs01 1 TCONF: Must be super/root for this test!
> And with root setup was run:
> # PATH="$lb:$PATH" nfs07.sh -h
> nfs07 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface
> nfs07 1 TINFO: add local addr 10.0.0.2/24
> nfs07 1 TINFO: add local addr fd00:1:1:1::2/64
> nfs07 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface
> nfs07 1 TINFO: add remote addr 10.0.0.1/24
> nfs07 1 TINFO: add remote addr fd00:1:1:1::1/64
> nfs07 1 TINFO: Network config (local -- remote):
> nfs07 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1
> nfs07 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24
> nfs07 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64
> -t x Socket type, tcp or udp, default is udp
> -v x NFS version, default is '3'
> -n x Create x files and x directories, default is 5000
> -h Prints this help
> -i n Execute test n times
> Now help is simply printed:
> $ PATH="$lb:$PATH" nfs01 -h
> -t x Socket type, tcp or udp, default is udp
> -v x NFS version, default is '3'
> -6 IPv6 tests
> -h Prints this help
> -i n Execute test n times
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> testcases/lib/tst_test.sh | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 2556b28f5..3cf94adac 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -606,7 +606,6 @@ tst_run()
> while getopts ":hi:$TST_OPTS" _tst_name $TST_ARGS; do
> case $_tst_name in
> - 'h') tst_usage; exit 0;;
> 'i') TST_ITERATIONS=$OPTARG;;
> '?') tst_usage; exit 2;;
> *) $TST_PARSE_ARGS "$_tst_name" "$OPTARG";;
> @@ -789,4 +788,9 @@ if [ -z "$TST_NO_DEFAULT_RUN" ]; then
> tst_brk TBROK "Unexpected positional arguments '$@'"
> fi
> fi
> +
> + if [ "$TST_PRINT_HELP" = 1 ]; then
> + tst_usage
> + exit 0
> + fi
> fi
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2021-11-23 18:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 18:07 [LTP] [PATCH 1/1] tst_test.sh: Print help ASAP Petr Vorel
2021-11-23 18:26 ` Petr Vorel [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=YZ0ybqlqV/D8fqAJ@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=yangx.jy@cn.fujitsu.com \
/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.