Border router CI test: check that all ping replies are received
@@ -9,6 +9,9 @@ BASENAME=$2
# Destination IPv6
IPADDR=$3
+# ICMP request-reply count
+COUNT=5
+
# Start simulation
echo "Starting Cooja simulation $BASENAME.csc"
java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$BASENAME.csc -contiki=$CONTIKI > $BASENAME.coojalog &
@@ -28,9 +31,10 @@ sleep 5
# Do ping
echo "Pinging"
-ping6 $IPADDR -c 5 | tee $BASENAME.scriptlog
+ping6 $IPADDR -c $COUNT | tee $BASENAME.scriptlog
# Fetch ping6 status code (not $? because this is piped)
STATUS=${PIPESTATUS[0]}
+REPLIES=`grep -c 'icmp_seq=' $BASENAME.scriptlog`
echo "Closing simulation and tunslip6"
sleep 1
@@ -40,7 +44,7 @@ sleep 1
rm COOJA.testlog
rm COOJA.log
-if [ $STATUS -eq 0 ] ; then
+if [ $STATUS -eq 0 ] && [ $REPLIES -eq $COUNT ] ; then
printf "%-32s TEST OK\n" "$BASENAME" | tee $BASENAME.testlog;
else
echo "==== $BASENAME.coojalog ====" ; cat $BASENAME.coojalog;
