This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 2 files changed +30
-1
lines changed 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ et test //flutter/fml:fml_benchmarks # Run a single test target in `//flutter/f
72
72
73
73
final List <BuildTarget > testTargets = < BuildTarget > [];
74
74
for (final BuildTarget target in selectedTargets) {
75
- if (target.testOnly && target.type == BuildTargetType .executable ) {
75
+ if (_isTestExecutable ( target) ) {
76
76
testTargets.add (target);
77
77
}
78
78
if (target.executable == null ) {
@@ -102,4 +102,9 @@ et test //flutter/fml:fml_benchmarks # Run a single test target in `//flutter/f
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
}
Original file line number Diff line number Diff line change @@ -67,4 +67,28 @@ void main() {
67
67
testEnvironment.cleanup ();
68
68
}
69
69
});
70
+
71
+ test ('test command skips non-testonly executables' , () async {
72
+ final TestEnvironment testEnvironment = TestEnvironment .withTestEngine (
73
+ cannedProcesses: cannedProcesses,
74
+ );
75
+ try {
76
+ final Environment env = testEnvironment.environment;
77
+ final ToolCommandRunner runner = ToolCommandRunner (
78
+ environment: env,
79
+ configs: configs,
80
+ );
81
+ final int result = await runner.run (< String > [
82
+ 'test' ,
83
+ '//third_party/protobuf:protoc' ,
84
+ ]);
85
+ expect (result, equals (1 ));
86
+ expect (testEnvironment.processHistory.length, lessThan (3 ));
87
+ expect (testEnvironment.processHistory.where ((ExecutedProcess process) {
88
+ return process.command[0 ].contains ("protoc" );
89
+ }), isEmpty);
90
+ } finally {
91
+ testEnvironment.cleanup ();
92
+ }
93
+ });
70
94
}
You can’t perform that action at this time.
0 commit comments