Skip to content
Snippets Groups Projects
Commit 5f9356bf authored by Manos Koukoutos's avatar Manos Koukoutos
Browse files

Fix ugly mess with reports in Main

parent fd1604d9
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
package leon package leon
import leon.utils._ import leon.utils._
import leon.verification.VerificationReport
object Main { object Main {
...@@ -11,7 +12,7 @@ object Main { ...@@ -11,7 +12,7 @@ object Main {
frontends.scalac.ExtractionPhase, frontends.scalac.ExtractionPhase,
frontends.scalac.ClassgenPhase, frontends.scalac.ClassgenPhase,
utils.TypingPhase, utils.TypingPhase,
FileOutputPhase, utils.FileOutputPhase,
purescala.RestoreMethods, purescala.RestoreMethods,
xlang.ArrayTransformation, xlang.ArrayTransformation,
xlang.EpsilonElimination, xlang.EpsilonElimination,
...@@ -192,14 +193,18 @@ object Main { ...@@ -192,14 +193,18 @@ object Main {
ExtractionPhase andThen ExtractionPhase andThen
new PreprocessingPhase(xlangF) new PreprocessingPhase(xlangF)
val verification = if (xlangF) VerificationPhase andThen FixReportLabels else VerificationPhase val verification =
VerificationPhase andThen
(if (xlangF) FixReportLabels else NoopPhase[VerificationReport]()) andThen
PrintReportPhase
val termination = TerminationPhase andThen PrintReportPhase
val pipeProcess: Pipeline[Program, Any] = { val pipeProcess: Pipeline[Program, Any] = {
if (noopF) RestoreMethods andThen FileOutputPhase if (noopF) RestoreMethods andThen FileOutputPhase
else if (synthesisF) SynthesisPhase else if (synthesisF) SynthesisPhase
else if (repairF) RepairPhase else if (repairF) RepairPhase
else if (analysisF) Pipeline.both(verification, TerminationPhase) else if (analysisF) Pipeline.both(verification, termination)
else if (terminationF) TerminationPhase else if (terminationF) termination
else if (isabelleF) IsabellePhase else if (isabelleF) IsabellePhase
else if (evalF) EvaluationPhase else if (evalF) EvaluationPhase
else if (inferInvF) InferInvariantsPhase else if (inferInvF) InferInvariantsPhase
...@@ -264,23 +269,7 @@ object Main { ...@@ -264,23 +269,7 @@ object Main {
val timer = ctx.timers.total.start() val timer = ctx.timers.total.start()
// Run pipeline // Run pipeline
val ctx2 = pipeline.run(ctx, args.toList) match { val (ctx2, _) = pipeline.run(ctx, args.toList)
case (ctx2, (vReport: verification.VerificationReport, tReport: termination.TerminationReport)) =>
ctx2.reporter.info(vReport.summaryString)
ctx2.reporter.info(tReport.summaryString)
ctx2
case (ctx2, report: verification.VerificationReport) =>
ctx2.reporter.info(report.summaryString)
ctx2
case (ctx2, report: termination.TerminationReport) =>
ctx2.reporter.info(report.summaryString)
ctx2
case (ctx2, _) =>
ctx2
}
timer.stop() timer.stop()
......
...@@ -4,9 +4,10 @@ package leon ...@@ -4,9 +4,10 @@ package leon
package termination package termination
import purescala.Definitions._ import purescala.Definitions._
import utils.Report
import utils.ASCIIHelpers._ import utils.ASCIIHelpers._
case class TerminationReport(ctx: LeonContext, results : Seq[(FunDef,TerminationGuarantee)], time : Double) { case class TerminationReport(ctx: LeonContext, results : Seq[(FunDef,TerminationGuarantee)], time : Double) extends Report {
def summaryString : String = { def summaryString : String = {
var t = Table("Termination summary") var t = Table("Termination summary")
......
/* Copyright 2009-2016 EPFL, Lausanne */
package leon
package utils
/** Pretty-prints a [[Report]] */
case object PrintReportPhase extends UnitPhase[Report] {
override val description: String = "Print a Leon report"
override val name: String = "PrintReport"
override def apply(ctx: LeonContext, rep: Report): Unit = {
ctx.reporter.info(rep.summaryString)
}
}
/* Copyright 2009-2016 EPFL, Lausanne */
package leon.utils
/** Represents a pretty-printable report */
abstract class Report {
def summaryString: String
}
...@@ -4,8 +4,9 @@ package leon ...@@ -4,8 +4,9 @@ package leon
package verification package verification
import purescala.Definitions.Program import purescala.Definitions.Program
import utils.Report
case class VerificationReport(program: Program, results: Map[VC, Option[VCResult]]) { case class VerificationReport(program: Program, results: Map[VC, Option[VCResult]]) extends Report {
val vrs: Seq[(VC, VCResult)] = results.toSeq.sortBy { case (vc, _) => (vc.fd.id.name, vc.kind.toString) }.map { val vrs: Seq[(VC, VCResult)] = results.toSeq.sortBy { case (vc, _) => (vc.fd.id.name, vc.kind.toString) }.map {
case (vc, or) => (vc, or.getOrElse(VCResult.unknown)) case (vc, or) => (vc, or.getOrElse(VCResult.unknown))
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment