mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
sky checkpointing test:
Tests node local checkpointing on the Sky platform. A single node checkpoints and rollbacks with a repeating echo background process. Running examples/sky-shell/sky-shell.c
This commit is contained in:
parent
c16921f108
commit
520ad77046
83
tools/cooja/contiki_tests/sky_checkpointing.csc
Normal file
83
tools/cooja/contiki_tests/sky_checkpointing.csc
Normal file
@ -0,0 +1,83 @@
|
||||
<?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 #1</description>
|
||||
<source>../../../examples/sky-shell/sky-shell.c</source>
|
||||
<command>make sky-shell.sky TARGET=sky</command>
|
||||
</motetype>
|
||||
<mote>
|
||||
se.sics.cooja.mspmote.SkyMote
|
||||
<motetype_identifier>sky1</motetype_identifier>
|
||||
<interface_config>
|
||||
se.sics.cooja.interfaces.Position
|
||||
<x>3.537694077190867</x>
|
||||
<y>25.877706916818877</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>2</z>
|
||||
<height>200</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>0</location_y>
|
||||
<minimized>false</minimized>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.VisState
|
||||
<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>4</z>
|
||||
<height>209</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>446</location_y>
|
||||
<minimized>false</minimized>
|
||||
</plugin>
|
||||
<plugin>
|
||||
se.sics.cooja.plugins.MoteInterfaceViewer
|
||||
<mote_arg>0</mote_arg>
|
||||
<plugin_config>
|
||||
<interface>Serial port</interface>
|
||||
</plugin_config>
|
||||
<width>424</width>
|
||||
<z>1</z>
|
||||
<height>502</height>
|
||||
<location_x>579</location_x>
|
||||
<location_y>27</location_y>
|
||||
<minimized>false</minimized>
|
||||
</plugin>
|
||||
</simconf>
|
||||
|
1
tools/cooja/contiki_tests/sky_checkpointing.info
Normal file
1
tools/cooja/contiki_tests/sky_checkpointing.info
Normal file
@ -0,0 +1 @@
|
||||
Tests node local checkpointing on the Sky platform. A single node checkpoints and rollbacks with a repeating echo background process. Running examples/sky-shell/sky-shell.c
|
94
tools/cooja/contiki_tests/sky_checkpointing.js
Normal file
94
tools/cooja/contiki_tests/sky_checkpointing.js
Normal file
@ -0,0 +1,94 @@
|
||||
TIMEOUT(120000, log.log("timeout at phase " + phase + ". last message: " + msg + "\n"));
|
||||
phase=0;
|
||||
|
||||
/* Wait until node has booted */
|
||||
WAIT_UNTIL(msg.startsWith('Starting'));
|
||||
log.log("Shell started\n");
|
||||
phase++;
|
||||
|
||||
/* 1. BACKGROUND PROCESS - NO CHECKPOINTING */
|
||||
node.write("repeat 10 1 echo bg process &");
|
||||
log.log("Starting background process without checkpointing\n");
|
||||
expected=10;
|
||||
while (expected > 0) {
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('bg process'));
|
||||
expected--;
|
||||
}
|
||||
|
||||
/* Make sure background process has exited */
|
||||
GENERATE_MSG(3000, "continue");
|
||||
while (!msg.contains('continue')) {
|
||||
YIELD();
|
||||
if (msg.contains('bg process')) {
|
||||
log.log("Too many bg messages at phase: " + phase + "\n");
|
||||
log.testFailed(); /* We are done! */
|
||||
while (true) YIELD();
|
||||
}
|
||||
}
|
||||
log.log("Background process without checkpointing done\n\n");
|
||||
phase++;
|
||||
|
||||
/* 2. BACKGROUND PROCESS - CHECKPOINTING EVERY SECOND */
|
||||
node.write("repeat 10 1 echo bg process &");
|
||||
log.log("Starting background process with periodic checkpointing\n");
|
||||
expected=10;
|
||||
while (expected > 0) {
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('bg process'));
|
||||
expected--;
|
||||
node.write("checkpoint file" + expected);
|
||||
}
|
||||
|
||||
/* Make sure background process has exited */
|
||||
GENERATE_MSG(3000, "continue");
|
||||
while (!msg.contains('continue')) {
|
||||
YIELD();
|
||||
if (msg.contains('bg process')) {
|
||||
log.log("Too many bg messages at phase: " + phase + "\n");
|
||||
log.testFailed(); /* We are done! */
|
||||
while (true) YIELD();
|
||||
}
|
||||
}
|
||||
log.log("Background process with periodic checkpointing done\n\n");
|
||||
phase++;
|
||||
|
||||
/* 3. LIST ALL FILES */
|
||||
node.write("ls");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('file9'));
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('file8'));
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('file7'));
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('file6'));
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('file5'));
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('file4'));
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('file3'));
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('file2'));
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('file1'));
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('file0'));
|
||||
GENERATE_MSG(1000, "continue");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('continue'));
|
||||
log.log("All checkpoints are stored in the filesystem\n\n");
|
||||
phase++;
|
||||
|
||||
/* 4. ROLLBACK TO RESTORE BACKGROUND PROCESS */
|
||||
node.write("rollback file7");
|
||||
log.log("Rollingt back background process at count 7\n");
|
||||
expected=7;
|
||||
while (expected > 0) {
|
||||
YIELD_THEN_WAIT_UNTIL(msg.contains('bg process'));
|
||||
expected--;
|
||||
}
|
||||
|
||||
/* Make sure background process has exited */
|
||||
GENERATE_MSG(3000, "continue");
|
||||
while (!msg.contains('continue')) {
|
||||
YIELD();
|
||||
if (msg.contains('bg process')) {
|
||||
log.log("Too many bg messages at phase: " + phase + "\n");
|
||||
log.testFailed(); /* We are done! */
|
||||
while (true) YIELD();
|
||||
}
|
||||
}
|
||||
log.log("Background process was rolled back successfully\n\n");
|
||||
phase++;
|
||||
|
||||
|
||||
log.testOK(); /* We are done! */
|
Loading…
Reference in New Issue
Block a user