diff --git a/test/bytecode/SingleClassTester.java b/test/bytecode/SingleClassTester.java index d769fe98..bbee95d6 100644 --- a/test/bytecode/SingleClassTester.java +++ b/test/bytecode/SingleClassTester.java @@ -3,17 +3,21 @@ package bytecode; import java.io.File; import java.io.IOException; +import com.google.common.io.Files; + import junit.framework.TestCase; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.logger.Logger; import de.dhbwstuttgart.logger.LoggerConfiguration; import de.dhbwstuttgart.logger.Section; +import de.dhbwstuttgart.logger.Timewatch; import de.dhbwstuttgart.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.ByteCodeResult; import de.dhbwstuttgart.typeinference.Menge; public class SingleClassTester { - + public static void compileToBytecode(String inputFile, String outputFile){ LoggerConfiguration logConfig = new LoggerConfiguration().setOutput(Section.PARSER, System.out); MyCompilerAPI compiler = MyCompiler.getAPI(logConfig); @@ -25,7 +29,19 @@ public class SingleClassTester { } catch (IOException | yyException e) { e.printStackTrace(); TestCase.fail(); + }finally{ + writeLog(outputFile+".log"); } } + private static void writeLog(String toFile){ + String log = Logger.getWholeLog()+"\n"; + log+=Timewatch.getTimewatch().dumpTimeData(); + try { + Files.write(log.getBytes(),new File(toFile)); + } catch (IOException e) { + e.printStackTrace(); + TestCase.fail(); + } + } }