File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22using System . Collections . Generic ;
33using System . IO ;
44using System . Linq ;
5- using System . Reflection ;
6- using System . Text ;
75using BenchmarkDotNet . Attributes ;
86using BenchmarkDotNet . Configs ;
97using BenchmarkDotNet . Jobs ;
@@ -26,9 +24,8 @@ public ConfigWithCustomEnvVars()
2624
2725 public IEnumerable < object [ ] > TestData ( )
2826 {
29- string rootDir = Directory . GetCurrentDirectory ( ) ;
30- string testDataDir = Path . Join ( Directory . GetParent ( rootDir ) . Parent . Parent . Parent . FullName , "jsonexamples" ) ;
31- string [ ] files = Directory . GetFiles ( testDataDir , "*.json" , SearchOption . AllDirectories ) . ToArray ( ) ;
27+ string jsonExamples = Environment . GetEnvironmentVariable ( "pathToJsonExamples" ) ;
28+ string [ ] files = Directory . GetFiles ( jsonExamples , "*.json" , SearchOption . AllDirectories ) . ToArray ( ) ;
3229
3330 foreach ( var file in files )
3431 {
Original file line number Diff line number Diff line change 11using System ;
22using System . IO ;
3+ using System . Reflection ;
34using BenchmarkDotNet . Running ;
45
56namespace Benchmarks
@@ -8,6 +9,13 @@ public class Program
89 {
910 public static void Main ( string [ ] args )
1011 {
12+ const string envVariable = "pathToJsonExamples" ;
13+ if ( Environment . GetEnvironmentVariable ( envVariable ) == null )
14+ {
15+ string root = Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) ;
16+ string path = Path . Join ( Directory . GetParent ( root ) . Parent . Parent . Parent . FullName , "jsonexamples" ) ;
17+ Environment . SetEnvironmentVariable ( envVariable , path ) ;
18+ }
1119 BenchmarkSwitcher . FromAssembly ( typeof ( Program ) . Assembly ) . Run ( args ) ;
1220 }
1321 }
You can’t perform that action at this time.
0 commit comments