X-Git-Url: https://git.strongswan.org/?p=strongswan.git;a=blobdiff_plain;f=testing%2Fdo-tests;h=35f13ec5b353e663b9e30aca43368b74b74618c1;hp=7f7d9147a6edde468ab0482bfd084e706d511bfe;hb=f3a419e9c4a797dfcb08cbe11715d00f8a2f4707;hpb=bf48ee33e568ee8456fa8324a39b11946f4628a6 diff --git a/testing/do-tests b/testing/do-tests index 7f7d914..35f13ec 100755 --- a/testing/do-tests +++ b/testing/do-tests @@ -14,14 +14,17 @@ # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. -DIR=`dirname $0` +DIR=$(dirname `readlink -f $0`) +. $DIR/testing.conf +. $DIR/scripts/function.sh +SSHCONF="-F $DIR/ssh_config" -. $PWD/scripts/function.sh - -[ -d $PWD/hosts ] || die "Directory 'hosts' not found" -[ -d $PWD/tests ] || die "Directory 'tests' not found" -[ -d $BUILDDIR ] || die "Directory '$BUILDDIR' does not exist, please run make-testing first" +[ -d $DIR/hosts ] || die "Directory 'hosts' not found" +[ -d $DIR/tests ] || die "Directory 'tests' not found" +[ -d $BUILDDIR ] || + die "Directory '$BUILDDIR' does not exist, please run make-testing first" +ln -sfT $DIR $TESTDIR/testing ############################################################################## # take care of new path and file variables @@ -29,7 +32,7 @@ DIR=`dirname $0` [ -d $TESTRESULTSDIR ] || mkdir $TESTRESULTSDIR -TESTDATE=`date +%Y%m%d-%H%M` +TESTDATE=`date +%Y%m%d-%H%M-%S` TODAYDIR=$TESTRESULTSDIR/$TESTDATE mkdir $TODAYDIR @@ -98,6 +101,7 @@ for host in $STRONGSWANHOSTS do ssh $SSHCONF -N root@`eval echo \\\$ipv4_$host` >/dev/null 2>&1 & eval ssh_pid_$host="`echo $!`" + do_on_exit kill `eval echo \\\$ssh_pid_$host` done @@ -135,20 +139,20 @@ ENVIRONMENT_HEADER=$(cat <<@EOF cat > $INDEX <<@EOF - strongSwan UML Tests + strongSwan KVM Tests -

strongSwan UML Tests

+

strongSwan KVM Tests

$ENVIRONMENT_HEADER @EOF cat > $TESTRESULTSHTML <<@EOF - strongSwan UML Tests - All Tests + strongSwan KVM Tests - All Tests -
strongSwan UML Tests / All Tests
+
strongSwan KVM Tests / All Tests

All Tests

$ENVIRONMENT_HEADER @@ -171,10 +175,6 @@ echo if [ $# -gt 0 ] then TESTS=$* -elif [ $SELECTEDTESTSONLY = "yes" ] -then - # set internal field seperator - TESTS=$SELECTEDTESTS else # set internal field seperator TESTS="`ls $DEFAULTTESTSDIR`" @@ -213,11 +213,11 @@ do strongSwan $SUBDIR Tests -
strongSwan UML Tests / $SUBDIR
+
strongSwan KVM Tests / $SUBDIR

strongSwan $SUBDIR Tests

- + @@ -373,6 +373,15 @@ do done fi + ########################################################################## + # flush conntrack table on all hosts + # + + for host in $STRONGSWANHOSTS + do + ssh $SSHCONF root@`eval echo \\\$ipv4_$host` 'conntrack -F' >/dev/null 2>&1 + done + ########################################################################## # execute pre-test commands @@ -464,7 +473,7 @@ do
UML kernelGuest kernel $KERNELVERSION
-
strongSwan UML Tests / $SUBDIR / $name
+
strongSwan KVM Tests / $SUBDIR / $name

Test $testname

Description

@EOF @@ -475,27 +484,54 @@ do - $UMLHOSTS + $VIRTHOSTS @EOF for host in $IPSECHOSTS do eval HOSTLOGIN=root@\$ipv4_${host} - for command in statusall listall - do - ssh $SSHCONF $HOSTLOGIN ipsec $command \ - > $TESTRESULTDIR/${host}.$command 2>/dev/null - done + scp $SSHCONF $HOSTLOGIN:/etc/strongswan.conf \ + $TESTRESULTDIR/${host}.strongswan.conf > /dev/null 2>&1 - for file in strongswan.conf ipsec.conf ipsec.secrets - do - scp $SSHCONF $HOSTLOGIN:/etc/$file \ - $TESTRESULTDIR/${host}.$file > /dev/null 2>&1 - done + if [ $SUBDIR = "swanctl" ] + then + scp $SSHCONF $HOSTLOGIN:/etc/swanctl/swanctl.conf \ + $TESTRESULTDIR/${host}.swanctl.conf > /dev/null 2>&1 + + ssh $SSHCONF $HOSTLOGIN swanctl --list-conns \ + > $TESTRESULTDIR/${host}.swanctl.conns 2>/dev/null + + ssh $SSHCONF $HOSTLOGIN swanctl --list-certs \ + > $TESTRESULTDIR/${host}.swanctl.certs 2>/dev/null - scp $SSHCONF $HOSTLOGIN:/etc/ipsec.d/ipsec.sql \ - $TESTRESULTDIR/${host}.ipsec.sql > /dev/null 2>&1 + ssh $SSHCONF $HOSTLOGIN swanctl --list-pools \ + > $TESTRESULTDIR/${host}.swanctl.pools 2>/dev/null + + ssh $SSHCONF $HOSTLOGIN swanctl --list-sas \ + > $TESTRESULTDIR/${host}.swanctl.sas 2>/dev/null + + ssh $SSHCONF $HOSTLOGIN swanctl --list-pols \ + > $TESTRESULTDIR/${host}.swanctl.pols 2>/dev/null + + ssh $SSHCONF $HOSTLOGIN swanctl --stats \ + > $TESTRESULTDIR/${host}.swanctl.stats 2>/dev/null + else + for file in ipsec.conf ipsec.secrets + do + scp $SSHCONF $HOSTLOGIN:/etc/$file \ + $TESTRESULTDIR/${host}.$file > /dev/null 2>&1 + done + + for command in statusall listall + do + ssh $SSHCONF $HOSTLOGIN ipsec $command \ + > $TESTRESULTDIR/${host}.$command 2>/dev/null + done + + scp $SSHCONF $HOSTLOGIN:/etc/ipsec.d/ipsec.sql \ + $TESTRESULTDIR/${host}.ipsec.sql > /dev/null 2>&1 + fi ssh $SSHCONF $HOSTLOGIN ip -s xfrm policy \ > $TESTRESULTDIR/${host}.ip.policy 2>/dev/null @@ -506,7 +542,46 @@ do ssh $SSHCONF $HOSTLOGIN $IPTABLES_CMD \ > $TESTRESULTDIR/${host}.iptables 2>/dev/null chmod a+r $TESTRESULTDIR/* - cat >> $TESTRESULTDIR/index.html <<@EOF + + if [ $SUBDIR = "swanctl" ] + then + cat >> $TESTRESULTDIR/index.html <<@EOF +

$host

+ + + + + + +
+ + + + + +   +
+@EOF + + else + cat >> $TESTRESULTDIR/index.html <<@EOF

$host

@@ -537,7 +612,7 @@ do
@EOF - + fi done for host in $RADIUSHOSTS @@ -556,6 +631,9 @@ do scp $SSHCONF $HOSTLOGIN:/var/log/freeradius/radius.log \ $TESTRESULTDIR/${host}.radius.log > /dev/null 2>&1 + ssh $SSHCONF $HOSTLOGIN grep imcv /var/log/daemon.log \ + >> $TESTRESULTDIR/${host}.daemon.log 2>/dev/null + chmod a+r $TESTRESULTDIR/* cat >> $TESTRESULTDIR/index.html <<@EOF

$host

@@ -572,6 +650,7 @@ do
@@ -640,7 +719,7 @@ do for host in $IPSECHOSTS do eval HOSTLOGIN=root@\$ipv4_${host} - ssh $SSHCONF $HOSTLOGIN "grep -E 'charon|last message repeated' \ + ssh $SSHCONF $HOSTLOGIN "grep -E 'charon|last message repeated|imcv|pt-tls-client' \ /var/log/auth.log" >> $TESTRESULTDIR/${host}.auth.log done @@ -652,7 +731,7 @@ do for host in $IPSECHOSTS do eval HOSTLOGIN=root@\$ipv4_${host} - ssh $SSHCONF $HOSTLOGIN "grep -E 'charon|last message repeated' \ + ssh $SSHCONF $HOSTLOGIN "grep -E 'charon|last message repeated|imcv' \ /var/log/daemon.log" >> $TESTRESULTDIR/${host}.daemon.log done @@ -786,11 +865,3 @@ echo "or via the link http://$ipv4_winnetou/testresults/$TESTDATE" ENDDATE=`date +%Y%m%d-%H%M` echo echo "Finished : $ENDDATE" - -########################################################################## -# close ssh sessions -# -for host in $STRONGSWANHOSTS -do - kill `eval echo \\\$ssh_pid_$host` -done