print random seed and end time to all test logs

This commit is contained in:
fros4943 2009-06-24 14:08:14 +00:00
parent 25893c463e
commit e6fa5334ae

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: ScriptRunner.java,v 1.21 2009/06/15 16:53:32 fros4943 Exp $ * $Id: ScriptRunner.java,v 1.22 2009/06/24 14:08:14 fros4943 Exp $
*/ */
package se.sics.cooja.plugins; package se.sics.cooja.plugins;
@ -39,7 +39,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
@ -276,6 +275,8 @@ public class ScriptRunner extends VisPlugin {
logFile.delete(); logFile.delete();
} }
logWriter = new BufferedWriter(new FileWriter(logFile)); logWriter = new BufferedWriter(new FileWriter(logFile));
logWriter.write("Random seed: " + simulation.getRandomSeed() + "\n");
logWriter.flush();
} }
engine.setScriptLogObserver(new Observer() { engine.setScriptLogObserver(new Observer() {
public void update(Observable obs, Object obj) { public void update(Observable obs, Object obj) {
@ -333,6 +334,10 @@ public class ScriptRunner extends VisPlugin {
if (logWriter != null) { if (logWriter != null) {
try { try {
logWriter.write(
"Test ended at simulation time: " +
(simulation!=null?simulation.getSimulationTime():"?") + "\n");
logWriter.flush();
logWriter.close(); logWriter.close();
} catch (IOException e) { } catch (IOException e) {
} }