Skip to content

Commit

Permalink
[et] Fix concurrent modification exception
Browse files Browse the repository at this point in the history
We cannot modify the list of build targets as we're iterating over it.
Instead of removing non-test/non-executable elements, instead we add
executable test targets to a separate testTargets list and use that.
  • Loading branch information
cbracken committed Apr 20, 2024
1 parent 6f4d753 commit b4126bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/engine_tool/lib/src/commands/test_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ et test //flutter/fml:fml_benchmarks # Run a single test target in `//flutter/f
);
}

final List<BuildTarget> testTargets = <BuildTarget>[];
for (final BuildTarget target in selectedTargets) {
if (!target.testOnly || target.type != BuildTargetType.executable) {
// Remove any targets that aren't testOnly and aren't executable.
selectedTargets.remove(target);
if (target.testOnly && target.type == BuildTargetType.executable) {
testTargets.add(target);
}
if (target.executable == null) {
environment.logger.fatal(
'$target is an executable but is missing the executable path');
}
}
// Chop off the '//' prefix.
final List<String> buildTargets = selectedTargets
final List<String> buildTargets = testTargets
.map<String>(
(BuildTarget target) => target.label.substring('//'.length))
.toList();
Expand All @@ -95,7 +95,7 @@ et test //flutter/fml:fml_benchmarks # Run a single test target in `//flutter/f
final WorkerPool workerPool =
WorkerPool(environment, ProcessTaskProgressReporter(environment));
final Set<ProcessTask> tasks = <ProcessTask>{};
for (final BuildTarget target in selectedTargets) {
for (final BuildTarget target in testTargets) {
final List<String> commandLine = <String>[target.executable!.path];
tasks.add(ProcessTask(
target.label, environment, environment.engine.srcDir, commandLine));
Expand Down

0 comments on commit b4126bf

Please sign in to comment.