Пример #1
2
        static void Main(string[] args)
        {
            var xEngine = new Engine();

            DefaultEngineConfiguration.Apply(xEngine);

            var xOutputXml = new OutputHandlerXml();
            xEngine.OutputHandler = new MultiplexingOutputHandler(
                xOutputXml,
                new OutputHandlerFullConsole());

            xEngine.Execute();

            global::System.Console.WriteLine("Do you want to save test run details?");
            global::System.Console.Write("Type yes, or nothing to just exit: ");
            var xResult = global::System.Console.ReadLine();
            if (xResult != null && xResult.Equals("yes", StringComparison.OrdinalIgnoreCase))
            {
                var xSaveDialog = new SaveFileDialog();
                xSaveDialog.Filter = "XML documents|*.xml";
                if (xSaveDialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                xOutputXml.SaveToFile(xSaveDialog.FileName);
            }
        }
        public static void Apply(Engine engine)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }

            engine.AllowedSecondsInKernel = 120;

            // If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are ran.
            // engine.RunTargets.Add(RunTargetEnum.Bochs);

            // if you're working on the compiler (or other lower parts), you can choose to run the compiler in process
            // 1 thing to keep in mind though, is that this only works with 1 kernel at a time!
            engine.RunIL2CPUInProcess = false;

            engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
            engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
            engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);
            engine.AddKernel(typeof(BoxingTests.Kernel).Assembly.Location);
            // known bugs, therefor disabled for now:

            // end of known bugs

            // double check: this check is in the engine, but lets put it here as well
            if (engine.RunIL2CPUInProcess)
            {
                if (engine.KernelsToRun.Count() > 1)
                {
                    throw new InvalidOperationException("Can only run 1 kernel if IL2CPU is ran in-process!");
                }
            }
        }
Пример #3
0
        public void Test([ValueSource(typeof(MySource), nameof(MySource.ProvideData))] Type kernelToRun)
        {
            var xEngine = new Engine();
            // Sets the time before an error is registered. For example if set to 60 then if a kernel runs for more than 60 seconds then
            // that kernel will be marked as a failiure and terminated
            xEngine.AllowedSecondsInKernel = 1800;

            // If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are run.
            xEngine.RunTargets.Add(RunTargetEnum.Bochs);

            // If you're working on the compiler (or other lower parts), you can choose to run the compiler in process
            // one thing to keep in mind though, is that this only works with 1 kernel at a time!
            xEngine.RunIL2CPUInProcess = false;
            xEngine.TraceAssembliesLevel = TraceAssemblies.User;
            xEngine.EnableStackCorruptionChecks = true;
            xEngine.StackCorruptionChecksLevel = StackCorruptionDetectionLevel.AllInstructions;

            // Select kernels to be tested by adding them to the engine
            xEngine.AddKernel(kernelToRun.Assembly.Location);

            xEngine.OutputHandler = new TestOutputHandler();

            Assert.IsTrue(xEngine.Execute());

        }
Пример #4
0
        public static void Apply(Engine engine)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }

            // Sets the time before an error is registered. For example if set to 60 then if a kernel runs for more than 60 seconds then
            // that kernel will be marked as a failure and terminated
            engine.AllowedSecondsInKernel = 300;

            // If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are run.
            engine.RunTargets.Add(RunTargetEnum.Bochs);
            //engine.RunTargets.Add(RunTargetEnum.VMware);

            // If you're working on the compiler (or other lower parts), you can choose to run the compiler in process
            // one thing to keep in mind though, is that this only works with 1 kernel at a time!
            //engine.RunIL2CPUInProcess = true;
            engine.TraceAssembliesLevel = TraceAssemblies.User;
            //engine.EnableStackCorruptionChecks = false;

            engine.EnableStackCorruptionChecks = true;
            engine.StackCorruptionChecksLevel = StackCorruptionDetectionLevel.AllInstructions;

            //engine.RunWithGDB = true;
            //engine.StartBochsDebugGui = true;

            // Select kernels to be tested by adding them to the engine
            foreach (var xType in TestKernelSets.GetStableKernelTypes())
            {
                engine.AddKernel(xType.Assembly.Location);
            }

            //engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);
            //engine.AddKernel(typeof(Cosmos.Compiler.Tests.Bcl.Kernel).Assembly.Location);
            //engine.AddKernel(typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel).Assembly.Location);
            //engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
            //engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
            //engine.AddKernel(typeof(Cosmos.Compiler.Tests.Exceptions.Kernel).Assembly.Location);
            //engine.AddKernel(typeof(Cosmos.Compiler.Tests.MethodTests.Kernel).Assembly.Location);
            //engine.AddKernel(typeof(Cosmos.Kernel.Tests.Fat.Kernel).Assembly.Location);

            // Known bugs, therefore disabled for now:
            //engine.AddKernel(typeof(BoxingTests.Kernel).Assembly.Location);
            //engine.AddKernel(typeof(Cosmos.Compiler.Tests.MultidimensionalArrays.Kernel).Assembly.Location);

            // Experimental stuff:

            // end of known bugs

            // double check: this check is in the engine, but lets put it here as well
            if (engine.RunIL2CPUInProcess)
            {
                if (engine.KernelsToRun.Count() > 1 || engine.RunTargets.Count == 0 || engine.RunTargets.Count > 1)
                {
                    throw new InvalidOperationException("Can only run 1 kernel if IL2CPU is ran in-process!");
                }
            }
        }
Пример #5
0
        static void Main(string[] args)
        {
            var xEngine = new Engine();

            DefaultEngineConfiguration.Apply(xEngine);

            xEngine.OutputHandler = new OutputHandlerXml(@"c:\data\CosmosTests.xml");
            //xEngine.OutputHandler = new OutputHandlerConsole();
            xEngine.Execute();
        }
Пример #6
0
        public static void Apply(Engine engine)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }

            engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
            engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
            engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);

            // known bugs, therefor disabled for now:
        }
        private void TestEngineThreadMain()
        {
            var xEngine = new Engine();

            DefaultEngineConfiguration.Apply(xEngine);

            var xOutputXml = new OutputHandlerXml();
            xEngine.OutputHandler = new MultiplexingOutputHandler(
                xOutputXml,
                this);

            xEngine.Execute();
        }
Пример #8
0
        static void Main(string[] args)
        {
            var xEngine = new Engine();

            xEngine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
            //xEngine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);

            // known bugs, therefor disabled for now:
            //xEngine.AddKernel(typeof(Cosmos.Compiler.Tests.Interfaces.Kernel.Kernel).Assembly.Location);

            xEngine.OutputHandler = new OutputHandlerXml(@"c:\data\CosmosTests.xml");
            //xEngine.OutputHandler = new OutputHandlerConsole();
            xEngine.Execute();
        }
Пример #9
0
        public void Test(Type kernelToRun)
        {
            try
            {
                Environment.CurrentDirectory = Path.GetDirectoryName(typeof(RunKernels).Assembly.Location);

                var xEngine = new Engine();

                // Sets the time before an error is registered. For example if set to 60 then if a kernel runs for more than 60 seconds then
                // that kernel will be marked as a failure and terminated
                xEngine.AllowedSecondsInKernel = 1200;

                // If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are run.
                xEngine.RunTargets.Add(RunTargetEnum.Bochs);

                //xEngine.StartBochsDebugGui = false;
                //xEngine.RunWithGDB = true;
                // If you're working on the compiler (or other lower parts), you can choose to run the compiler in process
                // one thing to keep in mind though, is that this only works with 1 kernel at a time!
                //xEngine.RunIL2CPUInProcess = true;
                xEngine.TraceAssembliesLevel = TraceAssemblies.User;

                xEngine.EnableStackCorruptionChecks = true;
                xEngine.StackCorruptionChecksLevel = StackCorruptionDetectionLevel.AllInstructions;

                // Select kernels to be tested by adding them to the engine
                xEngine.AddKernel(kernelToRun.Assembly.Location);

                xEngine.OutputHandler = new TestOutputHandler();

                Assert.IsTrue(xEngine.Execute());
            }
            catch (AssertionException)
            {
                throw;
            }
            catch(Exception E)
            {
                Console.WriteLine("Exception occurred: " + E.ToString());
                Assert.Fail();
            }
        }
Пример #10
0
        public static void Apply(Engine engine)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }

            engine.AllowedSecondsInKernel = 120;

            // If you want to exclude a testing platform, modify uncomment and modify the following line
            engine.RunTargets.Remove(RunTargetEnum.Bochs);

            // if you're working on the compiler (or other lower parts), you can choose to run the compiler in process
            // 1 thing to keep in mind though, is that this only works with 1 kernel at a time!
            engine.RunIL2CPUInProcess = true;

            engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
            //engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
            //engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);

            // known bugs, therefor disabled for now:
        }