updated threaded contiki test scripts

This commit is contained in:
fros4943 2009-01-08 16:41:48 +00:00
parent 94f0d8ca02
commit b2a1dd2156
2 changed files with 14 additions and 19 deletions

View file

@ -1,5 +1,4 @@
if (msg.startsWith('Hello, world')) { TIMEOUT(2000, log.log("last message: " + msg + "\n"));
WAIT_UNTIL(msg.equals('Hello, world'));
log.testOK(); log.testOK();
} else {
log.testFailed();
}

View file

@ -1,7 +1,7 @@
if (!msg.contains('Sky telnet process')) { TIMEOUT(120000);
return;
}
/* conf */
nrReplies = 0;
ipAddress = "172.16.1.0"; ipAddress = "172.16.1.0";
osName = java.lang.System.getProperty("os.name").toLowerCase(); osName = java.lang.System.getProperty("os.name").toLowerCase();
if (osName.startsWith("win")) { if (osName.startsWith("win")) {
@ -11,14 +11,10 @@ if (osName.startsWith("win")) {
} }
replyMsg = "from " + ipAddress; replyMsg = "from " + ipAddress;
ok = global.get('started_ping'); /* mote startup */
if (ok == true) { WAIT_UNTIL(msg.contains('Sky telnet process'));
//log.log("ping already started\n");
return;
}
global.put('started_ping', true);
global.put('replies', "");
/* start ping process */
var runnableObj = new Object(); var runnableObj = new Object();
runnableObj.run = function() { runnableObj.run = function() {
pingProcess = new java.lang.Runtime.getRuntime().exec(pingCmd); pingProcess = new java.lang.Runtime.getRuntime().exec(pingCmd);
@ -28,16 +24,16 @@ runnableObj.run = function() {
while ((line = stdIn.readLine()) != null) { while ((line = stdIn.readLine()) != null) {
log.log("> " + line + "\n"); log.log("> " + line + "\n");
if (line.contains(replyMsg)) { if (line.contains(replyMsg)) {
global.put('replies', global.get('replies') + "1"); nrReplies++;
//log.log("reply #" + global.get('replies').length() + "\n"); //log.log("reply #" + nrReplies + "\n");
} }
} }
pingProcess.destroy(); pingProcess.destroy();
if (global.get('replies').length() > 5) { if (nrReplies > 5) {
log.testOK(); /* Report test success and quit */ log.testOK(); /* Report test success and quit */
} else { } else {
log.log("Only " + global.get('replies').length() + "/10 ping replies was received\n"); log.log("Only " + nrReplies + "/10 ping replies was received\n");
log.testFailed(); log.testFailed();
} }
} }