* [LTP] [PATCH 1/1] tst_net.sh: Print help ASAP
@ 2022-01-26 15:08 Petr Vorel
2022-01-27 12:52 ` Alexey Kodanev
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2022-01-26 15:08 UTC (permalink / raw)
To: ltp
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH 1/1] tst_net.sh: Print help ASAP
2022-01-26 15:08 [LTP] [PATCH 1/1] tst_net.sh: Print help ASAP Petr Vorel
@ 2022-01-27 12:52 ` Alexey Kodanev
2022-01-27 13:57 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Kodanev @ 2022-01-27 12:52 UTC (permalink / raw)
To: Petr Vorel, ltp
Hi Petr,
On 26.01.2022 18:08, Petr Vorel wrote:
> 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"
Acked-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH 1/1] tst_net.sh: Print help ASAP
2022-01-27 12:52 ` Alexey Kodanev
@ 2022-01-27 13:57 ` Petr Vorel
0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2022-01-27 13:57 UTC (permalink / raw)
To: Alexey Kodanev; +Cc: ltp
Hi Alexey,
thanks for you review, merged.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-27 13:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 15:08 [LTP] [PATCH 1/1] tst_net.sh: Print help ASAP Petr Vorel
2022-01-27 12:52 ` Alexey Kodanev
2022-01-27 13:57 ` Petr Vorel
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.