コード例 #1
0
        public void WhenBuildTakesMoreTimeThanTheTimeoutTheBuildIsCancelled()
        {
            if (!RuntimeInformation.Is64BitPlatform()) // NativeAOT does not support 32bit yet
            {
                return;
            }

            // we use NativeAOT 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()
                         .WithBuildTimeout(timeout)
                         .AddJob(Job.Dry
                                 .WithRuntime(NativeAotRuntime.Net60)
                                 .WithToolchain(NativeAotToolchain.CreateBuilder()
                                                .UseNuGet(
                                                    "6.0.0-rc.1.21420.1",                                                                          // we test against specific version to keep this test stable
                                                    "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json") // using old feed that supports net5.0
                                                .ToToolchain()));

            var summary = CanExecute <NativeAotBenchmark>(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));
        }
コード例 #2
0
        public void LatestNativeAotVersionIsSupported()
        {
            if (!RuntimeInformation.Is64BitPlatform()) // NativeAOT does not support 32bit yet
            {
                return;
            }
            if (ContinuousIntegration.IsGitHubActionsOnWindows()) // no native dependencies installed
            {
                return;
            }
            if (ContinuousIntegration.IsAppVeyorOnWindows()) // too time consuming for AppVeyor (1h limit)
            {
                return;
            }
            if (NativeAotRuntime.GetCurrentVersion().RuntimeMoniker < RuntimeMoniker.NativeAot70) // we can't target net6.0 and use .NET 7 ILCompiler anymore (#2080)
            {
                return;
            }

            var toolchain = NativeAotToolchain.CreateBuilder().UseNuGet().IlcInstructionSet(IsAvx2Supported() ? "avx2" : "").ToToolchain();

            var config = ManualConfig.CreateEmpty()
                         .AddJob(Job.Dry
                                 .WithRuntime(NativeAotRuntime.GetCurrentVersion()) // we test against latest version for current TFM to make sure we avoid issues like #1055
                                 .WithToolchain(toolchain)
                                 .WithEnvironmentVariable(NativeAotBenchmark.EnvVarKey, IsAvx2Supported().ToString().ToLower()));

            CanExecute <NativeAotBenchmark>(config);
        }
コード例 #3
0
        private static IntPtr FixAffinity(IntPtr processorAffinity)
        {
            int cpuMask = (1 << Environment.ProcessorCount) - 1;

            return(RuntimeInformation.Is64BitPlatform()
                ? new IntPtr(processorAffinity.ToInt64() & cpuMask)
                : new IntPtr(processorAffinity.ToInt32() & cpuMask));
        }
コード例 #4
0
        public void LatestCoreRtVersionIsSupported()
        {
            if (!RuntimeInformation.Is64BitPlatform()) // CoreRT does not support 32bit yet
            {
                return;
            }

            var config = ManualConfig.CreateEmpty()
                         .AddJob(Job.Dry
                                 .WithRuntime(CoreRtRuntime.GetCurrentVersion())); // we test against latest version for current TFM to make sure we avoid issues like #1055

            CanExecute <CoreRtBenchmark>(config);
        }
コード例 #5
0
            public Config()
            {
                var wrongPlatform = RuntimeInformation.Is64BitPlatform()
                    ? Platform.X64
                    : Platform.X86;

                Add(Job.MediumRun
                    .WithLaunchCount(1)
                    .With(wrongPlatform)
                    .With(InProcessToolchain.Instance)
                    .WithId("InProcess"));

                Add(InProcessValidator.DontFailOnError);
            }
コード例 #6
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);
        }
コード例 #7
0
        public void CoreRtIsSupported()
        {
            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-26414-01") // we test against specific version to keep this test stable
                                     .ToToolchain()));

            CanExecute <CoreRtBenchmark>(config);
        }
コード例 #8
0
        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));
        }
コード例 #9
0
 internal static string ToPresentation(this IntPtr processorAffinity, int processorCount)
 => (RuntimeInformation.Is64BitPlatform()
             ? Convert.ToString(processorAffinity.ToInt64(), 2)
             : Convert.ToString(processorAffinity.ToInt32(), 2))
 .PadLeft(processorCount, '0');