<commit_before>﻿using System;
using Cosmos.Build.Common;
using Cosmos.TestRunner.Core;
using NUnit.Framework;

namespace DebugCompiler
{
    [TestFixture]
    public class RunKernels
    {
        [Test]
        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
            foreach (var xType in TestKernelSets.GetStableKernelTypes())
            {
                xEngine.AddKernel(xType.Assembly.Location);
            }

            xEngine.OutputHandler = new TestOutputHandler();

            Assert.IsTrue(xEngine.Execute());

        }

        private class TestOutputHandler: OutputHandlerFullTextBase<commit_msg>Only run 1 kernel at a time..<commit_after>﻿using System;
using Cosmos.Build.Common;
using Cosmos.TestRunner.Core;
using NUnit.Framework;

namespace DebugCompiler
{
    [TestFixture]
    public class RunKernels
    {
        [Test]
        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());

        }

        private class TestOutputHandler: OutputHandlerFullTextBase
{'fraction_non_alphanumeric': 0.06385506385506386, 'fraction_numerical': 0.006237006237006237, 'mean_word_length': 2.4829369183040333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1997399', 'n_tokens_mistral': 879, 'n_tokens_neox': 838, 'n_words': 310}