added test for shell sendcmd command (sky platform)

This commit is contained in:
fros4943 2009-04-20 13:12:52 +00:00
parent 71c3c8e86c
commit da33cb5e61
3 changed files with 189 additions and 0 deletions

View file

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<simulation>
<title>My simulation</title>
<delaytime>0</delaytime>
<ticktime>1</ticktime>
<randomseed>123456</randomseed>
<motedelay>1000</motedelay>
<radiomedium>
se.sics.cooja.radiomediums.UDGM
<transmitting_range>50.0</transmitting_range>
<interference_range>100.0</interference_range>
<success_ratio_tx>1.0</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>85.95630230780736</x>
<y>-3.1198604890271326</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>49.907666469432186</x>
<y>13.102030707681678</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>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<interface_config>
se.sics.cooja.interfaces.Position
<x>63.205651488651284</x>
<y>29.26179327208891</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>3</id>
</interface_config>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<interface_config>
se.sics.cooja.interfaces.Position
<x>30.60420340759257</x>
<y>44.54754287360952</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>4</id>
</interface_config>
</mote>
</simulation>
<plugin>
se.sics.cooja.plugins.SimControl
<width>248</width>
<z>2</z>
<height>200</height>
<location_x>0</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.Visualizer
<plugin_config>
<skin>Mote IDs</skin>
<skin>Log output: printf()'s</skin>
<skin>Radio environment (UDGM)</skin>
</plugin_config>
<width>300</width>
<z>3</z>
<height>300</height>
<location_x>724</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.LogListener
<plugin_config>
<filter />
<history>256</history>
</plugin_config>
<width>1024</width>
<z>1</z>
<height>209</height>
<location_x>0</location_x>
<location_y>446</location_y>
<minimized>false</minimized>
</plugin>
</simconf>

View file

@ -0,0 +1 @@
Tests shell command 'sendcmd' (source examples/sky-shell/sky-checkpoint.c): A single node sends echo commands to three other nodes. X-MAC + UDGM radio medium 100%

View file

@ -0,0 +1,44 @@
TIMEOUT(150000);
log.log("Random seed: " + mote.getSimulation().getRandomSeed() + "\n");
/* Wait for nodes to boot */
mote1 = null;
while (mote1 == null) {
if (id == 1) {
mote1 = mote;
}
YIELD();
}
GENERATE_MSG(2000, "continue");
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
/* Send command: mote 1 -> mote 2*/
command = "sendcmd 2.0 echo hello\n";
log.log("mote1> " + command);
write(mote1, command);
YIELD_THEN_WAIT_UNTIL(id == 2 && msg.contains("hello"));
log.log("mote2: " + msg + "\n");
GENERATE_MSG(1000, "continue");
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
/* Send command: mote 1 -> mote 2*/
command = "sendcmd 2.0 {echo hello again}\n";
log.log("mote1> " + command);
write(mote1, command);
YIELD_THEN_WAIT_UNTIL(id == 2 && msg.contains("hello again"));
log.log("mote2: " + msg + "\n");
GENERATE_MSG(1000, "continue");
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
/* Send command: mote 1 -> mote 2 -> mote 3 -> mote 4 */
command = "sendcmd 2.0 {sendcmd 3.0 {sendcmd 4.0 echo multihop}}\n";
log.log("mote1> " + command);
write(mote1, command);
YIELD_THEN_WAIT_UNTIL(id == 4 && msg.contains("multihop"));
log.log("mote4: " + msg + "\n");
GENERATE_MSG(1000, "continue");
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
log.log("Test finished at time: " + mote.getSimulation().getSimulationTime() + "\n");
log.testOK(); /* Report test success and quit */