contiki/tools/cooja/contiki_tests/multithreading.js
fros4943 f9152668e8 Added multithreading test:
Single Sky node running examples/multi-threading/multi-threading.c. Waits until both threads have counted up and down 5 times.
2008-11-21 12:02:29 +00:00

39 lines
884 B
JavaScript

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! */