44
55import 'dart:async' show Future;
66import 'dart:convert' show LineSplitter, utf8;
7- import 'dart:io' show File, Platform, Process, exitCode ;
7+ import 'dart:io' show File, Platform, Process;
88
99Future <void > main (List <String > args) async {
1010 // General idea: Launch - in separate processes - whatever we want to run
@@ -18,14 +18,18 @@ Future<void> main(List<String> args) async {
1818 "\n\n " );
1919
2020 List <WrappedProcess > startedProcesses = [];
21+ List <String > missingScripts = [];
22+ void noteMissingScript (String message) {
23+ missingScripts.add (message);
24+ print (message);
25+ }
2126
2227 {
2328 // Very slow: Leak-test.
2429 Uri leakTester =
2530 Platform .script.resolve ("flutter_gallery_leak_tester.dart" );
2631 if (! new File .fromUri (leakTester).existsSync ()) {
27- exitCode = 1 ;
28- print ("Couldn't find $leakTester " );
32+ noteMissingScript ("Couldn't find $leakTester " );
2933 } else {
3034 // The tools/bots/flutter/compile_flutter.sh script passes `--path`
3135 // --- we'll just pass everything along.
@@ -43,8 +47,7 @@ Future<void> main(List<String> args) async {
4347 // Weak suite with fuzzing.
4448 Uri weakSuite = Platform .script.resolve ("weak_suite.dart" );
4549 if (! new File .fromUri (weakSuite).existsSync ()) {
46- exitCode = 1 ;
47- print ("Couldn't find $weakSuite " );
50+ noteMissingScript ("Couldn't find $weakSuite " );
4851 } else {
4952 startedProcesses.add (await run (
5053 [
@@ -60,8 +63,7 @@ Future<void> main(List<String> args) async {
6063 // Strong suite with fuzzing.
6164 Uri strongSuite = Platform .script.resolve ("strong_suite.dart" );
6265 if (! new File .fromUri (strongSuite).existsSync ()) {
63- exitCode = 1 ;
64- print ("Couldn't find $strongSuite " );
66+ noteMissingScript ("Couldn't find $strongSuite " );
6567 } else {
6668 startedProcesses.add (await run (
6769 [
@@ -78,8 +80,7 @@ Future<void> main(List<String> args) async {
7880 Uri incrementalLeakTest =
7981 Platform .script.resolve ("vm_service_for_leak_detection.dart" );
8082 if (! new File .fromUri (incrementalLeakTest).existsSync ()) {
81- exitCode = 1 ;
82- print ("Couldn't find $incrementalLeakTest " );
83+ noteMissingScript ("Couldn't find $incrementalLeakTest " );
8384 } else {
8485 startedProcesses.add (await run ([
8586 incrementalLeakTest.toString (),
@@ -90,11 +91,9 @@ Future<void> main(List<String> args) async {
9091
9192 {
9293 // Expression suite with fuzzing.
93- Uri expressionSuite =
94- Platform .script.resolve ("expression_suite.dart" );
94+ Uri expressionSuite = Platform .script.resolve ("expression_suite.dart" );
9595 if (! new File .fromUri (expressionSuite).existsSync ()) {
96- exitCode = 1 ;
97- print ("Couldn't find $expressionSuite " );
96+ noteMissingScript ("Couldn't find $expressionSuite " );
9897 } else {
9998 startedProcesses.add (await run (
10099 [
@@ -107,9 +106,11 @@ Future<void> main(List<String> args) async {
107106 }
108107
109108 // Wait for everything to finish.
109+ bool shouldThrow = false ;
110110 List <int > exitCodes =
111111 await Future .wait (startedProcesses.map ((e) => e.process.exitCode));
112112 if (exitCodes.where ((e) => e != 0 ).isNotEmpty) {
113+ shouldThrow = true ;
113114 print ("\n\n Found failures!:\n " );
114115 // At least one failed.
115116 for (WrappedProcess p in startedProcesses) {
@@ -118,9 +119,15 @@ Future<void> main(List<String> args) async {
118119 print ("${p .id } failed with exist-code $pExitCode " );
119120 }
120121 }
121-
122- throw "There were failures!" ;
123122 }
123+ if (missingScripts.isNotEmpty) {
124+ print ("\n\n There were missing scripts!" );
125+ for (String message in missingScripts) {
126+ print (" - $message " );
127+ }
128+ shouldThrow = true ;
129+ }
130+ if (shouldThrow) throw "There were failures!" ;
124131}
125132
126133Future <WrappedProcess > run (List <String > args, String id) async {
0 commit comments