@@ -20,10 +20,6 @@ namespace BenchmarkDotNet.Running
20
20
// so it can ignore the version mismatch ;)
21
21
public static class BenchmarkRunner
22
22
{
23
- private static readonly IUserInteraction userInteraction = new UserInteraction ( ) ;
24
- private static readonly List < Type > types = new List < Type > ( ) ;
25
- private static readonly List < Assembly > assemblies = new List < Assembly > ( ) ;
26
-
27
23
[ PublicAPI ]
28
24
public static Summary Run < T > ( IConfig config = null , string [ ] args = null )
29
25
{
@@ -84,6 +80,7 @@ public static Summary RunSource(string source, IConfig config = null)
84
80
private static Summary RunWithDirtyAssemblyResolveHelper ( Type type , IConfig config , string [ ] args )
85
81
{
86
82
var logger = config . GetNonNullCompositeLogger ( ) ;
83
+ var userInteraction = new UserInteraction ( ) ;
87
84
var ( isParsingSuccess , parsedConfig , options ) = ConfigParser . Parse ( args , logger , config ) ;
88
85
if ( ! isParsingSuccess ) // invalid console args, the ConfigParser printed the error
89
86
return null ;
@@ -96,8 +93,9 @@ private static Summary RunWithDirtyAssemblyResolveHelper(Type type, IConfig conf
96
93
97
94
var effectiveConfig = ManualConfig . Union ( config , parsedConfig ) ;
98
95
96
+ var types = new List < Type > ( ) ;
99
97
types . Add ( type ) ;
100
- var ( allTypesValid , allAvailableTypesWithRunnableBenchmarks ) = TypeFilter . GetTypesWithRunnableBenchmarks ( types , assemblies , logger ) ;
98
+ var ( allTypesValid , allAvailableTypesWithRunnableBenchmarks ) = TypeFilter . GetTypesWithRunnableBenchmarks ( types , new List < Assembly > ( ) , logger ) ;
101
99
if ( ! allTypesValid ) // there were some invalid and TypeFilter printed errors
102
100
return null ;
103
101
@@ -109,22 +107,15 @@ private static Summary RunWithDirtyAssemblyResolveHelper(Type type, IConfig conf
109
107
110
108
if ( options . ListBenchmarkCaseMode != ListBenchmarkCaseMode . Disabled )
111
109
{
112
- PrintList ( logger , effectiveConfig , allAvailableTypesWithRunnableBenchmarks , options ) ;
110
+ BenchmarkCasesPrinter . PrintList ( logger , effectiveConfig , allAvailableTypesWithRunnableBenchmarks , options ) ;
113
111
return null ;
114
112
}
115
113
116
- var benchmarksToFilter = options . UserProvidedFilters
117
- ? allAvailableTypesWithRunnableBenchmarks
118
- : userInteraction . AskUser ( allAvailableTypesWithRunnableBenchmarks , logger ) ;
119
-
120
- var filteredBenchmarks = TypeFilter . Filter ( effectiveConfig , benchmarksToFilter ) ;
121
-
122
- if ( filteredBenchmarks . IsEmpty ( ) )
123
- {
124
- return BenchmarkRunnerClean . Run ( new [ ] { BenchmarkConverter . TypeToBenchmarks ( type , config ) } ) . Single ( ) ;
125
- }
114
+ var benchmarks = options . UserProvidedFilters
115
+ ? TypeFilter . Filter ( effectiveConfig , allAvailableTypesWithRunnableBenchmarks )
116
+ : new BenchmarkRunInfo [ ] { BenchmarkConverter . TypeToBenchmarks ( type , config ) } ;
126
117
127
- return BenchmarkRunnerClean . Run ( filteredBenchmarks ) . Single ( ) ;
118
+ return BenchmarkRunnerClean . Run ( benchmarks ) . Single ( ) ;
128
119
}
129
120
130
121
@@ -177,16 +168,6 @@ private static Summary[] RunWithExceptionHandling(Func<Summary[]> run)
177
168
return new [ ] { Summary . NothingToRun ( e . Message , string . Empty , string . Empty ) } ;
178
169
}
179
170
}
180
- private static void PrintList ( ILogger nonNullLogger , IConfig effectiveConfig , IReadOnlyList < Type > allAvailableTypesWithRunnableBenchmarks , CommandLineOptions options )
181
- {
182
- var printer = new BenchmarkCasesPrinter ( options . ListBenchmarkCaseMode ) ;
183
171
184
- var testNames = TypeFilter . Filter ( effectiveConfig , allAvailableTypesWithRunnableBenchmarks )
185
- . SelectMany ( p => p . BenchmarksCases )
186
- . Select ( p => p . Descriptor . GetFilterName ( ) )
187
- . Distinct ( ) ;
188
-
189
- printer . Print ( testNames , nonNullLogger ) ;
190
- }
191
172
}
192
173
}
0 commit comments