forked from dotnet/command-line-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
38 lines (34 loc) · 1.41 KB
/
Program.cs
File metadata and controls
38 lines (34 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using BenchmarkDotNet.Running;
using System.Linq;
using BenchmarkDotNet.Configs;
using System.Collections.Immutable;
using System.IO;
namespace System.CommandLine.Benchmarks
{
class Program
{
static int Main(string[] args)
{
var result = BenchmarkSwitcher
.FromAssembly(typeof(Program).Assembly)
#if DEBUG
.Run(args, new DebugInProcessConfig());
Console.ReadLine();
#else
.Run(args, RecommendedConfig.Create(
artifactsPath: new DirectoryInfo(Path.Combine(
Path.GetDirectoryName(typeof(Program).Assembly.Location), "BenchmarkDotNet.Artifacts")),
mandatoryCategories: ImmutableHashSet.Create(Categories.CommandLine, Categories.DragonFruit)));
#endif
// an empty summary means that initial filtering and validation did not allow to run
if (!result.Any())
return 1;
// if anything has failed, it's an error
if (result.Any(summary => summary.HasCriticalValidationErrors || summary.Reports.Any(report => !report.BuildResult.IsBuildSuccess || !report.ExecuteResults.Any())))
return 1;
return 0;
}
}
}