All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root
@ 2017-12-06 14:42 Petr Vorel
  2017-12-06 14:42 ` [LTP] [RFC PATCH 2/2] lib/test_net.sh: Check for ip command Petr Vorel
  2017-12-07 11:25 ` [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root Alexey Kodanev
  0 siblings, 2 replies; 7+ messages in thread
From: Petr Vorel @ 2017-12-06 14:42 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/stress/ipsec/ipsec_lib.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
index cee755fe0..5cc2c9a45 100644
--- a/testcases/network/stress/ipsec/ipsec_lib.sh
+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
@@ -21,6 +21,9 @@
 
 . test_net.sh
 
+tst_require_root
+trap "tst_brkm TBROK 'test interrupted'" INT
+
 # Authenticated encryption with associated data
 AEALGO="rfc4106_128"
 # Encryption algorithm
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [RFC PATCH 2/2] lib/test_net.sh: Check for ip command
  2017-12-06 14:42 [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root Petr Vorel
@ 2017-12-06 14:42 ` Petr Vorel
  2017-12-07 11:52   ` Alexey Kodanev
  2017-12-07 11:25 ` [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root Alexey Kodanev
  1 sibling, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2017-12-06 14:42 UTC (permalink / raw)
  To: ltp

+ remove this check from tests which uses test_net.sh.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
I guess most of the time we need root in test_net.sh, but there might be
someone setting netns with LTP_NETNS and then running tests without root.  Do
we want to care or we just force tst_require_root in test_net.sh ?
---
 testcases/lib/test_net.sh                            | 5 ++++-
 testcases/network/dctcp/dctcp01.sh                   | 2 +-
 testcases/network/iproute/ip_tests.sh                | 2 +-
 testcases/network/stress/ns-tools/test_net_stress.sh | 2 +-
 testcases/network/tcp_cmds/ipneigh/ipneigh01.sh      | 2 +-
 testcases/network/xinetd/xinetd_tests.sh             | 2 +-
 6 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 83639e2d1..e7399bfd1 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -19,7 +19,10 @@
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 #
 
-[ -z "$TST_LIB_LOADED" ] && . test.sh
+if [ -z "$TST_LIB_LOADED" ]; then
+	. test.sh
+	tst_check_cmds ip
+fi
 
 init_ltp_netspace()
 {
diff --git a/testcases/network/dctcp/dctcp01.sh b/testcases/network/dctcp/dctcp01.sh
index d8d4eb9df..a92e41b2e 100755
--- a/testcases/network/dctcp/dctcp01.sh
+++ b/testcases/network/dctcp/dctcp01.sh
@@ -49,7 +49,7 @@ setup()
 	fi
 
 	tst_require_root
-	tst_check_cmds ip sysctl tc
+	tst_check_cmds sysctl tc
 
 	tst_resm TINFO "emulate congestion with packet loss 0.03% and ECN"
 	tc qdisc add dev $(tst_iface) root netem loss 0.03% ecn > /dev/null 2>&1
diff --git a/testcases/network/iproute/ip_tests.sh b/testcases/network/iproute/ip_tests.sh
index cb42e7a65..a9401412b 100755
--- a/testcases/network/iproute/ip_tests.sh
+++ b/testcases/network/iproute/ip_tests.sh
@@ -33,7 +33,7 @@ init()
 	tst_resm TINFO "inititalizing tests"
 	tst_require_root
 	tst_tmpdir
-	tst_check_cmds cat awk ip diff
+	tst_check_cmds cat awk diff
 
 	iface=ltp_dummy
 	lsmod | grep -q dummy || rm_dummy=1
diff --git a/testcases/network/stress/ns-tools/test_net_stress.sh b/testcases/network/stress/ns-tools/test_net_stress.sh
index 77f5797df..3cf9e5f05 100644
--- a/testcases/network/stress/ns-tools/test_net_stress.sh
+++ b/testcases/network/stress/ns-tools/test_net_stress.sh
@@ -43,7 +43,7 @@ MCAST_IPV6_ADDR="${MCAST_IPV6_ADDR_PREFIX}:1"
 netstress_setup()
 {
 	tst_require_root
-	tst_check_cmds ip pgrep pkill
+	tst_check_cmds pgrep pkill
 	trap "tst_brkm TBROK 'test interrupted'" INT
 }
 
diff --git a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
index 99bab1621..c35443d04 100755
--- a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
+++ b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
@@ -24,7 +24,7 @@ TST_TOTAL=2
 do_setup()
 {
 	tst_require_root
-	tst_check_cmds ip arp grep ping$TST_IPV6
+	tst_check_cmds arp grep ping$TST_IPV6
 }
 
 do_test()
diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
index fb4344837..8aa998875 100755
--- a/testcases/network/xinetd/xinetd_tests.sh
+++ b/testcases/network/xinetd/xinetd_tests.sh
@@ -29,7 +29,7 @@ setup()
 
 	tst_tmpdir
 
-	tst_check_cmds xinetd diff ip telnet
+	tst_check_cmds xinetd diff telnet
 
 	check_addr="127.0.0.1"
 	ip a | grep -q inet6 && check_addr="$check_addr ::1"
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root
  2017-12-06 14:42 [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root Petr Vorel
  2017-12-06 14:42 ` [LTP] [RFC PATCH 2/2] lib/test_net.sh: Check for ip command Petr Vorel
@ 2017-12-07 11:25 ` Alexey Kodanev
  2017-12-07 12:18   ` Petr Vorel
  1 sibling, 1 reply; 7+ messages in thread
From: Alexey Kodanev @ 2017-12-07 11:25 UTC (permalink / raw)
  To: ltp

On 12/06/2017 05:42 PM, Petr Vorel wrote:
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/stress/ipsec/ipsec_lib.sh | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
> index cee755fe0..5cc2c9a45 100644
> --- a/testcases/network/stress/ipsec/ipsec_lib.sh
> +++ b/testcases/network/stress/ipsec/ipsec_lib.sh
> @@ -21,6 +21,9 @@
>  
>  . test_net.sh
>  
> +tst_require_root

> +trap "tst_brkm TBROK 'test interrupted'" INT

Could we add it to test_net.sh?

$ grep 'trap "' . -r

./busy_poll/busy_poll03.sh:trap "tst_brkm TBROK 'test interrupted'" INT
./busy_poll/busy_poll01.sh:trap "tst_brkm TBROK 'test interrupted'" INT
./busy_poll/busy_poll02.sh:trap "tst_brkm TBROK 'test interrupted'" INT
./stress/ns-tools/test_net_stress.sh:   trap "tst_brkm TBROK 'test interrupted'" INT
./stress/ssh/ssh-stress:        trap "tst_brkm TBROK 'test interrupted'" INT
./stress/ftp/ftp-upload-stress: trap "tst_brkm TBROK 'test interrupted'" INT
./stress/ftp/ftp-download-stress:       trap "tst_brkm TBROK 'test interrupted'" INT
./stress/interface/if4-addr-change:trap "tst_brkm TBROK 'test interrupted'" INT
./stress/http/http-stress:      trap "tst_brkm TBROK 'test interrupted'" INT
./stress/dns/dns-stress:        trap "tst_brkm TBROK 'test interrupted'" INT
./dhcp/dhcp_lib.sh:trap "tst_brkm TBROK 'test interrupted'" INT
./virt/virt_lib.sh:trap "tst_brkm TBROK 'test interrupted'" INT
./tcp_fastopen/tcp_fastopen_run.sh:trap "tst_brkm TBROK 'test interrupted'" INT


Thanks,
Alexey

> +
>  # Authenticated encryption with associated data
>  AEALGO="rfc4106_128"
>  # Encryption algorithm


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [RFC PATCH 2/2] lib/test_net.sh: Check for ip command
  2017-12-06 14:42 ` [LTP] [RFC PATCH 2/2] lib/test_net.sh: Check for ip command Petr Vorel
@ 2017-12-07 11:52   ` Alexey Kodanev
  0 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2017-12-07 11:52 UTC (permalink / raw)
  To: ltp

On 12/06/2017 05:42 PM, Petr Vorel wrote:
> + remove this check from tests which uses test_net.sh.

Not all library functions require 'ip' so why do we need these
rules to apply globally or am I missing something?

>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> I guess most of the time we need root in test_net.sh, but there might be
> someone setting netns with LTP_NETNS and then running tests without root.  Do
> we want to care or we just force tst_require_root in test_net.sh ?

I think we could add it in init_ltp_netspace or/and to tst_restore_ipaddr(),
i.e. checks forip command and root.

Thanks,
Alexey


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root
  2017-12-07 11:25 ` [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root Alexey Kodanev
@ 2017-12-07 12:18   ` Petr Vorel
  2017-12-11 12:23     ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2017-12-07 12:18 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> > +trap "tst_brkm TBROK 'test interrupted'" INT

> Could we add it to test_net.sh?
Sure. I was even thinking about giving it into test_net.sh and test.sh (i.e. making it the
default settings), but that's maybe too aggressive.


> $ grep 'trap "' . -r

> ./busy_poll/busy_poll03.sh:trap "tst_brkm TBROK 'test interrupted'" INT
> ./busy_poll/busy_poll01.sh:trap "tst_brkm TBROK 'test interrupted'" INT
> ./busy_poll/busy_poll02.sh:trap "tst_brkm TBROK 'test interrupted'" INT
> ./stress/ns-tools/test_net_stress.sh:   trap "tst_brkm TBROK 'test interrupted'" INT
> ./stress/ssh/ssh-stress:        trap "tst_brkm TBROK 'test interrupted'" INT
> ./stress/ftp/ftp-upload-stress: trap "tst_brkm TBROK 'test interrupted'" INT
> ./stress/ftp/ftp-download-stress:       trap "tst_brkm TBROK 'test interrupted'" INT
> ./stress/interface/if4-addr-change:trap "tst_brkm TBROK 'test interrupted'" INT
> ./stress/http/http-stress:      trap "tst_brkm TBROK 'test interrupted'" INT
> ./stress/dns/dns-stress:        trap "tst_brkm TBROK 'test interrupted'" INT
> ./dhcp/dhcp_lib.sh:trap "tst_brkm TBROK 'test interrupted'" INT
> ./virt/virt_lib.sh:trap "tst_brkm TBROK 'test interrupted'" INT
> ./tcp_fastopen/tcp_fastopen_run.sh:trap "tst_brkm TBROK 'test interrupted'" INT


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root
  2017-12-07 12:18   ` Petr Vorel
@ 2017-12-11 12:23     ` Cyril Hrubis
  2017-12-11 14:36       ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Cyril Hrubis @ 2017-12-11 12:23 UTC (permalink / raw)
  To: ltp

Hi!
> > > +trap "tst_brkm TBROK 'test interrupted'" INT
> 
> > Could we add it to test_net.sh?
> Sure. I was even thinking about giving it into test_net.sh and test.sh (i.e. making it the
> default settings), but that's maybe too aggressive.

Unless we find a test that traps INT in order to attempt to cleanup
doing tst_brkm on INT in test library is IMHO okay.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root
  2017-12-11 12:23     ` Cyril Hrubis
@ 2017-12-11 14:36       ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2017-12-11 14:36 UTC (permalink / raw)
  To: ltp

Hi!
> > > > +trap "tst_brkm TBROK 'test interrupted'" INT

> > > Could we add it to test_net.sh?
> > Sure. I was even thinking about giving it into test_net.sh and test.sh (i.e. making it the
> > default settings), but that's maybe too aggressive.

> Unless we find a test that traps INT in order to attempt to cleanup
> doing tst_brkm on INT in test library is IMHO okay.
$ git grep -i  trap.*INT $(git grep -l -e '\. tst_test.sh' -e '\. test.sh')
testcases/kernel/device-drivers/locking/lock_torture.sh:trap cleanup INT
testcases/kernel/device-drivers/rcu/rcu_torture.sh:trap cleanup INT
testcases/kernel/tracing/ftrace_test/ftrace_lib.sh:	trap clean_up_exit INT

But do we need to care? Test will just silently redefine settings from library.

They are all using test.sh, so we can add
trap "tst_brk TBROK 'test interrupted'" INT
to tst_test.sh.


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-11 14:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 14:42 [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root Petr Vorel
2017-12-06 14:42 ` [LTP] [RFC PATCH 2/2] lib/test_net.sh: Check for ip command Petr Vorel
2017-12-07 11:52   ` Alexey Kodanev
2017-12-07 11:25 ` [LTP] [RFC PATCH 1/2] network/ipsec: Add trap to INT and require root Alexey Kodanev
2017-12-07 12:18   ` Petr Vorel
2017-12-11 12:23     ` Cyril Hrubis
2017-12-11 14:36       ` 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.