Exemple #1
0
        public void BuildProjectFromPerfSuite(string name, ProjectPerfOperation operation)
        {
            string sourceProject = Path.Combine(@"C:\MSBPerf\3", name);
            var    testDir       = _testAssetsManager.CreateTestDirectory("Perf_" + name, identifier: operation.ToString());

            FolderSnapshot.MirrorFiles(sourceProject, testDir.Path);

            //  The generated projects target .NET Core 2.1, retarget them to .NET Core 2.0
            foreach (var projFile in Directory.GetFiles(testDir.Path, "*.csproj", SearchOption.AllDirectories))
            {
                var project = XDocument.Load(projFile);
                var ns      = project.Root.Name.Namespace;

                //  Find both TargetFramework and TargetFrameworks elements
                var targetFrameworkElements = project.Root.Elements(ns + "PropertyGroup").Elements("TargetFramework");
                targetFrameworkElements = targetFrameworkElements.Concat(project.Root.Elements(ns + "PropertyGroup").Elements("TargetFrameworks"));

                foreach (var tfElement in targetFrameworkElements)
                {
                    tfElement.Value = tfElement.Value.Replace("netcoreapp2.1", "netcoreapp2.0");
                }

                project.Save(projFile);
            }

            TestProject(testDir.Path, name, operation);
        }
Exemple #2
0
        public void BuildRoslynCompilers(ProjectPerfOperation operation)
        {
            string sourceProject = @"C:\git\roslyn";
            var    testDir       = _testAssetsManager.CreateTestDirectory("Perf_Roslyn", identifier: operation.ToString());

            Console.WriteLine($"Mirroring {sourceProject} to {testDir.Path}...");
            FolderSnapshot.MirrorFiles(sourceProject, testDir.Path);
            TestContext.Current.WriteGlobalJson(testDir.Path);
            Console.WriteLine("Done");

            //  Override global.json from repo
            File.Delete(Path.Combine(testDir.Path, "global.json"));

            //  Run Roslyn's restore script
            var restoreCmd = new SdkCommandSpec()
            {
                FileName         = Path.Combine(testDir.Path, "Restore.cmd"),
                WorkingDirectory = testDir.Path
            };

            TestContext.Current.AddTestEnvironmentVariables(restoreCmd);
            restoreCmd.ToCommand().Execute().Should().Pass();

            TestProject(Path.Combine(testDir.Path, "Compilers.sln"), "Roslyn", operation);
        }
Exemple #3
0
        private void TestProjectFromPerfTestSourceRepository(
            ProjectPerfOperation operation,
            string testName,
            string solutionDirectoryNameInPerfTestRepo,
            string projectDirectoryName = null)
        {
            string sourceProject = Path.Combine(
                TestContext.GetRepoRoot(),
                $".perftestsource/PerformanceTestProjects/{solutionDirectoryNameInPerfTestRepo}");

            var testDir = _testAssetsManager.CreateTestDirectory(
                solutionDirectoryNameInPerfTestRepo,
                identifier: operation.ToString());

            Console.WriteLine($"Mirroring {sourceProject} to {testDir}...");
            FolderSnapshot.MirrorFiles(sourceProject, testDir.Path);
            TestContext.Current.WriteGlobalJson(testDir.Path);
            Console.WriteLine("Done");

            string projectFolderOrFile =
                projectDirectoryName != null
                ? Path.Combine(testDir.Path, projectDirectoryName)
                : testDir.Path;

            TestProject(projectFolderOrFile, testName, operation);
        }
Exemple #4
0
        public void BuildWebLarge30(ProjectPerfOperation operation)
        {
            string sourceProject = Path.Combine(TestContext.GetRepoRoot(), ".perftestsource/PerformanceTestProjects/WebLarge30");
            var    testDir       = _testAssetsManager.CreateTestDirectory("WebLarge30", identifier: operation.ToString());

            Console.WriteLine($"Mirroring {sourceProject} to {testDir}...");
            FolderSnapshot.MirrorFiles(sourceProject, testDir.Path);
            Console.WriteLine("Done");

            TestProject(Path.Combine(testDir.Path, "mvc"), "Build Web Large 3.0", operation);
        }