public void CustomClrBuildJobsAreGroupedByVersion()
        {
            const string version = "abcd";

            var config = ManualConfig.Create(DefaultConfig.Instance)
                         .With(Job.Default.With(ClrRuntime.CreateForLocalFullNetFrameworkBuild(version: version)))
                         .With(Job.Default.With(ClrRuntime.CreateForLocalFullNetFrameworkBuild(version: "it's a different version")))
                         .With(Job.Default.With(ClrRuntime.GetCurrentVersion()));

            var benchmarks1 = BenchmarkConverter.TypeToBenchmarks(typeof(Plain1), config);
            var benchmarks2 = BenchmarkConverter.TypeToBenchmarks(typeof(Plain2), config);

            var grouped = benchmarks1.BenchmarksCases.Union(benchmarks2.BenchmarksCases)
                          .GroupBy(benchmark => benchmark, new BenchmarkPartitioner.BenchmarkRuntimePropertiesComparer())
                          .ToArray();

            Assert.Equal(3, grouped.Length); // Job.Clr + Job.Clr(version) + Job.Clr(different)

            foreach (var grouping in grouped)
            {
                Assert.Equal(3 * 2, grouping.Count()); // (M1 + M2 + M3) * (Plain1 + Plain2)
            }
        }
예제 #2
0
        public void RemovesStartupSettingsForPrivateBuildsOfClr()
        {
            const string input =
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                "<configuration>" +
                "<startup><supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.6.1\" /></startup>" +
                "</configuration>";

            string withoutStartup =
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                "<configuration>" +
                "<runtime/>" +
                "</configuration>" + Environment.NewLine;

            using (var source = new StringReader(input))
                using (var destination = new Utf8StringWriter())
                {
                    AppConfigGenerator.Generate(new Job {
                        Environment = { Runtime = ClrRuntime.CreateForLocalFullNetFrameworkBuild(version: "4.0") }
                    }.Freeze(), source, destination, Resolver);

                    AssertAreEqualIgnoringWhitespacesAndCase(withoutStartup, destination.ToString());
                }
        }