Skip to content

Commit 63e28c1

Browse files
authored
when all builds fail, BDN should stop after printing first error (#1672)
1 parent b67cfb4 commit 63e28c1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ internal static Summary[] Run(BenchmarkRunInfo[] benchmarkRunInfos)
6060

6161
var buildPartitions = BenchmarkPartitioner.CreateForBuild(supportedBenchmarks, resolver);
6262
var buildResults = BuildInParallel(compositeLogger, rootArtifactsFolderPath, buildPartitions, ref globalChronometer);
63+
var allBuildsHaveFailed = buildResults.Values.All(buildResult => !buildResult.IsBuildSuccess);
6364

6465
try
6566
{
@@ -85,7 +86,7 @@ internal static Summary[] Run(BenchmarkRunInfo[] benchmarkRunInfos)
8586

8687
results.Add(summary);
8788

88-
if (benchmarkRunInfo.Config.Options.IsSet(ConfigOptions.StopOnFirstError) && summary.Reports.Any(report => !report.Success))
89+
if ((benchmarkRunInfo.Config.Options.IsSet(ConfigOptions.StopOnFirstError) && summary.Reports.Any(report => !report.Success)) || allBuildsHaveFailed)
8990
break;
9091
}
9192

@@ -132,6 +133,7 @@ private static Summary Run(BenchmarkRunInfo benchmarkRunInfo,
132133
ref StartedClock runChronometer)
133134
{
134135
var benchmarks = benchmarkRunInfo.BenchmarksCases;
136+
var allBuildsHaveFailed = benchmarks.All(benchmark => !buildResults[benchmark].buildResult.IsBuildSuccess);
135137
var config = benchmarkRunInfo.Config;
136138
var cultureInfo = config.CultureInfo ?? DefaultCultureInfo.Instance;
137139
var reports = new List<BenchmarkReport>();
@@ -189,7 +191,7 @@ private static Summary Run(BenchmarkRunInfo benchmarkRunInfo,
189191
logger.WriteLineError("// Please follow the troubleshooting guide: https://benchmarkdotnet.org/articles/guides/troubleshooting.html");
190192
}
191193

192-
if (config.Options.IsSet(ConfigOptions.StopOnFirstError))
194+
if (config.Options.IsSet(ConfigOptions.StopOnFirstError) || allBuildsHaveFailed)
193195
break;
194196
}
195197

0 commit comments

Comments
 (0)