osd-contiki/tools/cooja/contiki_tests/rime_runicast.js

47 lines
1 KiB
JavaScript
Raw Normal View History

2009-01-08 18:11:06 +01:00
TIMEOUT(120000);
nr_recv = 0;
nr_timedout = 0;
nr_sent = 0;
while (nr_sent < 10) {
/* Count received packets */
if (msg.contains('received')) {
2009-01-08 18:11:06 +01:00
nr_recv++;
log.log("Received packets count now: " + nr_recv + "\n");
}
/* Count timed out packets */
2009-01-08 18:11:06 +01:00
else if (msg.contains('timed out')) {
nr_timedout++;
log.log("Timed out packets count now: " + nr_timedout + "\n");
}
2009-01-08 18:11:06 +01:00
/* Count sent packets */
else if (msg.contains('sent to')) {
nr_sent++;
log.log("Sent packets count now: " + nr_sent + "\n");
}
2009-01-08 18:11:06 +01:00
YIELD();
}
2009-01-08 18:11:06 +01:00
/* Make sure received counter matches sent counter */
if (nr_recv < nr_sent) {
log.log("Received < Sent: " + nr_recv + " < " + nr_sent + "\n");
log.log("Received packets less than acked sent packets!\n");
log.testFailed();
}
2009-01-08 18:11:06 +01:00
/* Make sure some packets timed out (all from node 4) */
if (nr_timedout < 2) {
log.log("Timed out: " + nr_timedout + "\n");
log.log("Too few packets timed out!\n");
log.testFailed();
}
2009-01-08 18:11:06 +01:00
log.log("Received / Sent: " + nr_recv + " / " + nr_sent + "\n");
log.log("Timed out: " + nr_timedout + "\n");
log.testOK();