network/ipsec: Add trap to INT and require root
RFC PATCH 1/2 network/ipsec: Add trap to INT and require root
--- testcases/network/stress/ipsec/ipsec_lib.sh | 3 +++ 1 file changed, 3 insertions(+)
testcases/network/stress/ipsec/ipsec_lib.sh +3 -0
@@ -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
Signature · 1 line
2.15.0
RFC PATCH 2/2 lib/test_net.sh: Check for ip command
+ remove this check from tests which uses test_net.sh.
---
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(-)
testcases/lib/test_net.sh +4 -1
@@ -19,7 +19,10 @@ # Author: Alexey Kodanev <[email protected]> # -[ -z "$TST_LIB_LOADED" ] && . test.sh +if [ -z "$TST_LIB_LOADED" ]; then + . test.sh + tst_check_cmds ip +fi init_ltp_netspace() {
testcases/network/dctcp/dctcp01.sh +1 -1
@@ -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
testcases/network/iproute/ip_tests.sh +1 -1
@@ -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
testcases/network/stress/ns-tools/test_net_stress.sh +1 -1
@@ -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 }
testcases/network/tcp_cmds/ipneigh/ipneigh01.sh +1 -1
@@ -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()
testcases/network/xinetd/xinetd_tests.sh +1 -1
@@ -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"
Signature · 1 line
2.15.0
RFC PATCH 2/2 lib/test_net.sh: Check for ip command
Quoted 1 line · Petr Vorel
+ 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?
Quoted 6 lines
Signed-off-by Petr Vorel <[email protected]>---
I guess most of the time we need root intest_net.sh, but there might be someone setting netns withLTP_NETNSand then running tests without root. Do we want to care or we just forcetst_require_rootintest_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
RFC PATCH 1/2 network/ipsec: Add trap to INT and require root
In reply to Petr VorelQuoted 10 lines · Petr Vorel
Signed-off-by Petr Vorel <[email protected]>--- testcases/network/stress/ipsec/ipsec_lib.sh | 3 +++ 1 file changed, 3 insertions(+)testcases/network/stress/ipsec/ipsec_lib.sh +0
-0
testcases/network/stress/ipsec/ipsec_lib.sh line 26
Quoted 6 lines
testcases/network/stress/ipsec/ipsec_lib.sh +2
-0@@ -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
Quoted 4 lines
testcases/network/stress/ipsec/ipsec_lib.sh +1
-0+ # Authenticated encryption with associated data AEALGO="rfc4106_128"# Encryption algorithm
RFC PATCH 1/2 network/ipsec: Add trap to INT and require root
Hi Alexey,
Quoted 3 lines
Quoted 1 line
+trap "
tst_brkmTBROK 'test interrupted'" INTCould 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.
Quoted 15 lines
$ grep 'trap "' . -r./busy_poll/busy_poll03.sh:trap "
tst_brkmTBROK 'test interrupted'" INT ./busy_poll/busy_poll01.sh:trap "tst_brkmTBROK 'test interrupted'" INT ./busy_poll/busy_poll02.sh:trap "tst_brkmTBROK 'test interrupted'" INT ./stress/ns-tools/test_net_stress.sh: trap "tst_brkmTBROK 'test interrupted'" INT ./stress/ssh/ssh-stress: trap "tst_brkmTBROK 'test interrupted'" INT ./stress/ftp/ftp-upload-stress: trap "tst_brkmTBROK 'test interrupted'" INT ./stress/ftp/ftp-download-stress: trap "tst_brkmTBROK 'test interrupted'" INT ./stress/interface/if4-addr-change:trap "tst_brkmTBROK 'test interrupted'" INT ./stress/http/http-stress: trap "tst_brkmTBROK 'test interrupted'" INT ./stress/dns/dns-stress: trap "tst_brkmTBROK 'test interrupted'" INT ./dhcp/dhcp_lib.sh:trap "tst_brkmTBROK 'test interrupted'" INT ./virt/virt_lib.sh:trap "tst_brkmTBROK 'test interrupted'" INT ./tcp_fastopen/tcp_fastopen_run.sh:trap "tst_brkmTBROK 'test interrupted'" INT
Kind regards,
Petr
RFC PATCH 1/2 network/ipsec: Add trap to INT and require root
Hi!
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+trap "
tst_brkmTBROK 'test interrupted'" INTCould we add it to
test_net.sh?Sure. I was even thinking about giving it into
test_net.shandtest.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.
Signature · 2 lines
Cyril Hrubis [email protected]
RFC PATCH 1/2 network/ipsec: Add trap to INT and require root
Hi!
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+trap "
tst_brkmTBROK 'test interrupted'" INTCould we add it to
test_net.sh?Sure. I was even thinking about giving it into
test_net.shandtest.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_brkmon 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