added test for shell download command (sky platform)

This commit is contained in:
fros4943 2009-04-20 13:04:20 +00:00
parent 2d049bf5dc
commit f4755f649f
3 changed files with 208 additions and 0 deletions

View File

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<simulation>
<title>My simulation</title>
<delaytime>0</delaytime>
<ticktime>1</ticktime>
<randomseed>generated</randomseed>
<motedelay>1000</motedelay>
<radiomedium>
se.sics.cooja.radiomediums.UDGM
<transmitting_range>100.0</transmitting_range>
<interference_range>100.0</interference_range>
<success_ratio_tx>0.95</success_ratio_tx>
<success_ratio_rx>1.0</success_ratio_rx>
</radiomedium>
<motetype>
se.sics.cooja.mspmote.SkyMoteType
<identifier>sky1</identifier>
<description>Sky Mote Type #sky1</description>
<source>../../../examples/sky-shell/sky-checkpoint.c</source>
<commands>make sky-checkpoint.sky TARGET=sky</commands>
<firmware>../../../examples/sky-shell/sky-checkpoint.sky</firmware>
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.MspIPAddress</moteinterface>
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.MspClock</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.MspMoteID</moteinterface>
<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.SkyLED</moteinterface>
</motetype>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<interface_config>
se.sics.cooja.interfaces.Position
<x>-16.136777727943556</x>
<y>85.85963282955879</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspIPAddress
<ip />
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>1</id>
</interface_config>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<interface_config>
se.sics.cooja.interfaces.Position
<x>11.712359274594053</x>
<y>84.42239042889724</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspIPAddress
<ip />
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>2</id>
</interface_config>
</mote>
</simulation>
<plugin>
se.sics.cooja.plugins.SimControl
<width>248</width>
<z>4</z>
<height>200</height>
<location_x>375</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.MoteInterfaceViewer
<mote_arg>0</mote_arg>
<plugin_config>
<interface>Serial port</interface>
<scrollpos>0,0</scrollpos>
</plugin_config>
<width>372</width>
<z>5</z>
<height>482</height>
<location_x>0</location_x>
<location_y>173</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.MoteInterfaceViewer
<mote_arg>1</mote_arg>
<plugin_config>
<interface>Serial port</interface>
<scrollpos>0,0</scrollpos>
</plugin_config>
<width>399</width>
<z>3</z>
<height>483</height>
<location_x>625</location_x>
<location_y>172</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.Visualizer
<plugin_config>
<skin>Radio environment (UDGM)</skin>
<skin>Mote IDs</skin>
</plugin_config>
<width>400</width>
<z>1</z>
<height>171</height>
<location_x>624</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.RadioLogger
<width>376</width>
<z>2</z>
<height>172</height>
<location_x>-1</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
</simconf>

View File

@ -0,0 +1 @@
Tests shell command 'download' (source examples/sky-shell/sky-checkpoint.c): Two nodes generates, appends to, and downloads files from each other. X-MAC + UDGM radio medium 95%

View File

@ -0,0 +1,76 @@
TIMEOUT(150000); /* print last msg at timeout */
log.log("Random seed: " + mote.getSimulation().getRandomSeed() + "\n");
/* Wait for nodes to boot */
mote1 = null;
mote2 = null;
while (mote1 == null || mote2 == null) {
if (id == 1) {
mote1 = mote;
}
if (id == 2) {
mote2 = mote;
}
YIELD();
}
GENERATE_MSG(2000, "continue");
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
/* Generate initial file */
fileID = 1;
command = "echo *mote1data" + fileID + " | write file" + fileID + ".txt\n";
log.log("mote1> " + command);
write(mote1, command);
YIELD_THEN_WAIT_UNTIL(id == 1 && msg.contains("Contiki>"));
/* Download and append files */
while (fileID < 20) {
/* Mote 1 -> Mote 2 */
srcFile = "file" + fileID + ".txt";
fileID++;
dstFile = "file" + fileID + ".txt";
command = "download 1.0 " + srcFile + " | write " + dstFile + " | null\n";
log.log("mote2> " + command);
write(mote2, command);
YIELD_THEN_WAIT_UNTIL(id == 2 && msg.contains("Contiki>"));
command = "echo *mote2data" + fileID + " | append " + dstFile + " | null\n";
log.log("mote2> " + command);
write(mote2, command);
YIELD_THEN_WAIT_UNTIL(id == 2 && msg.contains("Contiki>"));
/* Mote 2 -> Mote 1 */
srcFile = "file" + fileID + ".txt";
fileID++;
dstFile = "file" + fileID + ".txt";
command = "download 2.0 " + srcFile + " | write " + dstFile + " | null\n";
log.log("mote1> " + command);
write(mote1, command);
YIELD_THEN_WAIT_UNTIL(id == 1 && msg.contains("Contiki>"));
command = "echo *mote1data" + fileID + " | append " + dstFile + " | null\n";
log.log("mote1> " + command);
write(mote1, command);
YIELD_THEN_WAIT_UNTIL(id == 1 && msg.contains("Contiki>"));
}
/* List files, verify contents */
/* XXX Beware of strange line breaks! (generated by shell's read command) */
log.log("Locating file21.txt on mote 1\n");
write(mote1, "ls\n");
YIELD_THEN_WAIT_UNTIL(id == 1 && msg.contains("file21.txt"));
if (!msg.contains("264 ")) {
log.log("Bad file size, should be 264 bytes: " + msg + "\n");
log.testFailed();
}
YIELD_THEN_WAIT_UNTIL(id == 1 && msg.contains("Contiki>"));
log.log("Verifying file21.txt contents on mote 1\n");
write(mote1, "read file21.txt\n");
YIELD_THEN_WAIT_UNTIL(msg.contains("mote1data1"));
YIELD_THEN_WAIT_UNTIL(msg.contains("mote2data2"));
// ..
YIELD_THEN_WAIT_UNTIL(msg.contains("mote2data16") || msg.contains("mote2data18"));
YIELD_THEN_WAIT_UNTIL(msg.contains("mote1data19") || msg.contains("mote1data21"));
log.log("Test finished at time: " + mote.getSimulation().getSimulationTime() + "\n");
log.testOK(); /* Report test success and quit */