mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
added writeFile method to be used from scripts
This commit is contained in:
parent
7c20758662
commit
d84cf2acb5
@ -47,10 +47,10 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.GUI;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.Simulation;
|
|
||||||
import se.sics.cooja.TimeEvent;
|
|
||||||
import se.sics.cooja.SimEventCentral.LogOutputEvent;
|
import se.sics.cooja.SimEventCentral.LogOutputEvent;
|
||||||
import se.sics.cooja.SimEventCentral.LogOutputListener;
|
import se.sics.cooja.SimEventCentral.LogOutputListener;
|
||||||
|
import se.sics.cooja.Simulation;
|
||||||
|
import se.sics.cooja.TimeEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads and executes a Contiki test script.
|
* Loads and executes a Contiki test script.
|
||||||
@ -386,6 +386,16 @@ public class LogScriptEngine {
|
|||||||
semaphoreSim.release(100);
|
semaphoreSim.release(100);
|
||||||
throw new RuntimeException("test script killed");
|
throw new RuntimeException("test script killed");
|
||||||
}
|
}
|
||||||
|
public void writeFile(String filename, String msg) {
|
||||||
|
try{
|
||||||
|
FileWriter fstream = new FileWriter(filename, false);
|
||||||
|
BufferedWriter out = new BufferedWriter(fstream);
|
||||||
|
out.write(msg);
|
||||||
|
out.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn("Write file failed: " + filename + ": " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
public void testFailed() {
|
public void testFailed() {
|
||||||
log("TEST FAILED\n");
|
log("TEST FAILED\n");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user