From da33cb5e6130eb302d9967c60d7960b9e9a42cd7 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Mon, 20 Apr 2009 13:12:52 +0000 Subject: [PATCH] added test for shell sendcmd command (sky platform) --- .../cooja/contiki_tests/sky_shell_sendcmd.csc | 144 ++++++++++++++++++ .../contiki_tests/sky_shell_sendcmd.info | 1 + .../cooja/contiki_tests/sky_shell_sendcmd.js | 44 ++++++ 3 files changed, 189 insertions(+) create mode 100644 tools/cooja/contiki_tests/sky_shell_sendcmd.csc create mode 100644 tools/cooja/contiki_tests/sky_shell_sendcmd.info create mode 100644 tools/cooja/contiki_tests/sky_shell_sendcmd.js diff --git a/tools/cooja/contiki_tests/sky_shell_sendcmd.csc b/tools/cooja/contiki_tests/sky_shell_sendcmd.csc new file mode 100644 index 000000000..8393a8770 --- /dev/null +++ b/tools/cooja/contiki_tests/sky_shell_sendcmd.csc @@ -0,0 +1,144 @@ + + + + My simulation + 0 + 1 + 123456 + 1000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + se.sics.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #sky1 + ../../../examples/sky-shell/sky-checkpoint.c + make sky-checkpoint.sky TARGET=sky + ../../../examples/sky-shell/sky-checkpoint.sky + se.sics.cooja.interfaces.Position + se.sics.cooja.mspmote.interfaces.MspIPAddress + se.sics.cooja.interfaces.Mote2MoteRelations + se.sics.cooja.mspmote.interfaces.MspClock + se.sics.cooja.mspmote.interfaces.MspMoteID + se.sics.cooja.mspmote.interfaces.SkyButton + se.sics.cooja.mspmote.interfaces.SkyFlash + se.sics.cooja.mspmote.interfaces.SkyByteRadio + se.sics.cooja.mspmote.interfaces.SkySerial + se.sics.cooja.mspmote.interfaces.SkyLED + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 85.95630230780736 + -3.1198604890271326 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspIPAddress + + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 1 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 49.907666469432186 + 13.102030707681678 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspIPAddress + + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 2 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 63.205651488651284 + 29.26179327208891 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspIPAddress + + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 3 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 30.60420340759257 + 44.54754287360952 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspIPAddress + + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 4 + + + + + se.sics.cooja.plugins.SimControl + 248 + 2 + 200 + 0 + 0 + false + + + se.sics.cooja.plugins.Visualizer + + Mote IDs + Log output: printf()'s + Radio environment (UDGM) + + 300 + 3 + 300 + 724 + 0 + false + + + se.sics.cooja.plugins.LogListener + + + 256 + + 1024 + 1 + 209 + 0 + 446 + false + + + diff --git a/tools/cooja/contiki_tests/sky_shell_sendcmd.info b/tools/cooja/contiki_tests/sky_shell_sendcmd.info new file mode 100644 index 000000000..73e08d077 --- /dev/null +++ b/tools/cooja/contiki_tests/sky_shell_sendcmd.info @@ -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% diff --git a/tools/cooja/contiki_tests/sky_shell_sendcmd.js b/tools/cooja/contiki_tests/sky_shell_sendcmd.js new file mode 100644 index 000000000..936fcff57 --- /dev/null +++ b/tools/cooja/contiki_tests/sky_shell_sendcmd.js @@ -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 */