Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 18abc93

Browse files
committed
[et] Fix concurrent modification exception
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.
1 parent 25d773e commit 18abc93

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/engine_tool/lib/src/commands/test_command.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@ et test //flutter/fml:fml_benchmarks # Run a single test target in `//flutter/f
7070
);
7171
}
7272

73+
final List<BuildTarget> testTargets = <BuildTarget>[];
7374
for (final BuildTarget target in selectedTargets) {
74-
if (!target.testOnly || target.type != BuildTargetType.executable) {
75-
// Remove any targets that aren't testOnly and aren't executable.
76-
selectedTargets.remove(target);
75+
if (target.testOnly && target.type == BuildTargetType.executable) {
76+
testTargets.add(target);
7777
}
7878
if (target.executable == null) {
7979
environment.logger.fatal(
8080
'$target is an executable but is missing the executable path');
8181
}
8282
}
8383
// Chop off the '//' prefix.
84-
final List<String> buildTargets = selectedTargets
84+
final List<String> buildTargets = testTargets
8585
.map<String>(
8686
(BuildTarget target) => target.label.substring('//'.length))
8787
.toList();
@@ -95,7 +95,7 @@ et test //flutter/fml:fml_benchmarks # Run a single test target in `//flutter/f
9595
final WorkerPool workerPool =
9696
WorkerPool(environment, ProcessTaskProgressReporter(environment));
9797
final Set<ProcessTask> tasks = <ProcessTask>{};
98-
for (final BuildTarget target in selectedTargets) {
98+
for (final BuildTarget target in testTargets) {
9999
final List<String> commandLine = <String>[target.executable!.path];
100100
tasks.add(ProcessTask(
101101
target.label, environment, environment.engine.srcDir, commandLine));

0 commit comments

Comments
 (0)