package Sequenic.T2ext; import Sequenic.T2.TrFile; import Sequenic.T2.Msg.T2Exception; import Sequenic.T2ext.Analyzer.T2TraceFileCoverageAnalyzer; import Sequenic.T2ext.Analyzer.T2TraceFileCoverageResult; import Sequenic.T2ext.Selection.SelectiveRunner; public class UpdateTrFile { /** * @param args * @throws T2Exception */ public static void main(String[] args) throws T2Exception { if(args.length!=3 && args.length!=2) throw new Error("Must pass 2 or 3 arguments: trFileName, newTrFileName and optionally cfgsFileName"); //doFor(args[0],args[1],args[2]); TrFile trFile = TrFile.load(args[0]); int total = new SelectiveRunner(trFile).runAll(); trFile.save(args[1]); System.out.println("Updated "+total+" traces in "+args[0]+" with coverage, saved to: "+args[1]+""); } private static void doFor(String trFileName, String newTrFileName, String cfgsFile) { try { System.out.print("Update Tr File: Start, loading '"+trFileName+"'..."); TrFile trFile = TrFile.load(trFileName); System.out.print("replaying and analyzing with CFG file '"+cfgsFile+"'..."); T2TraceFileCoverageAnalyzer analz = new T2TraceFileCoverageAnalyzer(trFile,cfgsFile); T2TraceFileCoverageResult rez = analz.calculateCoverage(); System.out.print("updating with coverage..."); rez.updateTracesWithCoverage(); System.out.print("saving to '"+newTrFileName+"'..."); trFile.save(newTrFileName); System.out.println("Done!"); } catch (T2Exception e) { e.printStackTrace(); } } }