new test for shell command 'exec' and the Contiki elfloader:
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
This commit is contained in:
parent
04bd414e1c
commit
a034df48cf
112
tools/cooja/contiki_tests/sky_shell_exec_serial.csc
Normal file
112
tools/cooja/contiki_tests/sky_shell_exec_serial.csc
Normal file
|
@ -0,0 +1,112 @@
|
|||
<?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-exec/sky-shell-exec.c</source>
|
||||
<commands>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</commands>
|
||||
<firmware>../../../examples/sky-shell-exec/sky-shell-exec.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>56.18151486126417</x>
|
||||
<y>93.20004013966208</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
se.sics.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>1</id>
|
||||
</interface_config>
|
||||
</mote>
|
||||
</simulation>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.SimControl
|
||||
<width>248</width>
|
||||
<z>5</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>printf()'s + LEDs</skin>
|
||||
</plugin_config>
|
||||
<width>300</width>
|
||||
<z>4</z>
|
||||
<height>300</height>
|
||||
<location_x>1020</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>1347</width>
|
||||
<z>1</z>
|
||||
<height>675</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>337</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>845</width>
|
||||
<z>2</z>
|
||||
<height>551</height>
|
||||
<location_x>11</location_x>
|
||||
<location_y>249</location_y>
|
||||
<minimized>false</minimized>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.mspmote.plugins.MspStackWatcher
|
||||
<mote_arg>0</mote_arg>
|
||||
<width>613</width>
|
||||
<z>3</z>
|
||||
<height>300</height>
|
||||
<location_x>247</location_x>
|
||||
<location_y>12</location_y>
|
||||
<minimized>false</minimized>
|
||||
</plugin>
|
||||
</simconf>
|
||||
|
1
tools/cooja/contiki_tests/sky_shell_exec_serial.info
Normal file
1
tools/cooja/contiki_tests/sky_shell_exec_serial.info
Normal file
|
@ -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
|
49
tools/cooja/contiki_tests/sky_shell_exec_serial.js
Normal file
49
tools/cooja/contiki_tests/sky_shell_exec_serial.js
Normal file
|
@ -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();
|
Loading…
Reference in a new issue