nes-proj/tools/cooja/contiki_tests/ip_sky_webserver_wget.js

47 lines
1.1 KiB
JavaScript
Raw Normal View History

2009-01-15 13:56:16 +00:00
TIMEOUT(90000, log.log("last message: " + msg + "\n"));
2009-01-15 13:20:18 +00:00
mote1 = null;
mote4 = null;
nr_boot = 0;
2009-01-15 13:20:18 +00:00
/* Wait until all nodes have booted */
2009-01-15 13:20:18 +00:00
while (true) {
if (msg.contains('Starting')) {
nr_boot++;
2009-01-15 13:20:18 +00:00
if (id == 1) mote1 = mote;
if (id == 4) mote4 = mote;
}
if (nr_boot == 4) break;
2009-01-15 13:20:18 +00:00
YIELD();
}
log.log("All motes booted\n");
2009-01-15 13:20:18 +00:00
/* Wait one second */
GENERATE_MSG(1000, "continue");
WAIT_UNTIL(msg.equals("continue"));
/* Create file on node 1 */
log.log("Node 1 creating data\n");
write(mote1, "echo FROM1 | write node1file.txt\n");
2009-01-15 13:20:18 +00:00
/* Download node1file.txt to node 4 */
log.log("Node 4 downloading from node 1\n");
write(mote4, "wget 172.16.1.0/node1file.txt | write node4file.txt\n");
WAIT_UNTIL(id == 4 && msg.contains("FROM1"));
2009-01-15 13:20:18 +00:00
/* Wait one second */
GENERATE_MSG(1000, "continue");
WAIT_UNTIL(msg.equals("continue"));
/* Extend data */
log.log("Node 4 appending data\n");
write(mote4, "echo FROM4 | append node4file.txt\n");
/* Download node2file.txt at node 1 */
log.log("Node 1 downloading from node 4\n");
write(mote1, "wget 172.16.4.0/node4file.txt\n");
WAIT_UNTIL(id == 1 && msg.contains("FROM4"));
2009-01-15 13:20:18 +00:00
log.testOK();