diff --git a/tools/cooja/contiki_tests/sky_shell_exec_serial.csc b/tools/cooja/contiki_tests/sky_shell_exec_serial.csc new file mode 100644 index 000000000..5026192d8 --- /dev/null +++ b/tools/cooja/contiki_tests/sky_shell_exec_serial.csc @@ -0,0 +1,112 @@ + + + + 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-exec/sky-shell-exec.c + make hello-world.ce TARGET=sky + +make sky-shell-exec.sky TARGET=sky +make sky-shell-exec.sky CORE=sky-shell-exec.sky TARGET=sky +make sky-shell-exec.sky CORE=sky-shell-exec.sky TARGET=sky + ../../../examples/sky-shell-exec/sky-shell-exec.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 + 56.18151486126417 + 93.20004013966208 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 1 + + + + + se.sics.cooja.plugins.SimControl + 248 + 5 + 200 + 0 + 0 + false + + + se.sics.cooja.plugins.Visualizer + + printf()'s + LEDs + + 300 + 4 + 300 + 1020 + 0 + false + + + se.sics.cooja.plugins.LogListener + + + 256 + + 1347 + 1 + 675 + 0 + 337 + false + + + se.sics.cooja.plugins.MoteInterfaceViewer + 0 + + Serial port + 0,0 + + 845 + 2 + 551 + 11 + 249 + false + + + se.sics.cooja.mspmote.plugins.MspStackWatcher + 0 + 613 + 3 + 300 + 247 + 12 + false + + + diff --git a/tools/cooja/contiki_tests/sky_shell_exec_serial.info b/tools/cooja/contiki_tests/sky_shell_exec_serial.info new file mode 100644 index 000000000..68a00c836 --- /dev/null +++ b/tools/cooja/contiki_tests/sky_shell_exec_serial.info @@ -0,0 +1 @@ +Tests Contiki ELF loader and shell command 'exec': Hello-world is compiled as a Contiki executable (.ce) and is uploaded to the single Sky node via serial port (base64 encoded). The node then loads and starts the uploaded hello-world application. Test succeeds when the 'Hello, World' output appears diff --git a/tools/cooja/contiki_tests/sky_shell_exec_serial.js b/tools/cooja/contiki_tests/sky_shell_exec_serial.js new file mode 100644 index 000000000..5ed545c28 --- /dev/null +++ b/tools/cooja/contiki_tests/sky_shell_exec_serial.js @@ -0,0 +1,49 @@ +TIMEOUT(50000, log.log("last msg: " + msg + "\n")); /* print last msg at timeout */ + +helloworld = new java.io.File("../../../examples/sky-shell-exec/hello-world.ce"); +log.log("Running test on: " + helloworld.getAbsolutePath() + "\n"); +if (!helloworld.exists()) { + log.log("hello-world.ce does not exist\n"); + log.testFailed(); +} + +log.log("Waiting for node startup\n"); +WAIT_UNTIL(msg.contains('1.0: Contiki>')); + +log.log("Preparing node for incoming data\n"); +node.write("dec64 | write hello-world.ce | null"); +GENERATE_MSG(1000, "continue"); +YIELD_THEN_WAIT_UNTIL(msg.equals("continue")); + +log.log("Uploading hello-world.ce:\n"); +process = new java.lang.Runtime.getRuntime().exec("sh -c \"../../tools/base64-encode < hello-world.ce\"", null, helloworld.getParentFile()); +stdIn = new java.io.BufferedReader(new java.io.InputStreamReader(process.getInputStream())); +while ((line = stdIn.readLine()) != null) { + node.write(line + "\n"); + log.log(line + "\n"); + + GENERATE_MSG(1000, "continue"); + YIELD_THEN_WAIT_UNTIL(msg.equals("continue")); +} +process.destroy(); +GENERATE_MSG(500, "continue"); +YIELD_THEN_WAIT_UNTIL(msg.equals("continue")); +node.write("~K\n"); + +log.log("Listing filesystem to make sure hello-world.ce exists\n"); +GENERATE_MSG(500, "continue"); +YIELD_THEN_WAIT_UNTIL(msg.equals("continue")); +node.write("ls\n"); +WAIT_UNTIL(msg.contains("hello-world.ce")); + +log.log("Starting hello world\n"); +GENERATE_MSG(500, "continue"); +YIELD_THEN_WAIT_UNTIL(msg.equals("continue")); +node.write("exec hello-world.ce\n"); +WAIT_UNTIL(msg.contains("OK")); +log.log("> ELF loader returned OK\n"); +WAIT_UNTIL(msg.contains("Hello, world")); +log.log("> Hello world process started\n"); + +log.log("Finished!\n"); +log.testOK();