diff mbox series

[v2,4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK()

Message ID 1534764229-26993-4-git-send-email-alexey.kodanev@oracle.com
State Accepted
Delegated to: Petr Vorel
Headers show
Series [v2,1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd | expand

Commit Message

Alexey Kodanev Aug. 20, 2018, 11:23 a.m. UTC
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
v2: fixed missing ip before TST_RTNL_CHK

 testcases/network/stress/ipsec/ipsec_lib.sh |   21 +++------------------
 1 files changed, 3 insertions(+), 18 deletions(-)

Comments

Petr Vorel Aug. 22, 2018, 3:45 p.m. UTC | #1
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: Petr Vorel <pvorel@suse.cz>
> ---
> v2: fixed missing ip before TST_RTNL_CHK
I was just going to report it :-).


Kind regards,
Petr
Petr Vorel Sept. 13, 2018, 1:02 p.m. UTC | #2
Hi Alexey,

> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
> v2: fixed missing ip before TST_RTNL_CHK

Merged your patch to have it for the release.
Thanks a lot!

NOTE: I'm going to leave the 1st and 2nd patch, as there is currently no test
using it. I guess we'd like to use it in tst_net.sh for netns.


Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
index aedba9b..b099fde 100644
--- a/testcases/network/stress/ipsec/ipsec_lib.sh
+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
@@ -157,21 +157,6 @@  ipsec_set_algoline()
 	esac
 }
 
-ipsec_try()
-{
-	local output="$($@ 2>&1 || echo 'TERR')"
-
-	if echo "$output" | grep -q "TERR"; then
-		echo "$output" | grep -q \
-			'RTNETLINK answers: Function not implemented' && \
-			tst_brk TCONF "'$@': not implemented"
-		echo "$output" | grep -q \
-			'RTNETLINK answers: Operation not supported' && \
-			tst_brk TCONF "'$@': not supported (maybe missing 'ip${TST_IPV6}_vti' kernel module)"
-		tst_brk TBROK "$@ failed: $output"
-	fi
-}
-
 # tst_ipsec target src_addr dst_addr: config ipsec
 #
 # target: target of the configuration host ( lhost / rhost )
@@ -195,7 +180,7 @@  tst_ipsec()
 	if [ $target = lhost ]; then
 		local spi_1="0x$SPI"
 		local spi_2="0x$(( $SPI + 1 ))"
-		ipsec_try ip xfrm state add src $src dst $dst spi $spi_1 \
+		TST_RTNL_CHK ip xfrm state add src $src dst $dst spi $spi_1 \
 			$p $ALG mode $mode sel src $src dst $dst
 		ROD ip xfrm state add src $dst dst $src spi $spi_2 \
 			$p $ALG mode $mode sel src $dst dst $src
@@ -257,12 +242,12 @@  tst_ipsec_vti()
 	cleanup_vti=$vti
 
 	if [ $target = lhost ]; then
-		ipsec_try ip li add $vti $type local $src remote $dst $key $d
+		TST_RTNL_CHK ip li add $vti $type local $src remote $dst $key $d
 		ROD ip li set $vti up
 
 		local spi_1="spi 0x$SPI"
 		local spi_2="spi 0x$(( $SPI + 1 ))"
-		ipsec_try $ipx st add $o_dir $p $spi_1 $ALG $m
+		TST_RTNL_CHK $ipx st add $o_dir $p $spi_1 $ALG $m
 		ROD $ipx st add $i_dir $p $spi_2 $ALG $m
 		ROD $ipx po add dir out tmpl $o_dir $p $m $mrk
 		ROD $ipx po add dir in tmpl $i_dir $p $m $mrk