示例#1
0
        private async Task <string> Publish(DotNetInstallation dotNetInstall, string outputDir, ITestOutputHelper output)
        {
            string tfm        = DotNetSetup.GetTargetFrameworkMonikerForFrameworkVersion(dotNetInstall.FrameworkVersion);
            string publishDir = GetWord2VecNetPublishDirectory(dotNetInstall, outputDir, tfm);

            if (publishDir != null)
            {
                FileTasks.DeleteDirectory(publishDir, output);
            }
            string dotNetExePath = dotNetInstall.DotNetExe;

            await new ProcessRunner(dotNetExePath, $"publish -c Release -f {tfm}")
            .WithWorkingDirectory(GetWord2VecNetSrcDirectory(outputDir))
            .WithEnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0")
            .WithEnvironmentVariable("WORD2VEC_FRAMEWORK_VERSION", dotNetInstall.FrameworkVersion)
            .WithEnvironmentVariable("UseSharedCompilation", "false")
            .WithLog(output)
            .Run();

            publishDir = GetWord2VecNetPublishDirectory(dotNetInstall, outputDir, tfm);
            if (publishDir == null)
            {
                throw new DirectoryNotFoundException("Could not find 'publish' directory");
            }
            return(publishDir);
        }
示例#2
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);
        }
示例#3
0
        public override async Task Setup(DotNetInstallation dotNetInstall, string outputDir, bool useExistingSetup, ITestOutputHelper output)
        {
            if (!useExistingSetup)
            {
                using (var setupSection = new IndentedTestOutputHelper("Setup " + Name, output))
                {
                    await CloneWord2VecNetRepo(outputDir, setupSection);
                    await Publish(dotNetInstall, outputDir, setupSection);
                    await DownloadAndExtractTextCorpus(dotNetInstall, outputDir, setupSection);
                }
            }
            string tfm = DotNetSetup.GetTargetFrameworkMonikerForFrameworkVersion(dotNetInstall.FrameworkVersion);

            WorkingDirPath = GetWord2VecNetPublishDirectory(dotNetInstall, outputDir, tfm);
        }
示例#4
0
 async Task PrepareDotNet(ITestOutputHelper output)
 {
     if (!UseExistingSetup)
     {
         DotNetSetup setup = new DotNetSetup(Path.Combine(OutputDir, ".dotnet"))
                             .WithSdkVersion(DotnetSdkVersion)
                             .WithArchitecture(Architecture);
         if (DotnetFrameworkVersion != "use-sdk")
         {
             setup.WithFrameworkVersion(DotnetFrameworkVersion);
         }
         if (PrivateCoreCLRBinDir != null)
         {
             setup.WithPrivateRuntimeBinaryOverlay(PrivateCoreCLRBinDir);
         }
         DotNetInstallation = await setup.Run(output);
     }
     else
     {
         DotNetInstallation = new DotNetInstallation(Path.Combine(OutputDir, ".dotnet"), DotnetFrameworkVersion, DotnetSdkVersion, Architecture);
     }
 }
示例#5
0
        static TestRun ConfigureTestRun(CommandLineOptions options)
        {
            TestRun run = new TestRun()
            {
                OutputDir = GetInitialWorkingDir(),
                DotnetFrameworkVersion = options.MicrosoftNetCoreAppPackageVersion,
                Iterations             = 11
            };

            if (options.OutputDirectory != null)
            {
                run.OutputDir = options.OutputDirectory;
            }

            if (options.CoreCLRBinaryDir != null)
            {
                if (!Directory.Exists(options.CoreCLRBinaryDir))
                {
                    throw new Exception("coreclr-bin-dir directory " + options.CoreCLRBinaryDir + " does not exist");
                }
                run.PrivateCoreCLRBinDir = options.CoreCLRBinaryDir;
            }
            else
            {
                string coreRootEnv = Environment.GetEnvironmentVariable("CORE_ROOT");
                if (coreRootEnv != null)
                {
                    if (!Directory.Exists(coreRootEnv))
                    {
                        throw new Exception("CORE_ROOT directory " + coreRootEnv + " does not exist");
                    }
                    run.PrivateCoreCLRBinDir = coreRootEnv;
                }
                else
                {
                    //maybe we've got private coreclr binaries in our current directory? Use those if so.
                    string currentDirectory = Directory.GetCurrentDirectory();
                    if (File.Exists(Path.Combine(currentDirectory, "System.Private.CoreLib.dll")))
                    {
                        run.PrivateCoreCLRBinDir = currentDirectory;
                    }
                    else
                    {
                        // don't use private CoreCLR binaries
                    }
                }
            }

            if (options.DotnetFrameworkVersion != null)
            {
                run.DotnetFrameworkVersion = options.DotnetFrameworkVersion;
            }

            if (options.DotnetSdkVersion != null)
            {
                run.DotnetSdkVersion = options.DotnetSdkVersion;
            }
            else
            {
                run.DotnetSdkVersion = DotNetSetup.GetCompatibleDefaultSDKVersionForRuntimeVersion(run.DotnetFrameworkVersion);
            }


            if (options.TargetArchitecture != null)
            {
                if (options.TargetArchitecture.Equals("x64", StringComparison.OrdinalIgnoreCase))
                {
                    run.Architecture = Architecture.X64;
                }
                else if (options.TargetArchitecture.Equals("x86", StringComparison.OrdinalIgnoreCase))
                {
                    run.Architecture = Architecture.X86;
                }
                else
                {
                    throw new Exception("Unrecognized architecture " + options.TargetArchitecture);
                }
            }
            else
            {
                run.Architecture = RuntimeInformation.ProcessArchitecture;
            }

            if (options.Iterations > 0)
            {
                run.Iterations = (int)options.Iterations;
            }

            run.UseExistingSetup = options.UseExistingSetup;
            run.BenchviewRunId   = options.RunId ?? "Unofficial";
            run.MetricNames.AddRange(options.MetricNames);
            run.Benchmarks.AddRange(GetBenchmarkSelection(options));
            run.Configurations.AddRange(GetBenchmarkConfigurations(options));

            return(run);
        }