improved test: reading files with blocksize 13, verifying the complete file30.txt output, no newlines when writing mote commands

This commit is contained in:
fros4943 2010-01-22 16:57:56 +00:00
parent 8f296ac2fb
commit 7c924089da

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<simconf> <simconf>
<project>../apps/mrm</project> <project>[CONTIKI_DIR]/tools/cooja/apps/mrm</project>
<project>../apps/mspsim</project> <project>[CONTIKI_DIR]/tools/cooja/apps/mspsim</project>
<project>../apps/avrora</project> <project>[CONTIKI_DIR]/tools/cooja/apps/avrora</project>
<project>../apps/native_gateway</project>
<simulation> <simulation>
<title>My simulation</title> <title>My simulation</title>
<delaytime>0</delaytime> <delaytime>0</delaytime>
@ -16,13 +15,16 @@
<success_ratio_tx>0.95</success_ratio_tx> <success_ratio_tx>0.95</success_ratio_tx>
<success_ratio_rx>1.0</success_ratio_rx> <success_ratio_rx>1.0</success_ratio_rx>
</radiomedium> </radiomedium>
<events>
<logoutput>40000</logoutput>
</events>
<motetype> <motetype>
se.sics.cooja.mspmote.SkyMoteType se.sics.cooja.mspmote.SkyMoteType
<identifier>sky1</identifier> <identifier>sky1</identifier>
<description>Sky Mote Type #sky1</description> <description>Sky Mote Type #sky1</description>
<source>../../../examples/sky-shell/sky-checkpoint.c</source> <source>[CONTIKI_DIR]/examples/sky-shell/sky-checkpoint.c</source>
<commands>make sky-checkpoint.sky TARGET=sky</commands> <commands>make sky-checkpoint.sky TARGET=sky</commands>
<firmware>../../../examples/sky-shell/sky-checkpoint.sky</firmware> <firmware>[CONTIKI_DIR]/examples/sky-shell/sky-checkpoint.sky</firmware>
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface> <moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
<moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface> <moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface>
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface> <moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
@ -31,12 +33,11 @@
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface> <moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface> <moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyByteRadio</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> <moteinterface>se.sics.cooja.mspmote.interfaces.SkyLED</moteinterface>
</motetype> </motetype>
<mote> <mote>
se.sics.cooja.mspmote.SkyMote se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints /> <breakpoints />
<interface_config> <interface_config>
se.sics.cooja.interfaces.Position se.sics.cooja.interfaces.Position
@ -48,10 +49,10 @@
se.sics.cooja.mspmote.interfaces.MspMoteID se.sics.cooja.mspmote.interfaces.MspMoteID
<id>1</id> <id>1</id>
</interface_config> </interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote> </mote>
<mote> <mote>
se.sics.cooja.mspmote.SkyMote se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints /> <breakpoints />
<interface_config> <interface_config>
se.sics.cooja.interfaces.Position se.sics.cooja.interfaces.Position
@ -63,12 +64,13 @@
se.sics.cooja.mspmote.interfaces.MspMoteID se.sics.cooja.mspmote.interfaces.MspMoteID
<id>2</id> <id>2</id>
</interface_config> </interface_config>
<motetype_identifier>sky1</motetype_identifier>
</mote> </mote>
</simulation> </simulation>
<plugin> <plugin>
se.sics.cooja.plugins.SimControl se.sics.cooja.plugins.SimControl
<width>268</width> <width>268</width>
<z>4</z> <z>5</z>
<height>201</height> <height>201</height>
<location_x>0</location_x> <location_x>0</location_x>
<location_y>1</location_y> <location_y>1</location_y>
@ -81,8 +83,8 @@
<interface>Serial port</interface> <interface>Serial port</interface>
<scrollpos>0,0</scrollpos> <scrollpos>0,0</scrollpos>
</plugin_config> </plugin_config>
<width>359</width> <width>378</width>
<z>3</z> <z>2</z>
<height>485</height> <height>485</height>
<location_x>2</location_x> <location_x>2</location_x>
<location_y>201</location_y> <location_y>201</location_y>
@ -95,30 +97,34 @@
<interface>Serial port</interface> <interface>Serial port</interface>
<scrollpos>0,0</scrollpos> <scrollpos>0,0</scrollpos>
</plugin_config> </plugin_config>
<width>384</width> <width>395</width>
<z>2</z> <z>3</z>
<height>488</height> <height>486</height>
<location_x>390</location_x> <location_x>379</location_x>
<location_y>199</location_y> <location_y>201</location_y>
<minimized>false</minimized> <minimized>false</minimized>
</plugin> </plugin>
<plugin> <plugin>
se.sics.cooja.plugins.Visualizer se.sics.cooja.plugins.Visualizer
<plugin_config> <plugin_config>
<skin>Radio environment (UDGM)</skin> <skin>se.sics.cooja.plugins.skins.UDGMVisualizerSkin</skin>
<skin>Mote IDs</skin> <skin>se.sics.cooja.plugins.skins.IDVisualizerSkin</skin>
<skin>se.sics.cooja.plugins.skins.TrafficVisualizerSkin</skin>
<skin>se.sics.cooja.plugins.skins.AddressVisualizerSkin</skin>
<skin>se.sics.cooja.plugins.skins.LogVisualizerSkin</skin>
<viewport>10.082791180977951 0.0 0.0 10.082791180977951 266.248788516359 -780.5960558101059</viewport>
</plugin_config> </plugin_config>
<width>126</width> <width>505</width>
<z>1</z> <z>1</z>
<height>198</height> <height>200</height>
<location_x>649</location_x> <location_x>269</location_x>
<location_y>1</location_y> <location_y>1</location_y>
<minimized>false</minimized> <minimized>false</minimized>
</plugin> </plugin>
<plugin> <plugin>
se.sics.cooja.plugins.ScriptRunner se.sics.cooja.plugins.ScriptRunner
<plugin_config> <plugin_config>
<script>TIMEOUT(150000); /* print last msg at timeout */ <script>TIMEOUT(150000, log.log("last msg: " + msg + "\n"));
/* Wait for nodes to boot */ /* Wait for nodes to boot */
mote1 = null; mote1 = null;
@ -136,24 +142,24 @@ GENERATE_MSG(2000, "continue");
YIELD_THEN_WAIT_UNTIL(msg.equals("continue")); YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
/* Generate initial file */ /* Generate initial file */
fileID = 1; fileID = 10;
command = "echo *mote1data" + fileID + " | write file" + fileID + ".txt\n"; command = "echo *mote1data" + fileID + " | write file" + fileID + ".txt";
log.log("mote1&gt; " + command); log.log("mote1&gt; " + command + "\n");
write(mote1, command); write(mote1, command);
YIELD_THEN_WAIT_UNTIL(id == 1 &amp;&amp; msg.contains("Contiki&gt;")); YIELD_THEN_WAIT_UNTIL(id == 1 &amp;&amp; msg.contains("Contiki&gt;"));
/* Download and append files */ /* Download and append files */
while (fileID &lt; 20) { while (fileID &lt; 30) {
/* Mote 1 -&gt; Mote 2 */ /* Mote 1 -&gt; Mote 2 */
srcFile = "file" + fileID + ".txt"; srcFile = "file" + fileID + ".txt";
fileID++; fileID++;
dstFile = "file" + fileID + ".txt"; dstFile = "file" + fileID + ".txt";
command = "download 1.0 " + srcFile + " | write " + dstFile + " | null\n"; command = "download 1.0 " + srcFile + " | write " + dstFile + " | null";
log.log("mote2&gt; " + command); log.log("mote2&gt; " + command + "\n");
write(mote2, command); write(mote2, command);
YIELD_THEN_WAIT_UNTIL(id == 2 &amp;&amp; msg.contains("Contiki&gt;")); YIELD_THEN_WAIT_UNTIL(id == 2 &amp;&amp; msg.contains("Contiki&gt;"));
command = "echo *mote2data" + fileID + " | append " + dstFile + " | null\n"; command = "echo *mote2data" + fileID + " | append " + dstFile + " | null";
log.log("mote2&gt; " + command); log.log("mote2&gt; " + command + "\n");
write(mote2, command); write(mote2, command);
YIELD_THEN_WAIT_UNTIL(id == 2 &amp;&amp; msg.contains("Contiki&gt;")); YIELD_THEN_WAIT_UNTIL(id == 2 &amp;&amp; msg.contains("Contiki&gt;"));
@ -161,44 +167,82 @@ while (fileID &lt; 20) {
srcFile = "file" + fileID + ".txt"; srcFile = "file" + fileID + ".txt";
fileID++; fileID++;
dstFile = "file" + fileID + ".txt"; dstFile = "file" + fileID + ".txt";
command = "download 2.0 " + srcFile + " | write " + dstFile + " | null\n"; command = "download 2.0 " + srcFile + " | write " + dstFile + " | null";
log.log("mote1&gt; " + command); log.log("mote1&gt; " + command + "\n");
write(mote1, command); write(mote1, command);
YIELD_THEN_WAIT_UNTIL(id == 1 &amp;&amp; msg.contains("Contiki&gt;")); YIELD_THEN_WAIT_UNTIL(id == 1 &amp;&amp; msg.contains("Contiki&gt;"));
command = "echo *mote1data" + fileID + " | append " + dstFile + " | null\n"; command = "echo *mote1data" + fileID + " | append " + dstFile + " | null";
log.log("mote1&gt; " + command); log.log("mote1&gt; " + command + "\n");
write(mote1, command); write(mote1, command);
YIELD_THEN_WAIT_UNTIL(id == 1 &amp;&amp; msg.contains("Contiki&gt;")); YIELD_THEN_WAIT_UNTIL(id == 1 &amp;&amp; msg.contains("Contiki&gt;"));
} }
/* List files, verify contents */ /* List files, verify contents */
/* XXX Beware of strange line breaks! (generated by shell's read command) */ log.log("Locating file30.txt on mote 1\n");
log.log("Locating file21.txt on mote 1\n"); write(mote1, "ls");
write(mote1, "ls\n"); YIELD_THEN_WAIT_UNTIL(id == 1 &amp;&amp; msg.contains("file30.txt"));
YIELD_THEN_WAIT_UNTIL(id == 1 &amp;&amp; msg.contains("file21.txt")); if (!msg.contains("273 ")) {
if (!msg.contains("264 ")) { log.log("Bad file size, should be 273 bytes: " + msg + "\n");
log.log("Bad file size, should be 264 bytes: " + msg + "\n");
log.testFailed(); log.testFailed();
} }
YIELD_THEN_WAIT_UNTIL(id == 1 &amp;&amp; msg.contains("Contiki&gt;")); YIELD_THEN_WAIT_UNTIL(id == 1 &amp;&amp; msg.contains("Contiki&gt;"));
log.log("Verifying file21.txt contents on mote 1\n");
write(mote1, "read file21.txt\n"); /* Wait 3 seconds (3000ms) */
YIELD_THEN_WAIT_UNTIL(msg.contains("mote1data1")); GENERATE_MSG(3000, "continue");
YIELD_THEN_WAIT_UNTIL(msg.contains("mote2data2")); YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
// ..
YIELD_THEN_WAIT_UNTIL(msg.contains("mote2data16") || msg.contains("mote2data18")); fileID = 10;
YIELD_THEN_WAIT_UNTIL(msg.contains("mote1data19") || msg.contains("mote1data21")); command = "read file30.txt 0 13";
log.log("mote1&gt; " + command + "\n");
write(mote1, command);
while (fileID &lt; 30) {
YIELD_THEN_WAIT_UNTIL(msg.contains("mote1data" + fileID));
fileID++;
log.log("&gt; " + msg + "\n");
YIELD_THEN_WAIT_UNTIL(msg.contains("mote2data" + fileID));
fileID++;
log.log("&gt; " + msg + "\n");
}
log.log("Test finished at time: " + mote.getSimulation().getSimulationTime() + "\n"); log.log("Test finished at time: " + mote.getSimulation().getSimulationTime() + "\n");
log.testOK(); /* Report test success and quit */</script> log.testOK(); /* Report test success and quit */</script>
<active>true</active> <active>true</active>
</plugin_config> </plugin_config>
<width>573</width> <width>729</width>
<z>0</z> <z>0</z>
<height>688</height> <height>811</height>
<location_x>80</location_x> <location_x>774</location_x>
<location_y>0</location_y> <location_y>1</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.TimeLine
<plugin_config>
<mote>0</mote>
<mote>1</mote>
<showRadioRXTX />
<showRadioHW />
<split>1</split>
<zoom>12</zoom>
</plugin_config>
<width>772</width>
<z>7</z>
<height>125</height>
<location_x>2</location_x>
<location_y>687</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.LogListener
<plugin_config>
<filter />
</plugin_config>
<width>1503</width>
<z>4</z>
<height>245</height>
<location_x>0</location_x>
<location_y>812</location_y>
<minimized>false</minimized> <minimized>false</minimized>
</plugin> </plugin>
</simconf> </simconf>