From f9152668e8e1009bf7fa61e7938367b355dc2cd2 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Fri, 21 Nov 2008 12:02:29 +0000 Subject: [PATCH] Added multithreading test: Single Sky node running examples/multi-threading/multi-threading.c. Waits until both threads have counted up and down 5 times. --- tools/cooja/contiki_tests/multithreading.csc | 70 +++++++++++++++++++ tools/cooja/contiki_tests/multithreading.info | 1 + tools/cooja/contiki_tests/multithreading.js | 38 ++++++++++ 3 files changed, 109 insertions(+) create mode 100644 tools/cooja/contiki_tests/multithreading.csc create mode 100644 tools/cooja/contiki_tests/multithreading.info create mode 100644 tools/cooja/contiki_tests/multithreading.js diff --git a/tools/cooja/contiki_tests/multithreading.csc b/tools/cooja/contiki_tests/multithreading.csc new file mode 100644 index 000000000..009204ed1 --- /dev/null +++ b/tools/cooja/contiki_tests/multithreading.csc @@ -0,0 +1,70 @@ + + + + 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/multi-threading/multi-threading.c + make multi-threading.sky TARGET=sky + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 83.20518861404864 + 11.060511519885651 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 1 + + + + + se.sics.cooja.plugins.SimControl + 265 + 1 + 200 + 0 + 0 + false + + + se.sics.cooja.plugins.VisState + 300 + 3 + 300 + 638 + 0 + false + + + se.sics.cooja.plugins.LogListener + + + 256 + + 938 + 2 + 209 + 1 + 746 + false + + + diff --git a/tools/cooja/contiki_tests/multithreading.info b/tools/cooja/contiki_tests/multithreading.info new file mode 100644 index 000000000..6c193a03b --- /dev/null +++ b/tools/cooja/contiki_tests/multithreading.info @@ -0,0 +1 @@ +Single Sky node running examples/multi-threading/multi-threading.c. Waits until both threads have counted up and down 5 times. diff --git a/tools/cooja/contiki_tests/multithreading.js b/tools/cooja/contiki_tests/multithreading.js new file mode 100644 index 000000000..bee4402fd --- /dev/null +++ b/tools/cooja/contiki_tests/multithreading.js @@ -0,0 +1,38 @@ +lowAlpha = "BA\n"; +highAlpha = "JIHGFEDCBA\n"; +lowCount = "10\n"; +highCount = "9876543210\n"; + +/* Filter messages */ +if (msg.equals(lowCount)) { + log.log("Count is low\n"); +} else if (msg.equals(lowAlpha)) { + log.log("Alpha is low\n"); +} else if (msg.equals(highCount)) { + log.log("Count is high\n"); +} else if (msg.equals(highAlpha)) { + log.log("Alpha is high\n"); +} else { + /* Ignore all other messages */ + return; +} + +/* Remember messages */ +count = global.get(msg); +if (count == null) { + count = 0; +} +count++; +global.put(msg, count); + +/* Wait during test */ +count = global.get(lowAlpha); +if (count == null || count < 5) return; +count = global.get(highAlpha); +if (count == null || count < 5) return; +count = global.get(lowCount); +if (count == null || count < 5) return; +count = global.get(highCount); +if (count == null || count < 5) return; + +log.testOK(); /* We are done! */