Exemplo n.º 1
0
        async Task DownloadAndExtractTextCorpus(DotNetInstallation dotNetInstall, string outputDir, ITestOutputHelper output)
        {
            // If the file already exists, exit
            string word2VecNetRepoRootDir = GetWord2VecNetRepoRootDir(outputDir);
            string tfm = DotNetSetup.GetTargetFrameworkMonikerForFrameworkVersion(dotNetInstall.FrameworkVersion);
            string word2VecNetPublishDir = GetWord2VecNetPublishDirectory(dotNetInstall, outputDir, tfm);

            // Download the corpus of text. This is a zip file that contains a text file of 100M of text from Wikipedia
            var url = "https://perfbenchmarkstorage.blob.core.windows.net/corpus/Corpus10.zip";
            await FileTasks.DownloadAndUnzip(url, word2VecNetRepoRootDir + "_temp", output);

            FileTasks.MoveFile(Path.Combine(word2VecNetRepoRootDir + "_temp", "Corpus.txt"),
                               Path.Combine(word2VecNetPublishDir, "Corpus.txt"), output);
        }
        protected override async Task SetupSourceToCompile(string intermediateOutputDir, string runtimeDirPath, bool useExistingSetup, ITestOutputHelper output)
        {
            string cscSourceDownloadLink = "https://roslyninfra.blob.core.windows.net/perf-artifacts/CodeAnalysisRepro" +
                                           (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".zip" : ".tar.gz");
            string sourceDownloadDir = Path.Combine(intermediateOutputDir, "roslynSource");
            string sourceDir         = Path.Combine(sourceDownloadDir, "CodeAnalysisRepro");

            CommandLineArguments = "@repro.rsp";
            WorkingDirPath       = sourceDir;
            if (useExistingSetup)
            {
                return;
            }

            await FileTasks.DownloadAndUnzip(cscSourceDownloadLink, sourceDownloadDir, output);
        }
Exemplo n.º 3
0
        async public Task <DotNetInstallation> Run(ITestOutputHelper output)
        {
            using (var acquireOutput = new IndentedTestOutputHelper("Acquiring DotNet", output))
            {
                string remoteSdkPath = GetSDKDownloadLink();
                if (remoteSdkPath != null)
                {
                    await FileTasks.DownloadAndUnzip(remoteSdkPath, DotNetDirPath, acquireOutput);
                }
                string remoteRuntimePath = GetFrameworkDownloadLink();
                if (remoteRuntimePath != null)
                {
                    await FileTasks.DownloadAndUnzip(remoteRuntimePath, DotNetDirPath, acquireOutput);

                    // the SDK may have included another runtime version, but to help prevent mistakes
                    // where a test might run against a different version than we intended all other
                    // versions will be deleted.
                    string mnappDirPath = Path.Combine(DotNetDirPath, "shared", "Microsoft.NETCore.App");
                    foreach (string dir in Directory.GetDirectories(mnappDirPath))
                    {
                        string versionDir = Path.GetFileName(dir);
                        if (versionDir != FrameworkVersion)
                        {
                            FileTasks.DeleteDirectory(dir, acquireOutput);
                        }
                    }
                }
                string actualFrameworkVersion = FrameworkVersion;
                if (actualFrameworkVersion == null)
                {
                    //if Framework version is being infered from an SDK then snoop the filesystem to see what got installed
                    foreach (string dirPath in Directory.EnumerateDirectories(Path.Combine(DotNetDirPath, "shared", "Microsoft.NETCore.App")))
                    {
                        actualFrameworkVersion = Path.GetFileName(dirPath);
                        break;
                    }
                }


                DotNetInstallation result = new DotNetInstallation(DotNetDirPath, actualFrameworkVersion, SdkVersion, Architecture);
                acquireOutput.WriteLine("Dotnet path: " + result.DotNetExe);
                if (!File.Exists(result.DotNetExe))
                {
                    throw new FileNotFoundException(result.DotNetExe + " not found");
                }
                if (result.SdkVersion != null)
                {
                    if (!Directory.Exists(result.SdkDir))
                    {
                        throw new DirectoryNotFoundException("Sdk directory " + result.SdkDir + " not found");
                    }
                }
                if (result.FrameworkVersion != null)
                {
                    if (!Directory.Exists(result.FrameworkDir))
                    {
                        throw new DirectoryNotFoundException("Framework directory " + result.FrameworkDir + " not found");
                    }

                    //overlay private binaries if needed
                    if (PrivateRuntimeBinaryDirPath != null)
                    {
                        foreach (string fileName in GetPrivateRuntimeOverlayBinaryNames(OS))
                        {
                            string backupPath     = Path.Combine(result.FrameworkDir, fileName + ".original");
                            string overwritePath  = Path.Combine(result.FrameworkDir, fileName);
                            string privateBinPath = Path.Combine(PrivateRuntimeBinaryDirPath, fileName);
                            if (!File.Exists(backupPath))
                            {
                                File.Copy(overwritePath, backupPath);
                            }
                            if (!File.Exists(privateBinPath))
                            {
                                throw new FileNotFoundException("Private binary " + privateBinPath + " not found");
                            }
                            File.Copy(privateBinPath, overwritePath, true);
                        }
                    }
                }
                return(result);
            }
        }