Exemplo n.º 1
0
        protected void handle(Object executor, Executor.ExecutionStateEventArgs arg)
        {
            var terminationType = arg.State.TerminationType.GetType();
            var isSpeculative   = arg.State.Speculative;

            Debug.Assert(Counters.ContainsKey(terminationType), "Termination type not handled!");

            var oldValue = Counters[terminationType];

            switch (TheCountType)
            {
            case CountType.BOTH:
                goto doCount;

            case CountType.ONLY_SPECULATIVE:
                if (isSpeculative)
                {
                    goto doCount;
                }
                break;

            case CountType.ONLY_NON_SPECULATIVE:
                if (!isSpeculative)
                {
                    goto doCount;
                }
                break;
doCount:
                Counters[terminationType] = ++oldValue;
                break;

            default:
                throw new InvalidOperationException("Unsupported count type");
            }
        }
        private void handle(Object executor, Executor.ExecutionStateEventArgs args)
        {
            string msg = "State " + args.State.Id + ":" + (args.State.Speculative ? "(Speculative) " : " ");

            ConsoleColor color;

            if (args.State.TerminationType is TerminatedWithoutError)
            {
                color = ConsoleColor.Green;
            }
            else if (args.State.TerminationType is TerminatedAtUnsatisfiableAssume)
            {
                var assumeCmd = args.State.TerminationType.ExitLocation.AsCmd as AssumeCmd;

                // We don't want to notify about unsatisfiable assumes that are a result
                // of control flow (i.e. goto follow by an assume)
                if (QKeyValue.FindBoolAttribute(assumeCmd.Attributes, "partition"))
                {
                    return;
                }

                color = ConsoleColor.DarkMagenta;
            }
            else
            {
                color = ConsoleColor.Red;
            }

            msg += args.State.TerminationType.GetMessage();


            if (args.State.TerminationType is TerminatedAtUnsatisfiableAxiom)
            {
                var tt       = args.State.TerminationType as TerminatedAtUnsatisfiableAxiom;
                var enforced = tt.ExitLocation.AsAxiom.FindAttribute("symbooglix_enforce_unique");
                if (enforced != null)
                {
                    msg += System.Environment.NewLine + "This axiom was generated to enforce the unique keyword.";
                }

                if (args.State.Speculative)
                {
                    // FIXME: This specific to the SymbooglixDriver and is not general. Right now it's quite useful
                    // to tell users this though.
                    msg += System.Environment.NewLine + System.Environment.NewLine +
                           "Note this is a speculative failure because the solver" +
                           " could not prove that the axiom is satisfiable. If you trust your axioms then you" +
                           " can disable checking them by using --check-entry-axioms=0";
                }
            }

            WriteLine(color, msg);
        }
Exemplo n.º 3
0
        void HandleStateTerminated(object sender, Executor.ExecutionStateEventArgs e)
        {
            // Make sure the counting happens first
            base.handle(sender, e);

            if (NumberOfFailures >= FailureLimit)
            {
                var executor = sender as Executor;
                Console.WriteLine("Failure limit of {0} reached. Terminating Executor", FailureLimit);
                // Don't interrupt the solver, this can lead to non-deterministic behaviour
                executor.Terminate(/*block=*/ false, /*interruptSolver=*/ false);
            }
        }
Exemplo n.º 4
0
 private void handle(Object executor, Executor.ExecutionStateEventArgs args)
 {
     if (UseTasks)
     {
         lock (ScheduledTasks)
         {
             var task = Task.Factory.StartNew(() =>
             {
                 DoLogging(executor as Executor, args.State);
             });
             ScheduledTasks.Add(task);
         }
     }
     else
     {
         DoLogging(executor as Executor, args.State);
     }
 }