Пример #1
0
        public TestRuntime(Driver/*!*/ driver, TestCase/*!*/ testCase) {
            _driver = driver;
            _testName = testCase.Name;

            if (testCase.Options.NoRuntime) {
                return;
            }

            if (_driver.SaveToAssemblies) {
                Environment.SetEnvironmentVariable("DLR_AssembliesFileName", _testName);
            }

            var runtimeSetup = ScriptRuntimeSetup.ReadConfiguration();
            var languageSetup = runtimeSetup.AddRubySetup();

            runtimeSetup.DebugMode = _driver.IsDebug;
            runtimeSetup.PrivateBinding = testCase.Options.PrivateBinding;
            languageSetup.Options["NoAdaptiveCompilation"] = _driver.NoAdaptiveCompilation;
            languageSetup.Options["Verbosity"] = 2;
            languageSetup.Options["Compatibility"] = testCase.Options.Compatibility;

            _runtime = Ruby.CreateRuntime(runtimeSetup);
            _engine = Ruby.GetEngine(_runtime);
            _context = Ruby.GetExecutionContext(_engine);
        }
Пример #2
0
        public TestRuntime(Driver/*!*/ driver, TestCase/*!*/ testCase) {
            _driver = driver;
            _testName = testCase.Name;

            if (_driver.SaveToAssemblies) {
                Environment.SetEnvironmentVariable("DLR_AssembliesFileName", _testName);
            }

            var runtimeSetup = ScriptRuntimeSetup.ReadConfiguration();
            LanguageSetup languageSetup = null;
            foreach (var language in runtimeSetup.LanguageSetups) {
                if (language.TypeName == typeof(RubyContext).AssemblyQualifiedName) {
                    languageSetup = language;
                    break;
                }
            }

            runtimeSetup.DebugMode = _driver.IsDebug;
            languageSetup.Options["InterpretedMode"] = _driver.Interpret;
            languageSetup.Options["Verbosity"] = 2;
            languageSetup.Options["Compatibility"] = testCase.Compatibility;

            _env = Ruby.CreateRuntime(runtimeSetup);
            _engine = Ruby.GetEngine(_env);
            _context = Ruby.GetExecutionContext(_engine);
        }
Пример #3
0
        public TestRuntime(Driver/*!*/ driver, TestCase/*!*/ testCase) {
            _driver = driver;
            _testName = testCase.Name;

            if (testCase.Options.NoRuntime) {
                return;
            }

            if (_driver.SaveToAssemblies) {
                Environment.SetEnvironmentVariable("DLR_AssembliesFileName", _testName);
            }

            var runtimeSetup = ScriptRuntimeSetup.ReadConfiguration();
            var languageSetup = runtimeSetup.AddRubySetup();

            runtimeSetup.DebugMode = _driver.IsDebug;
            runtimeSetup.PrivateBinding = testCase.Options.PrivateBinding;
            runtimeSetup.HostType = typeof(TestHost);
            runtimeSetup.HostArguments = new object[] { testCase.Options };
            languageSetup.Options["NoAdaptiveCompilation"] = _driver.NoAdaptiveCompilation;
            languageSetup.Options["CompilationThreshold"] = _driver.CompilationThreshold;
            languageSetup.Options["Verbosity"] = 2;
            languageSetup.Options["Compatibility"] = testCase.Options.Compatibility;

            _runtime = Ruby.CreateRuntime(runtimeSetup);
            _engine = Ruby.GetEngine(_runtime);
            _context = (RubyContext)HostingHelpers.GetLanguageContext(_engine);
        }
Пример #4
0
        private void RunTestCase(TestCase/*!*/ testCase) {
            _testRuntime = new TestRuntime(this, testCase);

            Console.WriteLine("Executing {0}", testCase.Name);

            try {
                testCase.TestMethod();
            } catch (Exception e) {
                PrintTestCaseFailed();
                _unexpectedExceptions.Add(new Tuple<string, Exception>(testCase.Name, e));
            } finally {
                Snippets.SaveAndVerifyAssemblies();
            }
        }
Пример #5
0
        private void RunTestCase(TestCase/*!*/ testCase, ref int failedCount) {
            _testRuntime = new TestRuntime(this, testCase);

            Console.WriteLine("Executing {0}", testCase.Name);

            try {
                testCase.TestMethod();
            } catch (Exception e) {
                Console.Error.WriteLine(e);
                failedCount++;
            } finally {
                Snippets.SaveAndVerifyAssemblies();
            }
        }
Пример #6
0
        public TestRuntime(Driver/*!*/ driver, TestCase/*!*/ testCase)
        {
            _driver = driver;
            _testName = testCase.Name;

            if (testCase.Options.NoRuntime) {
                return;
            }

            #if !WIN8
            if (_driver.SaveToAssemblies) {
                Environment.SetEnvironmentVariable("DLR_AssembliesFileName", _testName);
            }
            #endif
            _engine = _driver.CreateRubyEngine(testCase.Options.PrivateBinding, testCase.Options);
            _runtime = _engine.Runtime;
            _context = (RubyContext)HostingHelpers.GetLanguageContext(_engine);
        }
Пример #7
0
        private void RunTestCase(TestCase/*!*/ testCase)
        {
            _testRuntime = new TestRuntime(this, testCase);

            if (_verbose) {
                Output.WriteLine("Executing {0}", testCase.Name);
            } else {
                Output.Write('.');
            }

            try {
                testCase.TestMethod();
            } catch (Exception e) {
                PrintTestCaseFailed();
                _unexpectedExceptions.Add(new MutableTuple<string, Exception>(testCase.Name, e));
            } finally {
            #if !WIN8
                Snippets.SaveAndVerifyAssemblies();
            #endif
            }
        }