diff --git a/tools/cooja/contiki_tests/sky_shell_download.csc b/tools/cooja/contiki_tests/sky_shell_download.csc new file mode 100644 index 000000000..e4af3f5fd --- /dev/null +++ b/tools/cooja/contiki_tests/sky_shell_download.csc @@ -0,0 +1,131 @@ + + + + My simulation + 0 + 1 + generated + 1000 + + se.sics.cooja.radiomediums.UDGM + 100.0 + 100.0 + 0.95 + 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 + -16.136777727943556 + 85.85963282955879 + 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 + 11.712359274594053 + 84.42239042889724 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspIPAddress + + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 2 + + + + + se.sics.cooja.plugins.SimControl + 248 + 4 + 200 + 375 + 0 + false + + + se.sics.cooja.plugins.MoteInterfaceViewer + 0 + + Serial port + 0,0 + + 372 + 5 + 482 + 0 + 173 + false + + + se.sics.cooja.plugins.MoteInterfaceViewer + 1 + + Serial port + 0,0 + + 399 + 3 + 483 + 625 + 172 + false + + + se.sics.cooja.plugins.Visualizer + + Radio environment (UDGM) + Mote IDs + + 400 + 1 + 171 + 624 + 0 + false + + + se.sics.cooja.plugins.RadioLogger + 376 + 2 + 172 + -1 + 0 + false + + + diff --git a/tools/cooja/contiki_tests/sky_shell_download.info b/tools/cooja/contiki_tests/sky_shell_download.info new file mode 100644 index 000000000..e9e468fbf --- /dev/null +++ b/tools/cooja/contiki_tests/sky_shell_download.info @@ -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% diff --git a/tools/cooja/contiki_tests/sky_shell_download.js b/tools/cooja/contiki_tests/sky_shell_download.js new file mode 100644 index 000000000..6c62838a0 --- /dev/null +++ b/tools/cooja/contiki_tests/sky_shell_download.js @@ -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 */