示例#1
0
        public static async Task Unzip(string zipPath, string expandedDirPath, bool deleteZippedFiles = true, string tempTarPath = null)
        {
            await FileTasks.UnWinZip(zipPath, expandedDirPath);

            if (deleteZippedFiles)
            {
                File.Delete(zipPath);
            }
        }
示例#2
0
        private static async Task Setup()
        {
            string cscSourceDownloadLink = "https://roslyninfra.blob.core.windows.net/perf-artifacts/CodeAnalysisReproWithAnalyzers.zip";
            string sourceDownloadDir     = Path.Combine(AppContext.BaseDirectory, "roslynSource");
            var    sourceDir             = Path.Combine(sourceDownloadDir, "CodeAnalysisReproWithAnalyzers");

            if (!Directory.Exists(sourceDir))
            {
                await FileTasks.DownloadAndUnzip(cscSourceDownloadLink, sourceDownloadDir);
            }

            // Benchmark.NET creates a new process to run the benchmark, so the easiest way
            // to communicate information is pass by environment variable
            Environment.SetEnvironmentVariable(Helpers.TestProjectEnvVarName, sourceDir);
        }
示例#3
0
        public static async Task Main()
        {
            var config = RecommendedConfig.Create(
                artifactsPath: new DirectoryInfo(Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), "BenchmarkDotNet.Artifacts")),
                mandatoryCategories: ImmutableHashSet.Create <string>("Roslyn"));

            string cscSourceDownloadLink = "https://roslyninfra.blob.core.windows.net/perf-artifacts/CodeAnalysisRepro.zip";
            string sourceDownloadDir     = Path.Combine(AppContext.BaseDirectory, "roslynSource");
            var    sourceDir             = Path.Combine(sourceDownloadDir, "CodeAnalysisRepro");

            if (!Directory.Exists(sourceDir))
            {
                await FileTasks.DownloadAndUnzip(cscSourceDownloadLink, sourceDownloadDir);
            }

            // Benchmark.NET creates a new process to run the benchmark, so the easiest way
            // to communicate information is pass by environment variable
            Environment.SetEnvironmentVariable(Helpers.TestProjectEnvVarName, sourceDir);

            _ = BenchmarkRunner.Run <StageBenchmarks>(config);
        }