2009-02-17 13:53:59 +01:00
|
|
|
TIMEOUT(240000);
|
2009-01-08 18:11:06 +01:00
|
|
|
|
|
|
|
nr_recv = 0;
|
|
|
|
nr_timedout = 0;
|
|
|
|
nr_sent = 0;
|
|
|
|
|
|
|
|
while (nr_sent < 10) {
|
2008-11-11 16:00:43 +01:00
|
|
|
|
|
|
|
/* Count received packets */
|
2009-03-03 13:21:06 +01:00
|
|
|
if (msg.contains('received') && !msg.contains('DUPLICATE')) {
|
2009-01-08 18:11:06 +01:00
|
|
|
nr_recv++;
|
2009-02-17 13:53:59 +01:00
|
|
|
log.log("RECV=" + nr_recv + ", sent=" + nr_sent + ", timedout=" + nr_timedout + "\n");
|
2008-11-11 16:00:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Count timed out packets */
|
2009-01-08 18:11:06 +01:00
|
|
|
else if (msg.contains('timed out')) {
|
|
|
|
nr_timedout++;
|
2009-02-17 13:53:59 +01:00
|
|
|
log.log("recv=" + nr_recv + ", sent=" + nr_sent + ", TIMEDOUT=" + nr_timedout + "\n");
|
2008-11-11 16:00:43 +01:00
|
|
|
}
|
|
|
|
|
2009-01-08 18:11:06 +01:00
|
|
|
/* Count sent packets */
|
|
|
|
else if (msg.contains('sent to')) {
|
|
|
|
nr_sent++;
|
2009-02-17 13:53:59 +01:00
|
|
|
log.log("recv=" + nr_recv + ", SENT=" + nr_sent + ", timedout=" + nr_timedout + "\n");
|
2009-01-08 18:11:06 +01:00
|
|
|
}
|
2008-11-11 16:00:43 +01:00
|
|
|
|
2009-01-08 18:11:06 +01:00
|
|
|
YIELD();
|
|
|
|
}
|
2008-11-11 16:00:43 +01:00
|
|
|
|
2009-01-08 18:11:06 +01:00
|
|
|
/* Make sure received counter matches sent counter */
|
2009-02-17 13:53:59 +01:00
|
|
|
if (nr_recv < nr_sent-3) {
|
|
|
|
log.log("Error: Received << Sent!\n");
|
|
|
|
log.log("recv=" + nr_recv + ", sent=" + nr_sent + ", timedout=" + nr_timedout + "\n");
|
|
|
|
log.testFailed();
|
|
|
|
}
|
|
|
|
|
2009-02-17 13:58:13 +01:00
|
|
|
else if (nr_recv > nr_sent+3) {
|
2009-02-17 13:53:59 +01:00
|
|
|
log.log("Error: Received >> Sent!\n");
|
|
|
|
log.log("recv=" + nr_recv + ", sent=" + nr_sent + ", timedout=" + nr_timedout + "\n");
|
2009-01-08 18:11:06 +01:00
|
|
|
log.testFailed();
|
2008-11-11 16:00:43 +01:00
|
|
|
}
|
|
|
|
|
2009-01-08 18:11:06 +01:00
|
|
|
/* Make sure some packets timed out (all from node 4) */
|
2009-02-17 13:58:13 +01:00
|
|
|
else if (nr_timedout < 2) {
|
2009-02-17 13:53:59 +01:00
|
|
|
log.log("Error: Too few packets timed out!\n");
|
|
|
|
log.log("recv=" + nr_recv + ", sent=" + nr_sent + ", timedout=" + nr_timedout + "\n");
|
2009-01-08 18:11:06 +01:00
|
|
|
log.testFailed();
|
2008-11-11 16:00:43 +01:00
|
|
|
}
|
2009-01-08 18:11:06 +01:00
|
|
|
|
2009-02-17 13:58:13 +01:00
|
|
|
else {
|
|
|
|
log.log("recv=" + nr_recv + ", sent=" + nr_sent + ", timedout=" + nr_timedout + "\n");
|
|
|
|
log.testOK();
|
|
|
|
}
|