/// <summary> /// Checks the rules stored in the dictionary /// </summary> public void CheckRules() { ClearMessages(); // Rebuilds everything Interpreter.Compiler compiler = new Interpreter.Compiler(EFSSystem, EFSSystem.ShouldRebuild); compiler.Compile(); EFSSystem.ShouldRebuild = false; // Check rules RuleCheckerVisitor visitor = new RuleCheckerVisitor(this); visitor.visit(this, true); }
/// <summary> /// Checks the rules stored in the dictionary /// </summary> public void CheckRules() { Util.DontNotify(() => { try { // Rebuilds everything EFSSystem.Compiler.Compile_Synchronous(EFSSystem.ShouldRebuild); EFSSystem.ShouldRebuild = false; // Check rules RuleCheckerVisitor visitor = new RuleCheckerVisitor(this); visitor.visit(this, true); } catch (Exception) { } }); }
/// <summary> /// Perform all functional tests defined in the .EFS file provided /// </summary> /// <param name="args"></param> /// <returns>the error code of the program</returns> private static int Main(string[] args) { int retVal = 0; EfsSystem efsSystem = EfsSystem.Instance; try { Console.Out.WriteLine("EFS Tester"); // Load the dictionaries provided as parameters Util.PleaseLockFiles = false; foreach (string arg in args) { Console.Out.WriteLine("Loading dictionary " + arg); Dictionary dictionary = Util.Load(efsSystem, new Util.LoadParams(arg) { LockFiles = false, Errors = null, UpdateGuid = false, ConvertObsolete = false }); if (dictionary == null) { Console.Out.WriteLine("Cannot load dictionary " + arg); return -1; } } // Translate the sub sequences, if required Console.Out.WriteLine("Translating sub sequences"); foreach (Dictionary dictionary in efsSystem.Dictionaries) { foreach (Frame frame in dictionary.Tests) { foreach (SubSequence subSequence in frame.SubSequences) { if (subSequence.getCompleted()) { if (dictionary.TranslationDictionary != null) { subSequence.Translate(); } } } } } // Make sure everything is recompiled Console.Out.WriteLine("Recompiling everything"); efsSystem.Compiler.Compile_Synchronous(true); // Ensure the model is consistent Console.Out.WriteLine("Checking model"); foreach (Dictionary dictionary in efsSystem.Dictionaries) { RuleCheckerVisitor checker = new RuleCheckerVisitor(dictionary); checker.CheckRules(); } // Dumps all errors found Util.IsThereAnyError isThereAnyError = new Util.IsThereAnyError(); if (isThereAnyError.ErrorsFound.Count > 0) { foreach (ElementLog error in isThereAnyError.ErrorsFound) { Console.Out.WriteLine(error.Log); } return -1; } { // Perform functional test for last loaded dictionary Dictionary dictionary = efsSystem.Dictionaries.FindLast(x => true); Console.Out.WriteLine("Processing tests from dictionary " + dictionary.Name); foreach (Frame frame in dictionary.Tests) { Console.Out.WriteLine("Executing frame " + frame.FullName); foreach (SubSequence subSequence in frame.SubSequences) { Console.Out.WriteLine("Executing sub sequence " + subSequence.FullName); if (subSequence.getCompleted()) { if(subSequence.Name.Contains("S050")) System.Diagnostics.Debugger.Break(); Runner runner = new Runner(subSequence, false, true, true); runner.RunUntilStep(null); bool failed = false; foreach (ModelEvent evt in runner.FailedExpectations()) { Expect expect = evt as Expect; if (expect != null) { string message = expect.Message.Replace('\n', ' '); Console.Out.WriteLine(" failed :" + message); failed = true; } else { ModelInterpretationFailure modelInterpretationFailure = evt as ModelInterpretationFailure; if (modelInterpretationFailure != null) { Console.Out.WriteLine(" failed : " + modelInterpretationFailure.Message); failed = true; } } } if (failed) { Console.Out.WriteLine(" -> Failed"); retVal = -1; } else { Console.Out.WriteLine(" -> Success"); } } else { Console.Out.WriteLine(" -> Not executed because it is not marked as completed"); } } } } } finally { Util.UnlockAllFiles(); efsSystem.Stop(); } return retVal; }
/// <summary> /// Checks the rules stored in the dictionary /// </summary> public void CheckRules() { Util.DontNotify(() => { try { // Rebuilds everything EFSSystem.Compiler.Compile_Synchronous(EFSSystem.ShouldRebuild); EFSSystem.ShouldRebuild = false; MarkingHistory.PerformMark(() => { // Check rules RuleCheckerVisitor visitor = new RuleCheckerVisitor(this); visitor.visit(this, true); }); } catch (Exception) { } }); }