summaryrefslogtreecommitdiff
path: root/testing/do-tests
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2015-11-18 14:49:27 +0100
committerYves-Alexis Perez <corsac@debian.org>2015-11-18 14:49:27 +0100
commit1e980d6be0ef0e243c6fe82b5e855454b97e24a4 (patch)
tree0d59eec2ce2ed332434ae80fc78a44db9ad293c5 /testing/do-tests
parent5dca9ea0e2931f0e2a056c7964d311bcc30a01b8 (diff)
downloadvyos-strongswan-1e980d6be0ef0e243c6fe82b5e855454b97e24a4.tar.gz
vyos-strongswan-1e980d6be0ef0e243c6fe82b5e855454b97e24a4.zip
Imported Upstream version 5.3.4
Diffstat (limited to 'testing/do-tests')
-rwxr-xr-xtesting/do-tests79
1 files changed, 52 insertions, 27 deletions
diff --git a/testing/do-tests b/testing/do-tests
index c01152c7b..c87ba05a7 100755
--- a/testing/do-tests
+++ b/testing/do-tests
@@ -47,7 +47,6 @@ testnumber="0"
failed_cnt="0"
passed_cnt="0"
-
##############################################################################
# copy default tests to $BUILDDIR
#
@@ -105,6 +104,12 @@ do
do_on_exit kill `eval echo \\\$ssh_pid_$host`
done
+##############################################################################
+# determine actual software versions
+#
+
+[ -f $SHAREDDIR/.strongswan-version ] && SWANVERSION=`cat $SHAREDDIR/.strongswan-version`
+KERNELVERSION=`ssh $SSHCONF root@\$ipv4_winnetou uname -r 2>/dev/null`
##############################################################################
# create header for the results html file
@@ -131,7 +136,7 @@ ENVIRONMENT_HEADER=$(cat <<@EOF
<tr>
<td width="100">&nbsp;</td>
<td width="300">&nbsp;</td>
- <td width=" 50">&nbsp;</td>
+ <td width=" 80">&nbsp;</td>
<td >&nbsp;</td>
</tr>
@EOF
@@ -159,7 +164,8 @@ cat > $TESTRESULTSHTML <<@EOF
<tr align="left">
<th>Number</th>
<th>Test</th>
- <th colspan="2">Result</th>
+ <th align="right">Time [s]</th>
+ <th>Result</th>
</tr>
@EOF
@@ -249,6 +255,8 @@ do
testname=$SUBDIR/$name
log_action " $testnumber $testname:"
+ teststart=$(date +%s)
+
if [ ! -d $DEFAULTTESTSDIR/${testname} ]
then
echo "is missing..skipped"
@@ -329,8 +337,11 @@ do
# copy test specific configurations to uml hosts and clear auth.log files
#
+ DBDIR=/etc/db.d
+
$DIR/scripts/load-testconfig $testname
unset RADIUSHOSTS
+ unset DBHOSTS
unset IPV6
unset SWANCTL
source $TESTDIR/test.conf
@@ -356,6 +367,17 @@ do
fi
##########################################################################
+ # create database directory in RAM
+ #
+
+ for host in $DBHOSTS
+ do
+ eval HOSTLOGIN=root@\$ipv4_${host}
+ ssh $SSHCONF $HOSTLOGIN "mkdir -p $DBDIR; mount -t ramfs -o size=5m ramfs $DBDIR" >/dev/null 2>&1
+ ssh $SSHCONF $HOSTLOGIN "chgrp www-data $DBDIR; chmod g+w $DBDIR" >/dev/null 2>&1
+ done
+
+ ##########################################################################
# flush conntrack table on all hosts
#
@@ -504,32 +526,20 @@ do
scp $SSHCONF $HOSTLOGIN:/etc/strongswan.conf \
$TESTRESULTDIR/${host}.strongswan.conf > /dev/null 2>&1
-
if [ -n "$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
+ for subsys in conns certs pools authorities sas pols
+ do
+ ssh $SSHCONF $HOSTLOGIN swanctl --list-$subsys \
+ > $TESTRESULTDIR/${host}.swanctl.$subsys 2>/dev/null
+ done
- ssh $SSHCONF $HOSTLOGIN swanctl --list-certs \
- > $TESTRESULTDIR/${host}.swanctl.certs 2>/dev/null
-
- ssh $SSHCONF $HOSTLOGIN swanctl --list-pools \
- > $TESTRESULTDIR/${host}.swanctl.pools 2>/dev/null
-
- ssh $SSHCONF $HOSTLOGIN swanctl --list-authorities \
- > $TESTRESULTDIR/${host}.swanctl.authorities 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
+ # this is quite slow due to allocation stats via leak-detective
+ ssh $SSHCONF $HOSTLOGIN swanctl --stats \
+ > $TESTRESULTDIR/${host}.swanctl.stats 2>/dev/null
else
for file in ipsec.conf ipsec.secrets
do
@@ -752,7 +762,7 @@ do
for host in $IPSECHOSTS
do
eval HOSTLOGIN=root@\$ipv4_${host}
- ssh $SSHCONF $HOSTLOGIN "grep -E 'charon|last message repeated|imcv|pt-tls-client' \
+ ssh $SSHCONF $HOSTLOGIN "grep -s -E 'charon|last message repeated|imcv|pt-tls-client' \
/var/log/auth.log" >> $TESTRESULTDIR/${host}.auth.log
done
@@ -764,7 +774,7 @@ do
for host in $IPSECHOSTS
do
eval HOSTLOGIN=root@\$ipv4_${host}
- ssh $SSHCONF $HOSTLOGIN "grep -E 'charon|last message repeated|imcv' \
+ ssh $SSHCONF $HOSTLOGIN "grep -s -E 'charon|last message repeated|imcv' \
/var/log/daemon.log" >> $TESTRESULTDIR/${host}.daemon.log
done
@@ -783,6 +793,15 @@ do
fi
done
+ ##########################################################################
+ # remove database directory if needed
+ #
+
+ for host in $DBHOSTS
+ do
+ eval HOSTLOGIN=root@\$ipv4_${host}
+ ssh $SSHCONF $HOSTLOGIN "umount $DBDIR; rm -r $DBDIR" > /dev/null 2>&1
+ done
##########################################################################
# copy default host config back if necessary
@@ -794,6 +813,9 @@ do
##########################################################################
# write test status to html file
#
+ testend=$(date +%s)
+ let "testend -= teststart"
+ let "timetotal += testend"
if [ $STATUS = "passed" ]
then
@@ -808,8 +830,8 @@ do
<tr>
<td>$testnumber</td>
<td><a href="$testname/index.html">$testname</a></td>
+ <td align="right">$testend</td>
<td><a href="$testname/console.log"><font color="$COLOR">$STATUS</font></a></td>
- <td>&nbsp;</td>
</tr>
@EOF
cat >> $SUBTESTSINDEX << @EOF
@@ -851,6 +873,9 @@ cat >> $TESTRESULTSHTML << @EOF
<tr>
<td><b>Failed</b></td><td><b><font color="red">$failed_cnt</font></b></td><td>&nbsp;</td><td>&nbsp;</td>
</tr>
+ <tr>
+ <td><b>Time [s]</b></td><td><b><font color="blue">$timetotal</font></b></td><td>&nbsp;</td><td>&nbsp;</td>
+ </tr>
</table>
</body>
</html>
@@ -895,6 +920,6 @@ echo
echo "The results are available in $TODAYDIR"
echo "or via the link http://$ipv4_winnetou/testresults/$TESTDATE"
-ENDDATE=`date +%Y%m%d-%H%M`
+ENDDATE=`date +%Y%m%d-%H%M-%S`
echo
echo "Finished : $ENDDATE"