diff --git a/eng/build.ps1 b/eng/build.ps1 index 03864e6c1ddd5..4f98917e5d57f 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -59,6 +59,7 @@ param ( [switch][Alias('test')]$testDesktop, [switch]$testCoreClr, [switch]$testIOperation, + [switch]$sequential, [parameter(ValueFromRemainingArguments=$true)][string[]]$properties) @@ -436,6 +437,10 @@ function TestUsingOptimizedRunner() { $args += " -test64" } + if ($sequential) { + $args += " -sequential" + } + foreach ($dll in $dlls) { $args += " $dll" } diff --git a/src/Tools/Source/RunTests/AssemblyScheduler.cs b/src/Tools/Source/RunTests/AssemblyScheduler.cs index 4f9782bbbbc7c..35c7c4fdd8f26 100644 --- a/src/Tools/Source/RunTests/AssemblyScheduler.cs +++ b/src/Tools/Source/RunTests/AssemblyScheduler.cs @@ -196,19 +196,13 @@ internal AssemblyScheduler(Options options, int methodLimit = DefaultMethodLimit _methodLimit = methodLimit; } - internal IEnumerable Schedule(IEnumerable assemblyPaths) + public IEnumerable Schedule(string assemblyPath, bool force = false) { - var list = new List(); - foreach (var assemblyPath in assemblyPaths) + if (_options.Sequential) { - list.AddRange(Schedule(assemblyPath)); + return new[] { CreateAssemblyInfo(assemblyPath) }; } - return list; - } - - public IEnumerable Schedule(string assemblyPath, bool force = false) - { var typeInfoList = GetTypeInfoList(assemblyPath); var assemblyInfoList = new List(); var partitionList = new List(); diff --git a/src/Tools/Source/RunTests/Options.cs b/src/Tools/Source/RunTests/Options.cs index d6114e1d0cd72..f0cbf1a82fb33 100644 --- a/src/Tools/Source/RunTests/Options.cs +++ b/src/Tools/Source/RunTests/Options.cs @@ -76,6 +76,11 @@ internal class Options /// public bool UseProcDump { get; set; } + /// + /// Disable partitioning and parallelization across test assemblies. + /// + public bool Sequential { get; set; } + /// /// The directory which contains procdump.exe. /// @@ -214,6 +219,11 @@ bool isOption(string argument, string optionName, out string value) opt.UseProcDump = false; index++; } + else if (comparer.Equals(current, "-sequential")) + { + opt.Sequential = true; + index++; + } else { break; diff --git a/src/Tools/Source/RunTests/TestRunner.cs b/src/Tools/Source/RunTests/TestRunner.cs index 12fe9ec7ce59b..d0daf9f84b46b 100644 --- a/src/Tools/Source/RunTests/TestRunner.cs +++ b/src/Tools/Source/RunTests/TestRunner.cs @@ -47,7 +47,7 @@ internal async Task RunAllAsync(IEnumerable assembly // Use 1.5 times the number of processors for unit tests, but only 1 processor for the open integration tests // since they perform actual UI operations (such as mouse clicks and sending keystrokes) and we don't want two // tests to conflict with one-another. - var max = (_options.TestVsi) ? 1 : (int)(Environment.ProcessorCount * 1.5); + var max = (_options.TestVsi || _options.Sequential) ? 1 : (int)(Environment.ProcessorCount * 1.5); var cacheCount = 0; var waiting = new Stack(assemblyInfoList); var running = new List>();