* [LTP] [RFC PATCH 1/2] net: Add tst_net_run helper
@ 2018-11-08 13:58 Petr Vorel
2018-11-08 13:58 ` [LTP] [RFC PATCH 2/2] net/ipsec: Add check for xfrm_user Petr Vorel
0 siblings, 1 reply; 2+ messages in thread
From: Petr Vorel @ 2018-11-08 13:58 UTC (permalink / raw)
To: ltp
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
tst_net_driver removed and created generic command tst_net_run
TODO: For ROD it does not handle escape for >. E.g. it'd be nice to
handle this:
ROD foo \> bar.log
as passing the escape will not work for sh (non-safe local) and for
tst_rhost_run. Do we care?
Kind regards,
Petr
---
testcases/lib/tst_net.sh | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index d1206e285..ff5c58c3c 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -191,6 +191,23 @@ tst_rhost_run()
return $ret
}
+# Run command on both lhost and rhost.
+# tst_net_run [-s] CMD [ARG [ARG2]]
+tst_net_run()
+{
+ local safe
+ local OPTIND
+ while getopts s opt; do
+ case "$opt" in
+ s) safe="-s" ;;
+ *) tst_brk_ TBROK "tst_net_run: unknown option: $OPTARG" ;;
+ esac
+ done
+ shift $((OPTIND - 1))
+ [ -n "$safe" ] && ROD $@ || sh -c $@
+ tst_rhost_run $safe -c "$@"
+}
+
EXPECT_RHOST_PASS()
{
tst_rhost_run -c "$*" > /dev/null
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [LTP] [RFC PATCH 2/2] net/ipsec: Add check for xfrm_user
2018-11-08 13:58 [LTP] [RFC PATCH 1/2] net: Add tst_net_run helper Petr Vorel
@ 2018-11-08 13:58 ` Petr Vorel
0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2018-11-08 13:58 UTC (permalink / raw)
To: ltp
which is required by ip xfrm command.
As ipsec_lib.sh is used for other commands than it,
check it only when used. Call in cleanup function could trigger infinite
loop, therefore check only once.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/network/stress/ipsec/ipsec_lib.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
index b099fdeaf..a9ac5bc50 100644
--- a/testcases/network/stress/ipsec/ipsec_lib.sh
+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
@@ -89,6 +89,14 @@ TST_SETUP=${TST_SETUP:-ipsec_lib_setup}
TST_USAGE=ipsec_lib_usage
. tst_net.sh
+tst_ipsec_check_driver()
+{
+ if [ -z "$ipsec_driver_checked" ]; then
+ export ipsec_driver_checked=1
+ tst_net_run "tst_test_drivers xfrm_user"
+ fi
+}
+
get_key()
{
local bits=$1
@@ -110,6 +118,7 @@ tst_ipsec_setup()
# tst_ipsec_cleanup: flush ipsec state and policy rules
tst_ipsec_cleanup()
{
+ tst_ipsec_check_driver
ip xfrm state flush
ip xfrm policy flush
tst_rhost_run -c "ip xfrm state flush && ip xfrm policy flush"
@@ -175,6 +184,7 @@ tst_ipsec()
local p="proto $IPSEC_PROTO"
[ "$IPSEC_PROTO" = "esp_aead" ] && p="proto esp"
+ tst_ipsec_check_driver
ipsec_set_algoline
if [ $target = lhost ]; then
@@ -234,6 +244,7 @@ tst_ipsec_vti()
tst_brk TCONF "iproute doesn't support 'vti'"
ipsec_set_algoline
+ tst_ipsec_check_driver
local o_dir="src $src dst $dst"
local i_dir="src $dst dst $src"
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-08 13:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-08 13:58 [LTP] [RFC PATCH 1/2] net: Add tst_net_run helper Petr Vorel
2018-11-08 13:58 ` [LTP] [RFC PATCH 2/2] net/ipsec: Add check for xfrm_user 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.