internal static ProtoCore.Core TestRunnerRunOnly(string code) { ProtoCore.Core core; ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScriptTestRunner(); ProtoScript.Config.RunConfiguration runnerConfig; string testPath = @"..\..\..\Scripts\Debugger\"; // Specify some of the requirements of IDE. var options = new ProtoCore.Options(); options.ExecutionMode = ProtoCore.ExecutionMode.Serial; options.SuppressBuildOutput = false; core = new ProtoCore.Core(options); core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core)); core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core)); runnerConfig = new ProtoScript.Config.RunConfiguration(); runnerConfig.IsParrallel = false; fsr = new ProtoScriptTestRunner(); DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper()); CLRModuleType.ClearTypes(); //Run ProtoLanguage.CompileStateTracker compileState = null; fsr.Execute(code, core, out compileState); return(core); }
static void DevRun() { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); var opts = new Options(); opts.ExecutionMode = ExecutionMode.Serial; ProtoCore.Core core = new Core(opts); core.Compilers.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Compiler(core)); core.Compilers.Add(ProtoCore.Language.kImperative, new ProtoImperative.Compiler(core)); #if DEBUG core.Options.DumpByteCode = true; core.Options.Verbose = true; #else core.Options.DumpByteCode = false; core.Options.Verbose = false; #endif ProtoFFI.DLLFFIHandler.Register(ProtoFFI.FFILanguage.CSharp, new ProtoFFI.CSModuleHelper()); ProtoScriptTestRunner runner = new ProtoScriptTestRunner(); // Assuming current directory in test/debug mode is "...\Dynamo\bin\AnyCPU\Debug" RuntimeCore runtimeCore = null; ExecutionMirror mirror = runner.LoadAndExecute(@"..\..\..\test\core\dsevaluation\DSFiles\test.ds", core, out runtimeCore); long ms = sw.ElapsedMilliseconds; sw.Stop(); Console.WriteLine(ms); Console.ReadLine(); }
static void DevRun() { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); var opts = new Options(); opts.ExecutionMode = ExecutionMode.Serial; ProtoCore.Core core = new Core(opts); core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core)); core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core)); #if DEBUG core.Options.DumpByteCode = true; core.Options.Verbose = true; #else core.Options.DumpByteCode = false; core.Options.Verbose = false; #endif ProtoFFI.DLLFFIHandler.Register(ProtoFFI.FFILanguage.CSharp, new ProtoFFI.CSModuleHelper()); ProtoScriptTestRunner runner = new ProtoScriptTestRunner(); ExecutionMirror mirror = runner.LoadAndExecute(@"c:\project\github\test.ds", core); long ms = sw.ElapsedMilliseconds; sw.Stop(); Console.WriteLine(ms); Console.ReadLine(); }
internal static ProtoCore.Core TestRunnerRunOnly(string code) { ProtoCore.Core core; ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScriptTestRunner(); ProtoScript.Config.RunConfiguration runnerConfig; // Specify some of the requirements of IDE. var options = new ProtoCore.Options(); options.ExecutionMode = ProtoCore.ExecutionMode.Serial; options.SuppressBuildOutput = false; string testPath = @"..\..\..\test\Engine\ProtoTest\ImportFiles\"; options.IncludeDirectories.Add(testPath); core = new ProtoCore.Core(options); core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core)); core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core)); runnerConfig = new ProtoScript.Config.RunConfiguration(); runnerConfig.IsParrallel = false; fsr = new ProtoScriptTestRunner(); DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper()); CLRModuleType.ClearTypes(); //Run fsr.Execute(code, core); return(core); }
static void DevRun() { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); var opts = new Options(); opts.ExecutionMode = ExecutionMode.Serial; ProtoCore.Core core = new Core(opts); core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core)); core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core)); #if DEBUG core.Options.DumpByteCode = true; core.Options.Verbose = true; #else core.Options.DumpByteCode = false; core.Options.Verbose = false; #endif #if __RUN_TESTFILE ProtoFFI.DLLFFIHandler.Register(ProtoFFI.FFILanguage.CSharp, new ProtoFFI.CSModuleHelper()); ProtoScriptTestRunner runner = new ProtoScriptTestRunner(); ExecutionMirror mirror = runner.LoadAndExecute(@"defectverify.ds", core); #else ProtoTest.GraphCompiler.MicroFeatureTests test = new ProtoTest.GraphCompiler.MicroFeatureTests(); test.Setup(); test.GraphILTest_Assign02(); #endif long ms = sw.ElapsedMilliseconds; sw.Stop(); Console.WriteLine(ms); Console.ReadLine(); }
public void TestCompilerAndRuntimeComponent01() { String code = @" a = 10; " ; // Compile core var opts = new Options(); opts.ExecutionMode = ExecutionMode.Serial; ProtoCore.Core core = new Core(opts); core.Compilers.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Compiler(core)); core.Compilers.Add(ProtoCore.Language.kImperative, new ProtoImperative.Compiler(core)); ProtoScriptTestRunner runner = new ProtoScriptTestRunner(); // Compiler instance ProtoCore.DSASM.Executable dsExecutable; bool compileSucceeded = runner.CompileMe(code, core, out dsExecutable); Assert.IsTrue(compileSucceeded == true); // Pass compile data to the runtime RuntimeCore runtimeCore = new RuntimeCore(core.Heap); runtimeCore.SetProperties(core.Options, dsExecutable); // Runtime ExecutionMirror mirror = runner.ExecuteMe(runtimeCore); Obj o = mirror.GetValue("a"); Assert.IsTrue((Int64)o.Payload == 10); }
public void Setup() { core = new ProtoCore.Core(new ProtoCore.Options()); core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core)); core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core)); coreRunner = new ProtoScript.Runners.ProtoScriptTestRunner(); }
internal static ProtoCore.Core TestRunnerRunOnly(string includePath, string code, Dictionary <int, List <string> > map, string geometryFactory, string persistentManager, out ExecutionMirror mirror) { ProtoCore.Core core; ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScriptTestRunner(); ProtoScript.Config.RunConfiguration runnerConfig; // Specify some of the requirements of IDE. var options = new ProtoCore.Options(); options.ExecutionMode = ProtoCore.ExecutionMode.Serial; options.SuppressBuildOutput = false; options.WatchTestMode = true; // Cyclic dependency threshold is lowered from the default (2000) // as this causes the test framework to be painfully slow options.kDynamicCycleThreshold = 5; // Pass the absolute path so that imported filepaths can be resolved // in "FileUtils.GetDSFullPathName()" includePath = Path.GetDirectoryName(includePath); options.IncludeDirectories.Add(includePath); //StreamWriter sw = File.CreateText(executionLogFilePath); TextOutputStream fs = new TextOutputStream(map); core = new ProtoCore.Core(options); core.Configurations.Add(ConfigurationKeys.GeometryXmlProperties, true); //core.Configurations.Add(ConfigurationKeys.GeometryFactory, geometryFactory); //core.Configurations.Add(ConfigurationKeys.PersistentManager, persistentManager); // By specifying this option we inject a mock Executive ('InjectionExecutive') // that prints stackvalues at every assignment statement // by overriding the POP_handler instruction - pratapa //core.ExecutiveProvider = new InjectionExecutiveProvider(); core.BuildStatus.MessageHandler = fs; core.Compilers.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Compiler(core)); core.Compilers.Add(ProtoCore.Language.kImperative, new ProtoImperative.Compiler(core)); runnerConfig = new ProtoScript.Config.RunConfiguration(); runnerConfig.IsParrallel = false; DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper()); //Run mirror = fsr.Execute(code, core); //sw.Close(); return(core); }
static void DevRun() { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); var opts = new Options(); opts.ExecutionMode = ExecutionMode.Serial; ProtoCore.Core core = new Core(opts); core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core)); core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core)); #if DEBUG core.Options.DumpByteCode = true; core.Options.Verbose = true; #else core.Options.DumpByteCode = false; core.Options.Verbose = false; #endif #if __RUN_TESTFILE ProtoFFI.DLLFFIHandler.Register(ProtoFFI.FFILanguage.CSharp, new ProtoFFI.CSModuleHelper()); ProtoScriptTestRunner runner = new ProtoScriptTestRunner(); ExecutionMirror mirror = runner.LoadAndExecute(@"D:\jun\AutodeskResearch\git\designscript\Scripts\jun.ds", core); #else // Insert test cases here //ProtoTest.LiveRunner.MicroFeatureTests test = new ProtoTest.LiveRunner.MicroFeatureTests(); //test.Setup(); //test.TestPythonCodeExecution(); ProtoTest.Associative.MicroFeatureTests test = new ProtoTest.Associative.MicroFeatureTests(); test.Setup(); test.TestUpdateRedefinition01(); //IntegrationTests.IncrementingTraceTests test = new IntegrationTests.IncrementingTraceTests(); //test.Setup(); //test.IntermediateValueIncrementerIDTestUpdate1DReplicated(); //ProtoFFITests.CSFFIDispose test = new ProtoFFITests.CSFFIDispose(); //test.Setup(); //test.IntermediateValueIncrementerIDTestUpdate1DReplicated(); // test.Dispose_FFITarget_Overridden(); //ProtoTest.EventTests.PropertyChangedNotifyTest test = new ProtoTest.EventTests.PropertyChangedNotifyTest(); //test.Setup(); //test.RunPropertyChangedNegative(); #endif long ms = sw.ElapsedMilliseconds; sw.Stop(); Console.WriteLine(ms); Console.ReadLine(); }
internal void TestRunnerRunOnly(string includePath, string code, Dictionary <int, List <string> > map /*, string executionLogFilePath*/) { ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScriptTestRunner(); ProtoScript.Config.RunConfiguration runnerConfig; // Specify some of the requirements of IDE. core.Options.ExecutionMode = ProtoCore.ExecutionMode.Serial; core.Options.SuppressBuildOutput = false; core.Options.WatchTestMode = true; core.Options.GCTempVarsOnDebug = false; // Cyclic dependency threshold is lowered from the default (2000) // as this causes the test framework to be painfully slow core.Options.kDynamicCycleThreshold = 5; // Pass the absolute path so that imported filepaths can be resolved // in "FileUtils.GetDSFullPathName()" if (!String.IsNullOrEmpty(includePath)) { includePath = Path.GetDirectoryName(includePath); core.Options.IncludeDirectories.Add(includePath); } //StreamWriter sw = File.CreateText(executionLogFilePath); TextOutputStream fs = new TextOutputStream(map); // By specifying this option we inject a mock Executive ('InjectionExecutive') // that prints stackvalues at every assignment statement // by overriding the POP_handler instruction - pratapa core.ExecutiveProvider = new InjectionExecutiveProvider(); core.BuildStatus.MessageHandler = fs; core.RuntimeStatus.MessageHandler = fs; core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core)); core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core)); runnerConfig = new ProtoScript.Config.RunConfiguration(); runnerConfig.IsParrallel = false; DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper()); //Run Mirror = fsr.Execute(code, core); //sw.Close(); core.Cleanup(); }
private bool SetupRegularRunner() { if ((null != internalWorker) && internalWorker.IsBusy) { return(false); } Logger.LogInfo("SetupRegularRunner", "Init"); System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); SetupCommonRunner(false); this.scriptRunner = new ProtoScriptTestRunner(); Logger.LogPerf("SetupRegularRunner", sw.ElapsedMilliseconds + " ms"); return(true); }
static void DevRun() { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); ProtoFFI.DLLFFIHandler.Register(ProtoFFI.FFILanguage.CSharp, new ProtoFFI.CSModuleHelper()); ProtoScriptTestRunner runner = new ProtoScriptTestRunner(); string vhdlTopLevelModuleName = "ProgramSynthesized"; runner.CompileToVHDL(vhdlTopLevelModuleName, @"..\..\test.ds"); long ms = sw.ElapsedMilliseconds; sw.Stop(); Console.WriteLine(ms); Console.ReadLine(); }
static void Run(string filename, bool verbose) { if (!File.Exists(filename)) { Console.WriteLine("Cannot find file " + filename); return; } var opts = new Options(); opts.ExecutionMode = ExecutionMode.Serial; ProtoCore.Core core = new Core(opts); core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core)); core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core)); core.Options.DumpByteCode = verbose; core.Options.Verbose = verbose; ProtoFFI.DLLFFIHandler.Register(ProtoFFI.FFILanguage.CSharp, new ProtoFFI.CSModuleHelper()); ProtoScriptTestRunner runner = new ProtoScriptTestRunner(); ExecutionMirror mirror = runner.LoadAndExecute(filename, core); }
private void CleanUpRunners() { Logger.LogInfo("DetachFromDebugger", "Detach"); // Clear up all watch related data members. this.workerParams.CurrentVmState = null; this.currentWatchedMirror = null; this.currentWatchedStackValue = null; if (null != scriptRunner) { scriptRunner = null; } if (null != debugRunner) { debugRunner.Shutdown(); debugRunner = null; } if (null != internalWorker) { // @TODO(Ben): Perhaps cancellation is needed? internalWorker = null; } //Fix DG-1464973 Sprint25: rev 3444 : Multiple import issue - dispose core after execution //Core Cleanup should happen only after execution has finished, //DebugRunner is ShutDown. if (null != this.core) { this.core.Cleanup(); this.core = null; } workerParams.ResetStates(); SetExecutionState(ExecutionStateChangedEventArgs.States.None); }
static void DevRun() { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); var opts = new Options(); opts.ExecutionMode = ExecutionMode.Serial; ProtoCore.Core core = new Core(opts); core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core)); core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core)); #if DEBUG core.Options.DumpByteCode = true; core.Options.Verbose = true; #else core.Options.DumpByteCode = false; core.Options.Verbose = false; #endif #if __RUN_TEST_FILE ProtoFFI.DLLFFIHandler.Register(ProtoFFI.FFILanguage.CSharp, new ProtoFFI.CSModuleHelper()); ProtoScriptTestRunner runner = new ProtoScriptTestRunner(); ExecutionMirror mirror = runner.LoadAndExecute(@"c:\jun\AutodeskResearch\git\designscript\Scripts\jun.ds", core); #else /* * var runnerConfig = new ProtoScript.Config.RunConfiguration(); * runnerConfig.IsParrallel = false; * var fsr = new ProtoScript.Runners.DebugRunner(core); * fsr.LoadAndPreStart(@"c:\project\designscript\test.ds", runnerConfig); * fsr.Run(); */ //ProtoTest.TD.OtherMiscTests.MiscTest test = new ProtoTest.TD.OtherMiscTests.MiscTest(); //test.TestDynamicSetValueAfterExecution(); //ProtoTest.DebugTests.RunEqualityTests test = new ProtoTest.DebugTests.RunEqualityTests(); //test.DebugTest_Jun_ReplicationGuide(); //ProtoTest.Associative.MicroFeatureTests test = new ProtoTest.Associative.MicroFeatureTests(); //test.Setup(); //test.TestContextInject01(); ProtoFFITests.ContextInjectionTests test = new ProtoFFITests.ContextInjectionTests(); test.Setup(); test.TestContextInjectDummy(); //ProtoTest.Associative.MethodsFocusTeam test = new ProtoTest.Associative.MethodsFocusTeam(); //test.Setup(); //test.T014_DotOp_UserDefinedClass_03(); #endif long ms = sw.ElapsedMilliseconds; sw.Stop(); Console.WriteLine(ms); Console.ReadLine(); }
public override void Setup() { base.Setup(); coreRunner = new ProtoScript.Runners.ProtoScriptTestRunner(); }
public static void Main(string[] args) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); var opts = new Options(); if (args.Length == 0) { opts.WebRunner = false; } else { opts.WebRunner = true; } opts.ExecutionMode = ExecutionMode.Serial; ProtoCore.Core core = new Core(opts); core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core)); core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core)); if (!opts.WebRunner) { ProtoScriptTestRunner runner = new ProtoScriptTestRunner(); DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper()); ExecutionMirror mirror = runner.LoadAndExecute(@"..\..\..\Scripts\defectverify.ds", core); string str = mirror.GetCoreDump(); //Console.WriteLine(str); } else //if (arg) { // @TODO(Gemeng): Do set "core.ExecutionLog" to some file :) ProtoScriptWebRunner runner = new ProtoScriptWebRunner(); DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper()); ExecutionMirror mirror = runner.LoadAndExecute(args[0], core); if (null != mirror) { string str = mirror.GetCoreDump(); // core.coreDumpWriter.WriteLine(str); } // @TODO(Gemeng): 'coreDumpWriter' has been removed, instead of // doing that we should create an output file stream here with a // file name, and then write the "str" content into it. // // core.coreDumpWriter.Close(); } //runner.LoadAndExecute(@"..\..\..\Scripts\array.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\arrayargs.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\class.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\class2.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\class3.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\class4.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\class5.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\class6.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\class7.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\class8.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\class9.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\class10.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\demo.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\expr.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\fusionarray.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\replication.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\simple.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\simple2.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\functionoverload.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\classfunctionoverload.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\inheritance.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\inheritance2.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\update.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\null.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\forloop.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\blockassign_imperative.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\blockassign_associative.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\test.ds", core); //runner.LoadAndExecute(@"..\..\..\Scripts\importtest.ds", core); //ExecutionMirror mirror = null; //string str = mirror.GetCoreDump(); long ms = sw.ElapsedMilliseconds; sw.Stop(); if (!opts.WebRunner) { Console.WriteLine(ms); Console.ReadLine(); } }
private void InitRunner(Options options) { graphCompiler = GraphToDSCompiler.GraphCompiler.CreateInstance(); graphCompiler.SetCore(GraphUtilities.GetCore()); runner = new ProtoScriptTestRunner(); executionOptions = options; InitOptions(); InitCore(); taskQueue = new Queue<Task>(); workerThread = new Thread(new ThreadStart(TaskExecMethod)); workerThread.IsBackground = true; workerThread.Start(); staticContext = new ProtoCore.CompileTime.Context(); }
public TestFrameWork() { runner = new ProtoScriptTestRunner(); }