testing: The expect-connection helper may use swanctl to check for connections
authorTobias Brunner <tobias@strongswan.org>
Thu, 19 Nov 2015 16:49:20 +0000 (17:49 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 11 Dec 2015 17:26:53 +0000 (18:26 +0100)
Depending on the plugin configuration in the test scenario either
`ipsec statusall` or `swanctl --list-conns` is used to check for a named
connection.

testing/hosts/default/usr/local/bin/expect-connection

index 10a7092..17e2b7f 100755 (executable)
@@ -15,10 +15,16 @@ fi
 secs=$2
 [ ! $secs ] && secs=5
 
+cmd="swanctl --list-conns"
+grep 'load.*stroke' /etc/strongswan.conf >/dev/null
+if [ $? -eq 0 ]; then
+       cmd="ipsec statusall"
+fi
+
 let steps=$secs*10
 for i in `seq 1 $steps`
 do
-       ipsec statusall 2>&1 | grep ^[[:space:]]*$1: >/dev/null
+       $cmd 2>&1 | grep ^[[:space:]]*$1: >/dev/null
        [ $? -eq 0 ] && exit 0
        sleep 0.1
 done