@@ -70,18 +70,18 @@ et test //flutter/fml:fml_benchmarks # Run a single test target in `//flutter/f
70
70
);
71
71
}
72
72
73
+ final List <BuildTarget > testTargets = < BuildTarget > [];
73
74
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 (_isTestExecutable (target)) {
76
+ testTargets.add (target);
77
77
}
78
78
if (target.executable == null ) {
79
79
environment.logger.fatal (
80
80
'$target is an executable but is missing the executable path' );
81
81
}
82
82
}
83
83
// Chop off the '//' prefix.
84
- final List <String > buildTargets = selectedTargets
84
+ final List <String > buildTargets = testTargets
85
85
.map <String >(
86
86
(BuildTarget target) => target.label.substring ('//' .length))
87
87
.toList ();
@@ -95,11 +95,16 @@ et test //flutter/fml:fml_benchmarks # Run a single test target in `//flutter/f
95
95
final WorkerPool workerPool =
96
96
WorkerPool (environment, ProcessTaskProgressReporter (environment));
97
97
final Set <ProcessTask > tasks = < ProcessTask > {};
98
- for (final BuildTarget target in selectedTargets ) {
98
+ for (final BuildTarget target in testTargets ) {
99
99
final List <String > commandLine = < String > [target.executable! .path];
100
100
tasks.add (ProcessTask (
101
101
target.label, environment, environment.engine.srcDir, commandLine));
102
102
}
103
103
return await workerPool.run (tasks) ? 0 : 1 ;
104
104
}
105
+
106
+ /// Returns true if `target` is a testonly executable.
107
+ static bool _isTestExecutable (BuildTarget target) {
108
+ return target.testOnly && target.type == BuildTargetType .executable;
109
+ }
105
110
}
0 commit comments