New and improved shell collect test: the new test sends out 10 packets from each node and counts the received packets. If less than 10 packets from each node is received, the test fails

This commit is contained in:
adamdunkels 2010-02-23 18:46:20 +00:00
parent 85a9f7db42
commit 14bc9aa98b

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<project>../apps/mrm</project>
<project>../apps/mspsim</project>
<project>../apps/avrora</project>
<project>../apps/native_gateway</project>
<project>[CONTIKI_DIR]/tools/cooja/apps/mrm</project>
<project>[CONTIKI_DIR]/tools/cooja/apps/mspsim</project>
<project>[CONTIKI_DIR]/tools/cooja/apps/avrora</project>
<project>[CONTIKI_DIR]/tools/cooja/apps/native_gateway</project>
<simulation>
<title>My simulation</title>
<delaytime>0</delaytime>
@ -12,18 +12,21 @@
<radiomedium>
se.sics.cooja.radiomediums.UDGM
<transmitting_range>50.0</transmitting_range>
<interference_range>100.0</interference_range>
<interference_range>150.0</interference_range>
<success_ratio_tx>1.0</success_ratio_tx>
<success_ratio_rx>1.0</success_ratio_rx>
</radiomedium>
<events>
<logoutput>40000</logoutput>
</events>
<motetype>
se.sics.cooja.mspmote.SkyMoteType
<identifier>sky1</identifier>
<description>Sky Mote Type #1</description>
<source>../../../examples/sky-shell/sky-shell.c</source>
<commands>make clean TARGET=sky
<source>[CONTIKI_DIR]/examples/sky-shell/sky-shell.c</source>
<commands>make clean
make sky-shell.sky TARGET=sky</commands>
<firmware>../../../examples/sky-shell/sky-shell.sky</firmware>
<firmware>[CONTIKI_DIR]/examples/sky-shell/sky-shell.sky</firmware>
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
<moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface>
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
@ -32,12 +35,11 @@ make sky-shell.sky TARGET=sky</commands>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyByteRadio</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkySerial</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.MspSerial</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyLED</moteinterface>
</motetype>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -49,10 +51,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>1</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -64,10 +66,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>2</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -79,10 +81,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>3</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -94,10 +96,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>4</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -109,10 +111,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>5</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -124,10 +126,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>6</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -139,10 +141,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>7</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -154,10 +156,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>8</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -169,10 +171,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>9</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -184,10 +186,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>10</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -199,10 +201,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>11</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -214,10 +216,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>12</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -229,10 +231,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>13</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -244,10 +246,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>14</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -259,10 +261,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>15</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -274,10 +276,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>16</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -289,10 +291,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>17</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -304,10 +306,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>18</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -319,10 +321,10 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>19</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
@ -334,6 +336,7 @@ make sky-shell.sky TARGET=sky</commands>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>20</id>
</interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote>
</simulation>
<plugin>
@ -342,22 +345,22 @@ make sky-shell.sky TARGET=sky</commands>
<filter />
</plugin_config>
<width>690</width>
<z>1</z>
<z>2</z>
<height>207</height>
<location_x>0</location_x>
<location_y>493</location_y>
<location_x>327</location_x>
<location_y>24</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.ScriptRunner
<plugin_config>
<script>
function
<script>function
print_stats()
{
log.log("Time " + time + "\n");
log.log("Received " + total_received + " messages, " +
(total_received / nrNodes) + " messages/node, " +
total_reorder + " reordered, " +
total_lost + " lost, " +
(total_lost / nrNodes) + " lost/node, " +
total_dups + " dups, " +
@ -378,6 +381,11 @@ print_stats()
log.log(dups[i] + " ");
}
log.log("\n");
log.log("Reorder: ");
for(i = 1; i &lt;= nrNodes; i++) {
log.log(reorder[i] + " ");
}
log.log("\n");
log.log("Hops: ");
for(i = 1; i &lt;= nrNodes; i++) {
log.log(hops[i] + " ");
@ -394,9 +402,11 @@ print_stats()
"% tx " + 100 * total_transmit / (total_cpu + total_lpm) +
"% average latency " + total_latency / (4096 * total_received) +
" ms \n");
}
TIMEOUT(500000, print_stats());
TIMEOUT(500000);
/* Conf. */
booted = new Array();
@ -405,11 +415,13 @@ hops = new Array();
seqnos = new Array();
lost = new Array();
dups = new Array();
reorder = new Array();
nrNodes = 20;
total_received = 0;
total_lost = 0;
total_hops = 0;
total_dups = 0;
total_reorder = 0;
total_cpu = total_lpm = total_listen = total_transmit = 0;
@ -423,6 +435,7 @@ for(i = 1; i &lt;= nrNodes; i++) {
seqnos[i] = -1;
lost[i] = 0;
dups[i] = 0;
reorder[i] = 0;
}
/* Wait until all nodes have started */
@ -445,15 +458,16 @@ while(nodes_starting) {
/* Create sink */
log.log("All nodes booted, creating sink at node " + id + "\n");
sink = id;
sink_node = node;
/* Wait for prompt */
YIELD_THEN_WAIT_UNTIL(id == sink);
/*mote.getInterfaces().getButton().clickButton()*/
log.log("Writing netcmd\n");
node.write("netcmd { repeat 0 40 { randwait 40 sky-alldata | blink | send } }");
YIELD_THEN_WAIT_UNTIL(id == sink);
log.log("Writing collect command\n");
node.write("collect | timestamp | blink | binprint &amp;");
GENERATE_MSG(20000, "continue");
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
node = sink_node;
log.log("Writing netcmd\n");
node.write("netcmd { repeat 10 30 { randwait 30 sky-alldata | blink | send } }");
while(true) {
YIELD();
@ -505,66 +519,103 @@ while(true) {
total_received++;
total_hops += hop;
if(seqno_gap == 2) {
if(seqno_gap >= 2) {
total_lost += seqno_gap - 1;
lost[source] += seqno_gap - 1;
total_received--;
total_hops -= hop;
count[source]--;
} else if(seqno_gap == 0) {
total_dups += 1;
dups[source] += 1;
total_received--;
total_hops -= hop;
count[source]--;
} else if(seqno_gap == -1) {
total_reorder += 1;
reorder[source] += 1;
}
print_stats();
}
/* Fail if the sink has received more than 10 messages from any node. */
/* Signal OK if all nodes have reported 10 messages. */
num_reported = 0;
for(i = 1; i &lt;= nrNodes; i++) {
if(i != sink &amp;&amp; count[i] &gt; 10) {
print_stats();
log.testFailed(); /* We are done! */
}
}
/* Wait until the sink have received at least two messages from
every node, except the sink, which doesn't send packets. */
for(i = 1; i &lt;= nrNodes; i++) {
if(i != sink) {
if(count[i] &lt; 2) {
break;
}
if(i == nrNodes) {
print_stats();
log.testOK();
}
if(i != sink &amp;&amp; count[i] == 10) {
num_reported++;
}
}
if(num_reported == nrNodes - 1) {
print_stats();
log.testOK();
}
}</script>
<active>true</active>
</plugin_config>
<width>600</width>
<z>2</z>
<height>700</height>
<location_x>259</location_x>
<width>602</width>
<z>3</z>
<height>413</height>
<location_x>257</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.SimControl
<width>259</width>
<z>3</z>
<z>1</z>
<height>200</height>
<location_x>0</location_x>
<location_y>-1</location_y>
<location_x>4</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.Visualizer
<plugin_config>
<skin>Mote IDs</skin>
<skin>Radio environment (UDGM)</skin>
<skin>se.sics.cooja.plugins.skins.IDVisualizerSkin</skin>
<skin>se.sics.cooja.plugins.skins.UDGMVisualizerSkin</skin>
<viewport>2.3981827551130066 0.0 0.0 2.3981827551130066 8.139022870763759 0.1214717784430076</viewport>
</plugin_config>
<width>260</width>
<z>0</z>
<z>4</z>
<height>296</height>
<location_x>0</location_x>
<location_y>197</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.TimeLine
<plugin_config>
<mote>0</mote>
<mote>1</mote>
<mote>2</mote>
<mote>3</mote>
<mote>4</mote>
<mote>5</mote>
<mote>6</mote>
<mote>7</mote>
<mote>8</mote>
<mote>9</mote>
<mote>10</mote>
<mote>11</mote>
<mote>12</mote>
<mote>13</mote>
<mote>14</mote>
<mote>15</mote>
<mote>16</mote>
<mote>17</mote>
<mote>18</mote>
<mote>19</mote>
<showRadioRXTX />
<showRadioHW />
<showLEDs />
<split>118</split>
<zoom>9</zoom>
</plugin_config>
<width>1024</width>
<z>0</z>
<height>438</height>
<location_x>0</location_x>
<location_y>260</location_y>
<minimized>false</minimized>
</plugin>
</simconf>