@@ -36,59 +36,121 @@ static void Main(string[] args)
3636
3737 var thisAssemblyPath = Assembly . GetEntryAssembly ( ) . Location ;
3838 var here = Path . GetDirectoryName ( thisAssemblyPath ) ;
39- var playground = Path . GetFullPath ( Path . Combine ( here , ".." , ".." , ".." , ".." ) ) ;
39+ // var playground = Path.GetFullPath(Path.Combine(here, "..", "..", "..", ".."));
4040
4141 var console = Path . Combine ( here , "vstest.console" , "vstest.console.exe" ) ;
4242
43+ var discoverySettings = $@ "
44+ <RunSettings>
45+ <RunConfiguration>
46+ <InIsolation>true</InIsolation>
47+ <MaxCpuCount>0</MaxCpuCount>
48+ <DisableAppDomain>False</DisableAppDomain>
49+ <BatchSize>10</BatchSize>
50+ </RunConfiguration>
51+ </RunSettings>
52+ " ;
4353
4454 var sourceSettings = @"
4555 <RunSettings>
4656 <RunConfiguration>
4757 <InIsolation>true</InIsolation>
48- <MaxCpuCount>4 </MaxCpuCount>
58+ <MaxCpuCount>0 </MaxCpuCount>
4959 </RunConfiguration>
5060 </RunSettings>
5161 " ;
5262
5363 var sources = new [ ] {
54- Path . Combine ( playground , "MSTest1" , "bin" , "Debug" , "net472" , "MSTest1.dll" ) ,
55- Path . Combine ( playground , "MSTest1" , "bin" , "Debug" , "net5.0" , "MSTest1.dll" ) ,
56- @"C:\Users\jajares\source\repos\TestProject48\TestProject48\bin\Debug\net48\TestProject48.dll" ,
57- @"C:\Users\jajares\source\repos\TestProject48\TestProject1\bin\Debug\net48\win10-x64\TestProject1.dll"
58- } ;
5964
60- // console mode
61- var settingsFile = Path . GetTempFileName ( ) ;
62- try
63- {
64- File . WriteAllText ( settingsFile , sourceSettings ) ;
65- var process = Process . Start ( console , string . Join ( " " , sources ) + " --settings:" + settingsFile + " --listtests" ) ;
66- process . WaitForExit ( ) ;
67- if ( process . ExitCode != 0 )
68- {
69- throw new Exception ( $ "Process failed with { process . ExitCode } ") ;
70- }
71- }
72- finally
73- {
74- try { File . Delete ( settingsFile ) ; } catch { }
75- }
65+ // @"C:\t\TestProject13_\TestProject1\bin\Debug\net48\TestProject1.dll",
66+
67+ // @"C:\t\TestProject13_for_mstest\TestProject1\bin\Debug\net48\TestProject1.dll",
68+
69+ // @"C:\t\TestProject13_for_mstest\TestProject5\bin\Debug\net472\TestProject5.dll",
70+ //@"C:\t\TestProject13_for_mstest\TestProject6\bin\Debug\net472\TestProject6.dll"
71+
72+
73+ //// // net6
74+ @"C:\t\ParallelDiscovery2\ReproNetCore\Test1\bin\Debug\net6.0\Test1.dll" ,
75+ @"C:\t\ParallelDiscovery2\ReproNetCore\Test7\bin\Debug\net6.0\Test7.dll" ,
76+ @"C:\t\ParallelDiscovery2\ReproNetCore\Test2\bin\Debug\net6.0\Test2.dll" ,
77+ @"C:\t\ParallelDiscovery2\ReproNetCore\Test6\bin\Debug\net6.0\Test6.dll" ,
78+ @"C:\t\ParallelDiscovery2\ReproNetCore\Test8\bin\Debug\net6.0\Test8.dll" ,
79+ @"C:\t\ParallelDiscovery2\ReproNetCore\Test5\bin\Debug\net6.0\Test5.dll" ,
80+ @"C:\t\ParallelDiscovery2\ReproNetCore\Test3\bin\Debug\net6.0\Test3.dll" ,
81+ @"C:\t\ParallelDiscovery2\ReproNetCore\Test4\bin\Debug\net6.0\Test4.dll" ,
82+ @"C:\t\ParallelDiscovery2\ReproNetCore\Test10\bin\Debug\net6.0\Test10.dll" ,
83+ @"C:\t\ParallelDiscovery2\ReproNetCore\Test9\bin\Debug\net6.0\Test9.dll" ,
84+
85+ //// netfx
86+ @"C:\t\ParallelDiscovery2\ReproNetFx\Project4\bin\Debug\net472\Project4.dll" ,
87+ @"C:\t\ParallelDiscovery2\ReproNetFx\Project1\bin\Debug\net472\Project1.dll" ,
88+ @"C:\t\ParallelDiscovery2\ReproNetFx\Project2\bin\Debug\net472\Project2.dll" ,
89+ @"C:\t\ParallelDiscovery2\ReproNetFx\Project3\bin\Debug\net472\Project3.dll" ,
90+ @"C:\t\ParallelDiscovery2\ReproNetFx\Project9\bin\Debug\net472\Project9.dll" ,
91+ @"C:\t\ParallelDiscovery2\ReproNetFx\Project10\bin\Debug\net472\Project10.dll" ,
92+ @"C:\t\ParallelDiscovery2\ReproNetFx\Project5\bin\Debug\net472\Project5.dll" ,
93+ @"C:\t\ParallelDiscovery2\ReproNetFx\Project8\bin\Debug\net472\Project8.dll" ,
94+ @"C:\t\ParallelDiscovery2\ReproNetFx\Project7\bin\Debug\net472\Project7.dll" ,
95+ @"C:\t\ParallelDiscovery2\ReproNetFx\Project6\bin\Debug\net472\Project6.dll" ,
96+
97+
98+ //// mix
99+ @"C:\t\MultipleTfmAndArch\Tst1\bin\Debug\net472\win7-x86\Tst1.dll" ,
100+ @"C:\t\MultipleTfmAndArch\Tst1\bin\Debug\net48\win7-x86\Tst1.dll" ,
101+ @"C:\t\MultipleTfmAndArch\Tst3\bin\Debug\net48\win7-x86\Tst3.dll" ,
102+ @"C:\t\MultipleTfmAndArch\Tst1\bin\Debug\net5.0\win7-x86\Tst1.dll" ,
103+ @"C:\t\MultipleTfmAndArch\Tst2\bin\Debug\net472\win7-x64\Tst2.dll" ,
104+ @"C:\t\MultipleTfmAndArch\Tst3\bin\Debug\net472\win7-x86\Tst3.dll" ,
105+ @"C:\t\MultipleTfmAndArch\Tst2\bin\Debug\net48\win7-x64\Tst2.dll" ,
106+ @"C:\t\MultipleTfmAndArch\Tst2\bin\Debug\netcoreapp3.1\win7-x64\Tst2.dll" ,
107+ @"C:\t\MultipleTfmAndArch\Tst3\bin\Debug\netcoreapp3.1\win7-x86\Tst3.dll" ,
108+ @"C:\t\MultipleTfmAndArch\Tst2\bin\Debug\net5.0\win7-x64\Tst2.dll" ,
109+ @"C:\t\MultipleTfmAndArch\Tst3\bin\Debug\net5.0\win7-x86\Tst3.dll" ,
110+ @"C:\t\MultipleTfmAndArch\Tst1\bin\Debug\netcoreapp3.1\win7-x86\Tst1.dll" ,
111+
112+ } ;
113+ //// console mode
114+ //var settingsFile = Path.GetTempFileName();
115+ //try
116+ //{
117+ // File.WriteAllText(settingsFile, sourceSettings);
118+ // var process = Process.Start(console, string.Join(" ", sources) + " --settings:" + settingsFile + " --listtests");
119+ // var cmd = console + "\n\n" + string.Join(" ", sources) + " --settings:" + settingsFile + " --listtests";
120+ // var swc = Stopwatch.StartNew();
121+ // process.WaitForExit();
122+ // if (process.ExitCode != 0)
123+ // {
124+ // throw new Exception($"Process failed with {process.ExitCode}");
125+ // }
126+ // Console.WriteLine($"Done in {swc.ElapsedMilliseconds} ms");
127+ //}
128+ //finally
129+ //{
130+ // try { File.Delete(settingsFile); } catch { }
131+ //}
76132
77133 // design mode
78134 var consoleOptions = new ConsoleParameters
79135 {
80136 LogFilePath = Path . Combine ( here , "logs" , "log.txt" ) ,
81- TraceLevel = TraceLevel . Verbose ,
137+ TraceLevel = TraceLevel . Off ,
82138 } ;
83139 var options = new TestPlatformOptions ( ) ;
84140 var r = new VsTestConsoleWrapper ( console , consoleOptions ) ;
85141 var sessionHandler = new TestSessionHandler ( ) ;
86142#pragma warning disable CS0618 // Type or member is obsolete
87- r . StartTestSession ( sources , sourceSettings , sessionHandler ) ;
143+ // r.StartTestSession(sources, sourceSettings, sessionHandler);
88144#pragma warning restore CS0618 // Type or member is obsolete
89145 var discoveryHandler = new PlaygroundTestDiscoveryHandler ( ) ;
90- r . DiscoverTests ( sources , sourceSettings , options , sessionHandler . TestSessionInfo , discoveryHandler ) ;
146+ var sw = Stopwatch . StartNew ( ) ;
147+ r . DiscoverTests ( sources , discoverySettings , options , sessionHandler . TestSessionInfo , discoveryHandler ) ;
148+ var dd = sw . ElapsedMilliseconds ;
149+ Console . WriteLine ( $ "Discovery done in { sw . ElapsedMilliseconds } ms") ;
150+ sw . Restart ( ) ;
91151 r . RunTestsWithCustomTestHost ( discoveryHandler . TestCases , sourceSettings , options , sessionHandler . TestSessionInfo , new TestRunHandler ( ) , new DebuggerTestHostLauncher ( ) ) ;
152+ var rd = sw . ElapsedMilliseconds ;
153+ Console . WriteLine ( $ "Discovery: { dd } ms, Run: { rd } ms, Total: { dd + rd } ms") ;
92154 }
93155
94156 public class PlaygroundTestDiscoveryHandler : ITestDiscoveryEventsHandler , ITestDiscoveryEventsHandler2
0 commit comments