diff options
author | Tobias Brunner <tobias@strongswan.org> | 2010-10-14 14:01:26 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2010-10-14 14:01:26 +0200 |
commit | 7ec11936e881cd19779e88ff817091f0febac274 (patch) | |
tree | f988fe11c4cc6a7b3c13bfe5f69db380fccb438d /testing/do-tests.in | |
parent | 972663ccb03e89f4a321609d3b3ff91a3359ef3f (diff) | |
download | strongswan-7ec11936e881cd19779e88ff817091f0febac274.tar.bz2 strongswan-7ec11936e881cd19779e88ff817091f0febac274.tar.xz |
testing: Reduce testing runtime by reusing SSH sessions.
By using the ControlMaster and ControlPath options, existing SSH sessions
are reused (a session to each host is opened at the beginning of a test
run). Also, RC4 is used as encryption algorithm to further improve the
performance. These changes reduce the runtime by over 20%.
Diffstat (limited to 'testing/do-tests.in')
-rwxr-xr-x | testing/do-tests.in | 68 |
1 files changed, 44 insertions, 24 deletions
diff --git a/testing/do-tests.in b/testing/do-tests.in index 5419916ed..2e67e9367 100755 --- a/testing/do-tests.in +++ b/testing/do-tests.in @@ -101,6 +101,16 @@ done ############################################################################## +# open ssh sessions +# +for host in $STRONGSWANHOSTS +do + ssh $SSHCONF -N root@`eval echo \\\$ipv4_$host` & + eval ssh_pid_$host="`echo $!`" +done + + +############################################################################## # create header for the results html file # @@ -350,7 +360,7 @@ do iface=`echo $host_iface | awk -F ":" '{if ($2 != "") { print $2 } else { printf("eth0") }}'` tcpdump_cmd="tcpdump -i $iface not port ssh and not port domain > /tmp/tcpdump.log 2>&1 &" echo "${host}# $tcpdump_cmd" >> $CONSOLE_LOG - ssh root@`eval echo \\\$ipv4_$host '$tcpdump_cmd'` + ssh $SSHCONF root@`eval echo \\\$ipv4_$host '$tcpdump_cmd'` eval TDUP_${host}="true" done fi @@ -367,7 +377,7 @@ do if ($2 != "") { printf("echo \"%s# %s\"; ", $1, $2) - printf("ssh root@\044ipv4_%s \"%s\"; ", $1, $2) + printf("ssh \044SSHCONF root@\044ipv4_%s \"%s\"; ", $1, $2) printf("echo;\n") } }' $TESTDIR/pretest.dat` >> $CONSOLE_LOG 2>&1 @@ -379,7 +389,7 @@ do function stop_tcpdump { echo "${1}# killall tcpdump" >> $CONSOLE_LOG - eval ssh root@\$ipv4_${1} killall tcpdump + eval ssh $SSHCONF root@\$ipv4_${1} killall tcpdump eval TDUP_${1}="false" echo "" } @@ -405,12 +415,12 @@ do { printf("if [ \044TDUP_%s == \"true\" ]; then stop_tcpdump %s; fi; \n", host, host) printf("echo \"%s# cat /tmp/tcpdump.log | grep \047%s\047 [%s]\"; ", host, pattern, hit) - printf("ssh root@\044ipv4_%s cat /tmp/tcpdump.log | grep \"%s\"; ", host, pattern) + printf("ssh \044SSHCONF root@\044ipv4_%s cat /tmp/tcpdump.log | grep \"%s\"; ", host, pattern) } else { printf("echo \"%s# %s | grep \047%s\047 [%s]\"; ", host, command, pattern, hit) - printf("ssh root@\044ipv4_%s %s | grep \"%s\"; ", host, command, pattern) + printf("ssh \044SSHCONF root@\044ipv4_%s %s | grep \"%s\"; ", host, command, pattern) } printf("cmd_exit=\044?; ") printf("echo; ") @@ -465,26 +475,26 @@ do for command in statusall listall do - ssh $HOSTLOGIN ipsec $command \ + ssh $SSHCONF $HOSTLOGIN ipsec $command \ > $TESTRESULTDIR/${host}.$command 2>/dev/null done for file in strongswan.conf ipsec.conf ipsec.secrets do - scp $HOSTLOGIN:/etc/$file \ + scp $SSHCONF $HOSTLOGIN:/etc/$file \ $TESTRESULTDIR/${host}.$file > /dev/null 2>&1 done - scp $HOSTLOGIN:/etc/ipsec.d/ipsec.sql \ + scp $SSHCONF $HOSTLOGIN:/etc/ipsec.d/ipsec.sql \ $TESTRESULTDIR/${host}.ipsec.sql > /dev/null 2>&1 - ssh $HOSTLOGIN ip -s xfrm policy \ + ssh $SSHCONF $HOSTLOGIN ip -s xfrm policy \ > $TESTRESULTDIR/${host}.ip.policy 2>/dev/null - ssh $HOSTLOGIN ip -s xfrm state \ + ssh $SSHCONF $HOSTLOGIN ip -s xfrm state \ > $TESTRESULTDIR/${host}.ip.state 2>/dev/null - ssh $HOSTLOGIN ip route list table $SOURCEIP_ROUTING_TABLE \ + ssh $SSHCONF $HOSTLOGIN ip route list table $SOURCEIP_ROUTING_TABLE \ > $TESTRESULTDIR/${host}.ip.route 2>/dev/null - ssh $HOSTLOGIN $IPTABLES_CMD \ + ssh $SSHCONF $HOSTLOGIN $IPTABLES_CMD \ > $TESTRESULTDIR/${host}.iptables 2>/dev/null chmod a+r $TESTRESULTDIR/* cat >> $TESTRESULTDIR/index.html <<@EOF @@ -527,11 +537,11 @@ do for file in clients.conf eap.conf radiusd.conf proxy.conf users do - scp $HOSTLOGIN:/etc/raddb/$file \ + scp $SSHCONF $HOSTLOGIN:/etc/raddb/$file \ $TESTRESULTDIR/${host}.$file > /dev/null 2>&1 done - scp $HOSTLOGIN:/var/log/radius/radius.log \ + scp $SSHCONF $HOSTLOGIN:/var/log/radius/radius.log \ $TESTRESULTDIR/${host}.radius.log > /dev/null 2>&1 chmod a+r $TESTRESULTDIR/* @@ -585,7 +595,7 @@ do if ($2 != "") { printf("echo \"%s# %s\"; ", $1, $2) - printf("ssh root@\044ipv4_%s \"%s\"; ", $1, $2) + printf("ssh \044SSHCONF root@\044ipv4_%s \"%s\"; ", $1, $2) printf("echo;\n") } }' $TESTDIR/posttest.dat` >> $CONSOLE_LOG 2>&1 @@ -598,10 +608,10 @@ do for host in $IPSECHOSTS do eval HOSTLOGIN=root@\$ipv4_${host} - ssh $HOSTLOGIN grep pluto /var/log/auth.log \ + ssh $SSHCONF $HOSTLOGIN grep pluto /var/log/auth.log \ > $TESTRESULTDIR/${host}.auth.log echo >> $TESTRESULTDIR/${host}.auth.log - ssh $HOSTLOGIN grep charon /var/log/auth.log \ + ssh $SSHCONF $HOSTLOGIN grep charon /var/log/auth.log \ >> $TESTRESULTDIR/${host}.auth.log done @@ -613,10 +623,10 @@ do for host in $IPSECHOSTS do eval HOSTLOGIN=root@\$ipv4_${host} - ssh $HOSTLOGIN grep pluto /var/log/daemon.log \ + ssh $SSHCONF $HOSTLOGIN grep pluto /var/log/daemon.log \ > $TESTRESULTDIR/${host}.daemon.log echo >> $TESTRESULTDIR/${host}.daemon.log - ssh $HOSTLOGIN grep charon /var/log/daemon.log \ + ssh $SSHCONF $HOSTLOGIN grep charon /var/log/daemon.log \ >> $TESTRESULTDIR/${host}.daemon.log done @@ -630,7 +640,7 @@ do if [ "`eval echo \\\$TDUP_${host}`" = "true" ] then echo "${host}# killall tcpdump" >> $CONSOLE_LOG - eval ssh root@\$ipv4_$host killall tcpdump + eval ssh $SSHCONF root@\$ipv4_$host killall tcpdump eval TDUP_${host}="false" fi done @@ -681,7 +691,7 @@ do for host in $IPSECHOSTS do eval HOSTLOGIN=root@\$ipv4_${host} - ssh $HOSTLOGIN 'if [ -f /var/run/charon.pid ]; then rm /var/run/charon.pid; echo " removed charon.pid on `hostname`"; fi' + ssh $SSHCONF $HOSTLOGIN 'if [ -f /var/run/charon.pid ]; then rm /var/run/charon.pid; echo " removed charon.pid on `hostname`"; fi' done done @@ -736,10 +746,20 @@ cecho "" HTDOCS="/var/www/localhost/htdocs" cecho-n "Copying test results to winnetou.." -ssh root@${ipv4_winnetou} mkdir -p $HTDOCS/testresults > /dev/null 2>&1 -scp -r $TODAYDIR root@${ipv4_winnetou}:$HTDOCS/testresults > /dev/null 2>&1 -ssh root@${ipv4_winnetou} ln -s $HTDOCS/images $HTDOCS/testresults/$TESTDATE/images > /dev/null 2>&1 +ssh $SSHCONF root@${ipv4_winnetou} mkdir -p $HTDOCS/testresults > /dev/null 2>&1 +scp $SSHCONF -r $TODAYDIR root@${ipv4_winnetou}:$HTDOCS/testresults > /dev/null 2>&1 +ssh $SSHCONF root@${ipv4_winnetou} ln -s $HTDOCS/images $HTDOCS/testresults/$TESTDATE/images > /dev/null 2>&1 cgecho "done" cecho "" cecho "The results are available in $TODAYDIR" cecho "or via the link http://$ipv4_winnetou/testresults/$TESTDATE" + + +########################################################################## +# close ssh sessions +# +for host in $STRONGSWANHOSTS +do + kill `eval echo \\\$ssh_pid_$host` +done + |