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; } }
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; } }
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; } }