summaryrefslogtreecommitdiff
path: root/testing/do-tests
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
committerYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
commitbf372706c469764d59e9f29c39e3ecbebd72b8d2 (patch)
tree0f0e296e2d50e4a7faf99ae6fa428d2681e81ea1 /testing/do-tests
parent518dd33c94e041db0444c7d1f33da363bb8e3faf (diff)
downloadvyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.tar.gz
vyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.zip
Imported Upstream version 5.5.0
Diffstat (limited to 'testing/do-tests')
-rwxr-xr-xtesting/do-tests28
1 files changed, 16 insertions, 12 deletions
diff --git a/testing/do-tests b/testing/do-tests
index 2a424e523..d0d1ead88 100755
--- a/testing/do-tests
+++ b/testing/do-tests
@@ -111,6 +111,13 @@ done
[ -f $SHAREDDIR/.strongswan-version ] && SWANVERSION=`cat $SHAREDDIR/.strongswan-version`
KERNELVERSION=`ssh $SSHCONF root@\$ipv4_winnetou uname -r 2>/dev/null`
+# check if tcpdump supports --immediate-mode
+ssh $SSHCONF root@$ipv4_winnetou tcpdump --immediate-mode -c 1 >/dev/null 2>&1
+if [ $? -eq 0 ]
+then
+ TCPDUMP_IM=--immediate-mode
+fi
+
##############################################################################
# create header for the results html file
#
@@ -359,7 +366,7 @@ do
do
host=`echo $host_iface | awk -F ":" '{print $1}'`
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 &"
+ tcpdump_cmd="tcpdump -l $TCPDUMP_IM -i $iface not port ssh and not port domain >/tmp/tcpdump.log 2>/tmp/tcpdump.err.log &"
echo "${host}# $tcpdump_cmd" >> $CONSOLE_LOG
ssh $SSHCONF root@`eval echo \\\$ipv4_$host '$tcpdump_cmd'`
eval TDUP_${host}="true"
@@ -417,10 +424,12 @@ do
#
function stop_tcpdump {
+ # wait for packets to get processed, but don't wait longer than 1s
+ eval ssh $SSHCONF root@\$ipv4_${1} "\"i=100; while [ \\\$i -gt 0 ]; do pkill -USR1 tcpdump; tail -1 /tmp/tcpdump.err.log | perl -n -e '/(\\d+).*?(\\d+)/; exit (\\\$1 == \\\$2)' || break; sleep 0.01; i=\\\$((\\\$i-1)); done;\""
echo "${1}# killall tcpdump" >> $CONSOLE_LOG
- eval ssh $SSHCONF root@\$ipv4_${1} killall tcpdump
+ eval ssh $SSHCONF root@\$ipv4_${1} "\"killall tcpdump; while true; do killall -q -0 tcpdump || break; sleep 0.01; done;\""
eval TDUP_${1}="false"
- echo ""
+ echo "" >> $CONSOLE_LOG
}
@@ -712,15 +721,9 @@ do
for host in $TCPDUMPHOSTS
do
- eval HOSTLOGIN=root@\$ipv4_${host}
-
- scp $SSHCONF $HOSTLOGIN:/tmp/tcpdump.log \
- $TESTRESULTDIR/${host}.tcpdump.log > /dev/null 2>&1
-
cat >> $TESTRESULTDIR/index.html <<@EOF
<li><a href="$host.tcpdump.log">$host tcpdump.log</a></li>
@EOF
-
done
cat >> $TESTRESULTDIR/index.html <<@EOF
@@ -802,10 +805,11 @@ do
do
if [ "`eval echo \\\$TDUP_${host}`" = "true" ]
then
- echo "${host}# killall tcpdump" >> $CONSOLE_LOG
- eval ssh $SSHCONF root@\$ipv4_$host killall tcpdump
- eval TDUP_${host}="false"
+ stop_tcpdump $host
fi
+ eval HOSTLOGIN=root@\$ipv4_${host}
+ scp $SSHCONF $HOSTLOGIN:/tmp/tcpdump.log \
+ $TESTRESULTDIR/${host}.tcpdump.log > /dev/null 2>&1
done
##########################################################################