Ejemplo n.º 1
0
        public static void ProcessOutcome(
            Program program, string implName, VC.VCGen.Outcome outcome, List <Counterexample> errors, string timeIndication, ref ResultCounter counters)
        {
            switch (outcome)
            {
            default:
                Contract.Assert(false);      // unexpected outcome
                throw new cce.UnreachableException();

            case ConditionGeneration.Outcome.ReachedBound:
                Utilities.IO.Inform("{0}verified", timeIndication);
                Console.WriteLine("Stratified Inlining: Reached recursion bound of {0}", CommandLineOptions.Clo.RecursionBound);
                counters.Verified++;
                break;

            case ConditionGeneration.Outcome.Correct:
                if (CommandLineOptions.Clo.vcVariety == CommandLineOptions.VCVariety.Doomed)
                {
                    Utilities.IO.Inform("{0}credible", timeIndication);
                    counters.Verified++;
                }
                else
                {
                    Utilities.IO.Inform("{0}verified", timeIndication);
                    counters.Verified++;
                }

                break;

            case ConditionGeneration.Outcome.TimedOut:
                counters.TimeOuts++;
                Utilities.IO.Inform("{0}timed out", timeIndication);
                break;

            case ConditionGeneration.Outcome.OutOfMemory:
                counters.OutOfMemories++;
                Utilities.IO.Inform("{0}out of memory", timeIndication);
                break;

            case ConditionGeneration.Outcome.Inconclusive:
                counters.Inconclusives++;
                Utilities.IO.Inform("{0}inconclusive", timeIndication);
                break;

            case ConditionGeneration.Outcome.Errors:
                if (CommandLineOptions.Clo.vcVariety == CommandLineOptions.VCVariety.Doomed)
                {
                    Utilities.IO.Inform("{0}doomed", timeIndication);
                    counters.VerificationErrors++;
                }

                Contract.Assert(errors != null);      // guaranteed by postcondition of VerifyImplementation

                // BP1xxx: Parsing errors
                // BP2xxx: Name resolution errors
                // BP3xxx: Typechecking errors
                // BP4xxx: Abstract interpretation errors (Is there such a thing?)
                // BP5xxx: Verification errors
                errors.Sort(new CounterexampleComparer());

                foreach (Counterexample error in errors)
                {
                    new GPUVerifyErrorReporter(program, implName).ReportCounterexample(error);
                    counters.VerificationErrors++;
                }

                Utilities.IO.Inform("{0}{1}", timeIndication, errors.Count == 1 ? "error" : "errors");
                break;
            }
        }
Ejemplo n.º 2
0
        private void ProcessOutcome(Implementation impl, VC.VCGen.Outcome outcome, List <Counterexample> errors,
                                    string timeIndication, PipelineStatistics stats)
        {
            switch (outcome)
            {
            case VC.VCGen.Outcome.ReachedBound:
                Whoop.IO.Reporter.Inform(String.Format("{0}verified", timeIndication));
                Console.WriteLine(string.Format("Stratified Inlining: Reached recursion bound of {0}",
                                                WhoopRaceCheckerCommandLineOptions.Get().RecursionBound));
                stats.VerifiedCount++;
                break;

            case VC.VCGen.Outcome.Correct:
                if (WhoopRaceCheckerCommandLineOptions.Get().vcVariety == CommandLineOptions.VCVariety.Doomed)
                {
                    Whoop.IO.Reporter.Inform(String.Format("{0}credible", timeIndication));
                    stats.VerifiedCount++;
                }
                else
                {
                    Whoop.IO.Reporter.Inform(String.Format("{0}verified", timeIndication));
                    stats.VerifiedCount++;
                }
                break;

            case VC.VCGen.Outcome.TimedOut:
                stats.TimeoutCount++;
                Whoop.IO.Reporter.Inform(String.Format("{0}timed out", timeIndication));
                break;

            case VC.VCGen.Outcome.OutOfMemory:
                stats.OutOfMemoryCount++;
                Whoop.IO.Reporter.Inform(String.Format("{0}out of memory", timeIndication));
                break;

            case VC.VCGen.Outcome.Inconclusive:
                stats.InconclusiveCount++;
                Whoop.IO.Reporter.Inform(String.Format("{0}inconclusive", timeIndication));
                break;

            case VC.VCGen.Outcome.Errors:
                Contract.Assert(errors != null);
                if (WhoopRaceCheckerCommandLineOptions.Get().vcVariety == CommandLineOptions.VCVariety.Doomed)
                {
                    Whoop.IO.Reporter.Inform(String.Format("{0}doomed", timeIndication));
                    stats.ErrorCount++;
                }

                errors.Sort(new CounterexampleComparer());
                int errorCount = 0;

                foreach (Counterexample error in errors)
                {
                    errorCount += this.ErrorReporter.ReportCounterexample(error);
                }

                if (errorCount == 0)
                {
                    Whoop.IO.Reporter.Inform(String.Format("{0}verified", timeIndication));
                    stats.VerifiedCount++;
                }
                else
                {
                    Whoop.IO.Reporter.Inform(String.Format("{0}error{1}", timeIndication, errorCount == 1 ? "" : "s"));
                    stats.ErrorCount += errorCount;
                }
                break;

            default:
                Contract.Assert(false); // unexpected outcome
                throw new cce.UnreachableException();
            }
        }