Travis: The test criteria for this test was too strict --- one or two

packets get lost. Change the test to ensure that data comes back from
every node and we get at least 75 non-duplicate reports.
This commit is contained in:
Mariano Alvira 2013-05-18 16:19:55 -04:00
parent d396832d48
commit 585dd3fdbd

View File

@ -501,7 +501,7 @@ print()
for(i = 1; i <= nrNodes; i++) {
log.log("Node " + i + " ");
if(i == sink) {
log.log("sink\n");
log.log("sink. Got " + total + " non-dups from " + num_reported + " nodes.\n");
} else {
log.log("received: " + received[i] + " hops: " + hops[i] + "\n");
}
@ -517,12 +517,15 @@ booted = new Array();
received = new Array();
hops = new Array();
nrNodes = 25;
total = 0; /* number of non-dups the sink received */
reported = new Array(); /* nodes that have reported at least once */
nodes_starting = true;
for(i = 1; i <= nrNodes; i++) {
booted[i] = false;
received[i] = "_____";
hops[i] = received[i];
reported[i] = 0;
}
/* Wait until all nodes have started */
@ -579,9 +582,11 @@ while(true) {
source = node_id & 0xff;
seqno = seqno - 1;
dups = received[source].substr(seqno, 1);
reported[source]++;
if(dups == "_") {
dups = 1;
total++;
} else if(dups < 9) {
dups++;
}
@ -598,12 +603,12 @@ while(true) {
/* Signal OK if all nodes have reported 10 messages. */
num_reported = 0;
for(i = 1; i <= nrNodes; i++) {
if(!isNaN(received[i])) {
if(reported[i] > 0) {
num_reported++;
}
}
if(num_reported == nrNodes - 1) {
if((num_reported == nrNodes - 1) && (total >= 75)) {
print();
log.testOK();
}