From 520ad77046116e937ef15c585a9fa686c872e14e Mon Sep 17 00:00:00 2001 From: fros4943 Date: Wed, 4 Feb 2009 17:53:16 +0000 Subject: [PATCH] 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 --- .../cooja/contiki_tests/sky_checkpointing.csc | 83 ++++++++++++++++ .../contiki_tests/sky_checkpointing.info | 1 + .../cooja/contiki_tests/sky_checkpointing.js | 94 +++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 tools/cooja/contiki_tests/sky_checkpointing.csc create mode 100644 tools/cooja/contiki_tests/sky_checkpointing.info create mode 100644 tools/cooja/contiki_tests/sky_checkpointing.js diff --git a/tools/cooja/contiki_tests/sky_checkpointing.csc b/tools/cooja/contiki_tests/sky_checkpointing.csc new file mode 100644 index 000000000..0dd92b7d8 --- /dev/null +++ b/tools/cooja/contiki_tests/sky_checkpointing.csc @@ -0,0 +1,83 @@ + + + + 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 #1 + ../../../examples/sky-shell/sky-shell.c + make sky-shell.sky TARGET=sky + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 3.537694077190867 + 25.877706916818877 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 1 + + + + + se.sics.cooja.plugins.SimControl + 248 + 2 + 200 + 0 + 0 + false + + + se.sics.cooja.plugins.VisState + 300 + 3 + 300 + 724 + 0 + false + + + se.sics.cooja.plugins.LogListener + + + 256 + + 1024 + 4 + 209 + 0 + 446 + false + + + se.sics.cooja.plugins.MoteInterfaceViewer + 0 + + Serial port + + 424 + 1 + 502 + 579 + 27 + false + + + diff --git a/tools/cooja/contiki_tests/sky_checkpointing.info b/tools/cooja/contiki_tests/sky_checkpointing.info new file mode 100644 index 000000000..a814d4f2e --- /dev/null +++ b/tools/cooja/contiki_tests/sky_checkpointing.info @@ -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 diff --git a/tools/cooja/contiki_tests/sky_checkpointing.js b/tools/cooja/contiki_tests/sky_checkpointing.js new file mode 100644 index 000000000..b020b312d --- /dev/null +++ b/tools/cooja/contiki_tests/sky_checkpointing.js @@ -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! */