Beispiel #1
0
        protected virtual void EnableAllControls()
        {
            ListView_Assertions.Enabled                = true;
            ComboBox_AdmissibleBehavior.Enabled        = true;
            ComboBox_VerificationEngine.Enabled        = true;
            this.CheckBox_GenerateWitnessTrace.Enabled = true;

            NumericUpDown_TimeOut.Enabled = true;

            Button_Verify.Text = VERIFY;
            ToolTip.SetToolTip(Button_Verify, VERIFY);
            ProgressBar.Value   = 0;
            ProgressBar.Visible = false;
            Cursor = Cursors.Default;
            TextBox_Output.Cursor = Cursors.Default;

            if (ListView_Assertions.SelectedItems.Count == 1)
            {
                ResetUIOptions(ListView_Assertions.SelectedItems[0], false);
            }
            else
            {
                ResetUIOptions(null, false);
            }


            MCTimer.Stop();

            Spec.UnLockSharedData();


            Common.Ultility.Ultility.FlashWindowEx(this);
        }
Beispiel #2
0
        private void StartVerification(ListViewItem item)
        {
            if (!ModuleSpecificCheckPassed())
            {
                return;
            }

            if (!Spec.GrabSharedDataLock())
            {
                MessageBox.Show(Resources.Please_wait_for_the_simulation_or_parsing_finished_before_verification, Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            DisableAllControls();


            try
            {
                Spec.LockSharedData(false);

                StatusLabel_Text.Text = Resources.ModelCheckingForm_StartVerification_Verification_Starts;



                item.ImageIndex = UNKNOWN_ICON;

                Assertion = Spec.AssertionDatabase[item.SubItems[2].Text];
                Assertion.UIInitialize(this, ComboBox_AdmissibleBehavior.SelectedIndex == -1 ? 0 : ComboBox_AdmissibleBehavior.SelectedIndex,
                                       ComboBox_VerificationEngine.SelectedIndex == -1 ? 0 : ComboBox_VerificationEngine.SelectedIndex);

                Assertion.VerificationOutput.GenerateCounterExample = CheckBox_GenerateWitnessTrace.Checked;

                Assertion.Action       += OnAction;
                Assertion.ReturnResult += VerificationFinished;
                Assertion.Cancelled    += Verification_Cancelled;
                Assertion.Failed       += MC_Failed;

                seconds           = 1;
                ProgressBar.Value = 0;
                MCTimer.Start();
                Assertion.Start();
            }
            catch (RuntimeException e)
            {
                Spec.UnLockSharedData();
                Common.Ultility.Ultility.LogRuntimeException(e);
                Button_Verify.Text = VERIFY;
                this.Close();
                return;
            }
            catch (Exception ex)
            {
                Spec.UnLockSharedData();
                Common.Ultility.Ultility.LogException(ex, Spec);
                Button_Verify.Text = VERIFY;
                this.Close();
                return;
            }
        }
        protected virtual void EnableAllControls()
        {
            if (OutputWriter != null)
            {
                OutputWriter.Close();
                OutputWriter = null;
            }

            ListView_Assertions.Enabled = true;

            this.CheckBox_Verbose.Enabled       = true;
            this.NUD_AdmissibleBehavior.Enabled = true;
            this.NUD_VerificationEngine.Enabled = true;

            ComboBox_Modules.Enabled = true;
            CheckBox_GenerateCounterexample.Enabled = true;
            Button_AddFiles.Enabled     = true;
            Button_AddFolder.Enabled    = true;
            Button_RemoveFiles.Enabled  = true;
            Button_BrowseOutput.Enabled = true;
            TextBox_OutputFile.Enabled  = true;

            NumericUpDown_TimeOut.Enabled = true;

            Button_Verify.Text            = VERIFY;
            Button_Verify.Enabled         = true;
            Button_GenerateReport.Enabled = true;

            ProgressBar.Value   = 0;
            ProgressBar.Visible = false;
            this.Cursor         = Cursors.Default;

            MCTimer.Stop();
        }
Beispiel #4
0
 private void MCTimer_Tick(object sender, EventArgs e)
 {
     StatusLabel_Text.Text = String.Format(Resources.Verification_has_been_running_for__0__s, seconds);
     seconds++;
     if (NumericUpDown_TimeOut.Value > 0 && seconds > NumericUpDown_TimeOut.Value * 60)
     {
         MCTimer.Stop();
         Button_Verify.PerformClick();
     }
 }
        private void MCTimer_Tick(object sender, EventArgs e)
        {
            StatusLabel_Text.Text = String.Format(Resources.Verification_has_been_running_for_, seconds);

            seconds++;
            if (NumericUpDown_TimeOut.Value > 0 && seconds > NumericUpDown_TimeOut.Value)
            {
                MCTimer.Stop();
                this.OutputWriter.WriteLine("Timed out after " + (seconds - 1) + " seconds");
                Assertion.Cancel();
            }
        }
Beispiel #6
0
        protected virtual void EnableAllControls()
        {
            ListView_Assertions.Enabled = true;

            this.CheckBox_Parallel.Enabled         = true;
            this.CheckBox_Verbose.Enabled          = true;
            this.CheckBox_BDD.Enabled              = true;
            this.CheckBox_CheckNonZenoness.Enabled = true;

            //the following three values
            //ComboBox_Fairness.Enabled = true;
            this.CheckBox_PartialOrderReduction.Enabled = true;
            //this.NUD_Depth.Enabled = true;

            NumericUpDown_TimeOut.Enabled = true;

            Button_Verify.Text = VERIFY;
            ToolTip.SetToolTip(Button_Verify, VERIFY);
            ProgressBar.Value   = 0;
            ProgressBar.Visible = false;
            Cursor = Cursors.Default;
            TextBox_Output.Cursor = Cursors.Default;

            if (ListView_Assertions.SelectedItems.Count == 1)
            {
                ResetUIOptions(ListView_Assertions.SelectedItems[0], false);
            }
            else
            {
                ResetUIOptions(null, false);
            }


            MCTimer.Stop();

            Spec.UnLockSharedData();
        }
        private void StartVerification(bool completed, bool correct)
        {
            FlushString();
            MCTimer.Stop();


            if (AssertionIndex == 0)
            {
                if (completed && FileIndex > 0)
                {
                    if (correct)
                    {
                        ListView_Assertions.Items[FileIndex - 1].ImageIndex = CORRECT_ICON;
                    }
                    else
                    {
                        ListView_Assertions.Items[FileIndex - 1].ImageIndex = WRONG_ICON;
                    }
                }

                if (FileIndex < ListView_Assertions.Items.Count)
                {
                    try
                    {
                        string file = ListView_Assertions.Items[FileIndex].SubItems[2].Text;
                        FileIndex++;

                        this.OutputWriter.WriteLine("*******************************************************");
                        this.OutputWriter.WriteLine("*" + file);
                        this.OutputWriter.WriteLine("**************************START************************");
                        StatusLabel_Text.Text = Resources.Checking_file_ + file;

                        StreamReader tr         = new StreamReader(file);
                        string       specString = tr.ReadToEnd();
                        tr.Close();

                        if (Spec != null)
                        {
                            Spec.UnLockSharedData();
                        }

                        string           modulefolder = Common.Utility.Utilities.ModuleFolderNames[this.ComboBox_Modules.SelectedIndex];
                        ModuleFacadeBase modulebase   = Common.Utility.Utilities.LoadModule(modulefolder);
                        Spec = modulebase.ParseSpecification(specString, "", file);

                        if (Spec != null)
                        {
                            Assertions = new List <string>(Spec.AssertionDatabase.Keys);
                        }
                        else
                        {
                            throw new Exception("ERROR Spec!");
                        }
                    }
                    catch (Exception ex)
                    {
                        if (FileIndex > 0)
                        {
                            ListView_Assertions.Items[FileIndex - 1].ImageIndex = WRONG_ICON;
                        }
                        this.OutputWriter.WriteLine("Error occurred: " + ex.Message + "\r\n" + ex.StackTrace);
                        StartVerification(false, false);
                    }
                }
                else
                {
                    EnableAllControls();
                    return;
                }
            }


            try
            {
                if (Assertions.Count > 0)
                {
                    OutputWriter.WriteLine("=======================================================");
                    OutputWriter.WriteLine("Assertion: " + Assertions[AssertionIndex]);
                    StatusLabel_Text.Text = Resources.Verifying_Assertion__ + Assertions[AssertionIndex];
                    FlushString();

                    Assertion = Spec.AssertionDatabase[Assertions[AssertionIndex]];
                    AssertionIndex++;
                    AssertionIndex = AssertionIndex % Assertions.Count;

                    //Assertion.UIInitialize(this, Fairness, this.CheckBox_PartialOrderReduction.Checked, this.CheckBox_Verbose.Checked, this.CheckBox_Parallel.Checked, this.ShortestPath, this.CheckBox_BDD.Checked, this.CheckBox_CheckNonZenoness.Checked, GetParameters());

                    Assertion.UIInitialize(this, (int)NUD_AdmissibleBehavior.Value, (int)NUD_VerificationEngine.Value);
                    Assertion.VerificationOutput.GenerateCounterExample = CheckBox_GenerateCounterexample.Checked;

                    Assertion.Action       += OnAction;
                    Assertion.ReturnResult += VerificationFinished;
                    Assertion.Cancelled    += Verification_Cancelled;
                    Assertion.Failed       += MC_Failed;

                    seconds           = 1;
                    ProgressBar.Value = 0;
                    //timer.Reset();
                    //startMemroySize = GC.GetTotalMemory(true);
                    MCTimer.Start();
                    //timer.Start();
                    Assertion.Start();
                }
                else
                {
                    StartVerification(true, true);
                }
            }
            catch (RuntimeException e)
            {
                EnableAllControls();
                Common.Utility.Utilities.LogRuntimeException(e);
                this.Close();
                return;
            }
            catch (Exception ex)
            {
                EnableAllControls();
                Common.Utility.Utilities.LogException(ex, Spec);
                this.Close();
                return;
            }
        }
Beispiel #8
0
        private void StartVerification(ListViewItem item)
        {
            if (!ModuleSpecificCheckPassed())
            {
                return;
            }

            if (!Spec.GrabSharedDataLock())
            {
                MessageBox.Show(Resources.Please_wait_for_the_simulation_or_parsing_finished_before_verification, Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            DisableAllControls();


            try
            {
                Spec.LockSharedData(false);

                StatusLabel_Text.Text = Resources.ModelCheckingForm_StartVerification_Verification_Starts;

                //these data will not change for SpecProcess.SharedData, so once it is created after parsing, there is no need to set them again.
                //SpecProcess.SharedData.VariableLowerBound = Valuation.VariableLowerBound;
                //SpecProcess.SharedData.VariableUpperLowerBound = Valuation.VariableUpperLowerBound;
                //SpecProcess.SharedData.AlphaDatabase = Specification.AlphaDatabase;
                //SpecProcess.SharedData.HasSyncrhonousChannel = Specification.HasSyncrhonousChannel;
                //SpecProcess.SharedData.SyncrhonousChannelNames = Specification.SyncrhonousChannelNames;


                //SpecProcess.SharedData.FairnessType = AssertionBase.FairnessType;
                //SpecProcess.SharedData.CalculateParticipatingProcess = AssertionBase.FairnessType == FairnessType.PROCESS_LEVEL_WEAK_FAIRNESS || AssertionBase.FairnessType == FairnessType.PROCESS_LEVEL_STRONG_FAIRNESS || Assertion.MustAbstract;
                //SpecProcess.SharedData.CalculateCreatedProcess = Assertion.MustAbstract;
                //SpecProcess.SharedData.DataManager = DataStore.DataManager;


                item.ImageIndex = UNKNOWN_ICON;

                Assertion = Spec.AssertionDatabase[item.SubItems[2].Text];
                Assertion.UIInitialize(this, Fairness, this.CheckBox_PartialOrderReduction.Checked, this.CheckBox_Verbose.Checked, this.CheckBox_Parallel.Checked, this.ShortestPath, this.CheckBox_BDD.Checked, this.CheckBox_CheckNonZenoness.Checked, GetParameters());


                Assertion.Action       += OnAction;
                Assertion.ReturnResult += VerificationFinished;
                Assertion.Cancelled    += Verification_Cancelled;
                Assertion.Failed       += MC_Failed;

                seconds           = 1;
                ProgressBar.Value = 0;
                //timer.Reset();
                //startMemroySize = GC.GetTotalMemory(true);
                MCTimer.Start();
                //timer.Start();
                Assertion.Start();
            }
            catch (RuntimeException e)
            {
                Common.Ultility.Ultility.LogRuntimeException(e);
                this.Close();
                return;
            }
            catch (Exception ex)
            {
                //TextBox_Output.Text += ex.Message + "\r\n" + ex.StackTrace;
                //EnableAllControls();
                Common.Ultility.Ultility.LogException(ex, Spec);
                this.Close();
                return;
            }
        }