From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] tst_net.sh: Print help ASAP
Date: Wed, 26 Jan 2022 16:08:24 +0100 [thread overview]
Message-ID: <20220126150824.19331-1-pvorel@suse.cz> (raw)
This also allows not requiring printing help with root when using
TST_USE_NETNS:
$ PATH="/opt/ltp/testcases/bin:$PATH" gre02.sh -h
gre02 1 TCONF: Must be super/root for this test!
And with root setup was unnecessary things done just to print help:
# PATH="/opt/ltp/testcases/bin:$PATH" gre02.sh -h
gre02 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface
gre02 1 TINFO: add local addr 10.0.0.2/24
gre02 1 TINFO: add local addr fd00:1:1:1::2/64
gre02 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface
gre02 1 TINFO: add remote addr 10.0.0.1/24
gre02 1 TINFO: add remote addr fd00:1:1:1::1/64
gre02 1 TINFO: Network config (local -- remote):
gre02 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1
gre02 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24
gre02 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64
Usage: /opt/ltp/testcases/bin/gre02.sh [-6]
OPTIONS
-6 IPv6 tests
-h Prints this help
-i n Execute test n times
Now just help is printed, work for unprivileged user:
$ PATH="/opt/ltp/testcases/bin:$PATH" gre02.sh -h
Usage: /opt/ltp/testcases/bin/gre02.sh [-6]
OPTIONS
-6 IPv6 tests
-h Prints this help
-i n Execute test n times
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/lib/tst_net.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 4dc0fca926..047686dc39 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -937,7 +937,7 @@ tst_default_max_pkt()
echo "$((mtu + mtu / 10))"
}
-[ -n "$TST_NET_SKIP_VARIABLE_INIT" ] && return 0
+[ -n "$TST_PRINT_HELP" -o -n "$TST_NET_SKIP_VARIABLE_INIT" ] && return 0
# Management Link
[ -z "$RHOST" ] && TST_USE_NETNS="yes"
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2022-01-26 15:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 15:08 Petr Vorel [this message]
2022-01-27 12:52 ` [LTP] [PATCH 1/1] tst_net.sh: Print help ASAP Alexey Kodanev
2022-01-27 13:57 ` 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=20220126150824.19331-1-pvorel@suse.cz \
--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