Exemple #1
0
        public void CanBenchmarkLocalCoreRtUsingRyuJit()
        {
            var config = ManualConfig.CreateEmpty()
                         .With(Job.DryCoreRT.With(
                                   CoreRtToolchain.CreateBuilder()
                                   .UseCoreRtLocal(IlcPath)
                                   .ToToolchain()));

            CanExecute <CoreRtBenchmark>(config);
        }
Exemple #2
0
        public void CoreRtIsSupported()
        {
            var config = ManualConfig.CreateEmpty()
                         .With(Job.Dry
                               .With(Runtime.CoreRT)
                               .With(CoreRtToolchain.CreateBuilder()
                                     .UseCoreRtNuGet(microsoftDotNetILCompilerVersion: "1.0.0-alpha-26414-01") // we test against specific version to keep this test stable
                                     .ToToolchain()));

            CanExecute <CoreRtBenchmark>(config);
        }
Exemple #3
0
        public void CanBenchmarkLocalCoreRtUsingCppCodeGen()
        {
            var config = ManualConfig.CreateEmpty()
                         .With(Job.DryCoreRT.With(
                                   CoreRtToolchain.CreateBuilder()
                                   .UseCoreRtLocal(IlcPath)
                                   .UseCppCodeGenerator() // https://github.com/dotnet/corert/blob/7f902d4d8b1c3280e60f5e06c71951a60da173fb/Documentation/how-to-build-and-run-ilcompiler-in-console-shell-prompt.md#using-cpp-code-generator
                                   .ToToolchain()));

            CanExecute <CoreRtBenchmark>(config);
        }
Exemple #4
0
        public void LatestCoreRtVersionIsSupported()
        {
            if (!RuntimeInformation.Is64BitPlatform()) // CoreRT does not support 32bit yet
            {
                return;
            }

            var config = ManualConfig.CreateEmpty()
                         .With(Job.Dry
                               .With(Runtime.CoreRT)
                               .With(CoreRtToolchain.CreateBuilder()
                                     .UseCoreRtNuGet(microsoftDotNetILCompilerVersion: "1.0.0-alpha-*") // we test against latest version to make sure we support latest version and avoid issues like #1055
                                     .ToToolchain()));

            CanExecute <CoreRtBenchmark>(config);
        }
Exemple #5
0
        public void CoreRtIsSupported()
        {
            if (RuntimeInformation.GetCurrentPlatform() == Platform.X86) // CoreRT does not support 32bit yet
            {
                return;
            }

            var config = ManualConfig.CreateEmpty()
                         .With(Job.Dry
                               .With(Runtime.CoreRT)
                               .With(CoreRtToolchain.CreateBuilder()
                                     .UseCoreRtNuGet(microsoftDotNetILCompilerVersion: "1.0.0-alpha-26414-01") // we test against specific version to keep this test stable
                                     .ToToolchain()));

            CanExecute <CoreRtBenchmark>(config);
        }
        internal static IToolchain GetToolchain(this Runtime runtime, Descriptor descriptor = null, bool preferMsBuildToolchains = false)
        {
            switch (runtime)
            {
            case ClrRuntime clrRuntime:
                if (RuntimeInformation.IsNetCore || preferMsBuildToolchains)
                {
                    return(clrRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized
                            ? GetToolchain(clrRuntime.RuntimeMoniker)
                            : CsProjClassicNetToolchain.From(clrRuntime.MsBuildMoniker));
                }

                return(RoslynToolchain.Instance);

            case MonoRuntime mono:
                if (!string.IsNullOrEmpty(mono.AotArgs))
                {
                    return(MonoAotToolchain.Instance);
                }

                return(RoslynToolchain.Instance);

            case CoreRuntime coreRuntime:
                if (descriptor != null && descriptor.Type.Assembly.IsLinqPad())
                {
                    return(InProcessEmitToolchain.Instance);
                }
                if (coreRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized)
                {
                    return(GetToolchain(coreRuntime.RuntimeMoniker));
                }

                return(CsProjCoreToolchain.From(new DotNetCli.NetCoreAppSettings(coreRuntime.MsBuildMoniker, null, coreRuntime.Name)));

            case CoreRtRuntime coreRtRuntime:
                return(coreRtRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized
                            ? GetToolchain(coreRtRuntime.RuntimeMoniker)
                            : CoreRtToolchain.CreateBuilder().UseCoreRtNuGet().TargetFrameworkMoniker(coreRtRuntime.MsBuildMoniker).ToToolchain());

            default:
                throw new ArgumentOutOfRangeException(nameof(runtime), runtime, "Runtime not supported");
            }
        }
        public void WhenBuildTakesMoreTimeThanTheTimeoutTheBuildIsCancelled()
        {
            if (!RuntimeInformation.Is64BitPlatform()) // CoreRT does not support 32bit yet
            {
                return;
            }

            // we use CoreRT on purpose because it takes a LOT of time to build it
            // so we can be sure that timeout = 1s should fail!
            var timeout = TimeSpan.FromSeconds(1);

            var config = ManualConfig.CreateEmpty()
                         .AddJob(Job.Dry
                                 .WithRuntime(CoreRtRuntime.CoreRt21)
                                 .WithToolchain(CoreRtToolchain.CreateBuilder()
                                                .UseCoreRtNuGet(microsoftDotNetILCompilerVersion: "1.0.0-alpha-27408-02") // we test against specific version to keep this test stable
                                                .Timeout(timeout)
                                                .ToToolchain()));

            var summary = CanExecute <CoreRtBenchmark>(config, fullValidation: false);

            Assert.All(summary.Reports, report => Assert.False(report.BuildResult.IsBuildSuccess));
            Assert.All(summary.Reports, report => Assert.Contains("The configured timeout", report.BuildResult.ErrorMessage));
        }