protected override void AfterRun(IPexPathComponent host, object data) { Term[] pathConditions = new Term[] {}; IList <Term> conditions = null; IList <CodeLocation> locations = null; SafeSet <Method> trackingMethods = null; var database = host.GetService <IssueTrackDatabase>(); var unInstrumentedMethods = database.UnInstrumentedMethods; log = database.SimpleLog; foreach (var unInstrumentedMethod in unInstrumentedMethods) { var controller = new ResultTracer(host, unInstrumentedMethod.Method, log); log.AppendLine("try tracking " + unInstrumentedMethod.Method.FullName); log.AppendLine("*****************************************************"); using (IEngine trackingEngine = host.PathServices.TrackingEngineFactory.CreateTrackingEngine(controller)) { trackingEngine.GetService <IPexTrackingDriver>().Run(); pathConditions = Enumerable.ToArray(controller.PathConditions); conditions = controller.Conditions; locations = controller.Locations; trackingMethods = controller.TrackingMethods; } PexLog(host, "ResultTracing", prettyPrintPathCondition(host, pathConditions)); // log.AppendLine("condition: " + prettyPrintPathCondition(host, pathConditions)); PexLog(host, "tracking methods", trackingMethods.Select(x => x.FullName)); for (int i = 0; i < conditions.Count; i++) { var condition = conditions[i]; using (var extractor = new ResultTrackConditionExtractor(host.ExplorationServices.TermManager)) { extractor.VisitTerm(default(TVoid), condition); if (extractor.Method == null) { host.Log.Dump("method", "not in branch", "null"); continue; } PexLog(host, "method", extractor.Method.FullName); PexLog(host, "offset", extractor.CallerOffset.ToString("x")); PexLog(host, "location", extractor.Location.ToString()); var method = extractor.Signature as Method; PexLog(host, "signature", method.FullName); log.AppendLine("found method: " + method.FullName + " in branch " + locations[i]); if (!host.GetService <IssueTrackDatabase>().UninstrumentedMethodInBranch.ContainsKey(locations[i])) { host.GetService <IssueTrackDatabase>().UninstrumentedMethodInBranch.Add(locations[i], method); } } } PexLog(host, "location", locations.Select(x => x.ToString())); log.AppendLine("*****************************************************"); } log.AppendLine("========================="); }
protected override void AfterRun(IPexPathComponent host, object data) { Term[] pathConditions = new Term[] {}; IList<Term> conditions = null; IList<CodeLocation> locations = null; SafeSet<Method> trackingMethods = null; var database = host.GetService<IssueTrackDatabase>(); var unInstrumentedMethods = database.UnInstrumentedMethods; log = database.SimpleLog; foreach (var unInstrumentedMethod in unInstrumentedMethods) { var controller = new ResultTracer(host, unInstrumentedMethod.Method,log); log.AppendLine("try tracking " + unInstrumentedMethod.Method.FullName); log.AppendLine("*****************************************************"); using (IEngine trackingEngine = host.PathServices.TrackingEngineFactory.CreateTrackingEngine(controller)) { trackingEngine.GetService<IPexTrackingDriver>().Run(); pathConditions = Enumerable.ToArray(controller.PathConditions); conditions = controller.Conditions; locations = controller.Locations; trackingMethods = controller.TrackingMethods; } PexLog(host, "ResultTracing", prettyPrintPathCondition(host, pathConditions)); // log.AppendLine("condition: " + prettyPrintPathCondition(host, pathConditions)); PexLog(host, "tracking methods", trackingMethods.Select(x => x.FullName)); for (int i = 0; i < conditions.Count; i++) { var condition = conditions[i]; using (var extractor = new ResultTrackConditionExtractor(host.ExplorationServices.TermManager)) { extractor.VisitTerm(default(TVoid), condition); if (extractor.Method == null) { host.Log.Dump("method", "not in branch", "null"); continue; } PexLog(host, "method", extractor.Method.FullName); PexLog(host, "offset", extractor.CallerOffset.ToString("x")); PexLog(host, "location", extractor.Location.ToString()); var method = extractor.Signature as Method; PexLog(host, "signature", method.FullName); log.AppendLine("found method: " + method.FullName + " in branch " + locations[i]); if (!host.GetService<IssueTrackDatabase>().UninstrumentedMethodInBranch.ContainsKey(locations[i])) { host.GetService<IssueTrackDatabase>().UninstrumentedMethodInBranch.Add(locations[i], method); } } } PexLog(host, "location", locations.Select(x => x.ToString())); log.AppendLine("*****************************************************"); } log.AppendLine("========================="); }