| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test_progress; | 5 library test_progress; |
| 6 | 6 |
| 7 import "dart:async"; | 7 import "dart:async"; |
| 8 import "dart:io"; | 8 import "dart:io"; |
| 9 import "dart:io" as io; | 9 import "dart:io" as io; |
| 10 import "dart:convert" show JSON; | 10 import "dart:convert" show JSON; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 167 } |
| 168 | 168 |
| 169 class ExitCodeSetter extends EventListener { | 169 class ExitCodeSetter extends EventListener { |
| 170 void done(TestCase test) { | 170 void done(TestCase test) { |
| 171 if (test.unexpectedOutput) { | 171 if (test.unexpectedOutput) { |
| 172 io.exitCode = 1; | 172 io.exitCode = 1; |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 class IgnoredTestMonitor extends EventListener { |
| 178 static final int maxIgnored = 5; |
| 179 |
| 180 int countIgnored = 0; |
| 181 |
| 182 void done(TestCase test) { |
| 183 if (test.lastCommandOutput.result(test) == Expectation.IGNORE) { |
| 184 countIgnored++; |
| 185 if (countIgnored > maxIgnored) { |
| 186 print("/nMore than $maxIgnored tests were ignored due to flakes in"); |
| 187 print("the test infrastructure. Notify whesse@google.com."); |
| 188 print("Output of the last ignored test was:"); |
| 189 print(_buildFailureOutput(test)); |
| 190 exit(1); |
| 191 } |
| 192 } |
| 193 } |
| 194 |
| 195 void allDone() { |
| 196 if (countIgnored > 0) { |
| 197 print("Ignored $countIgnored tests due to flaky infrastructure"); |
| 198 } |
| 199 } |
| 200 } |
| 201 |
| 177 class FlakyLogWriter extends EventListener { | 202 class FlakyLogWriter extends EventListener { |
| 178 void done(TestCase test) { | 203 void done(TestCase test) { |
| 179 if (test.isFlaky && test.result != Expectation.PASS) { | 204 if (test.isFlaky && test.result != Expectation.PASS) { |
| 180 var buf = new StringBuffer(); | 205 var buf = new StringBuffer(); |
| 181 for (var l in _buildFailureOutput(test)) { | 206 for (var l in _buildFailureOutput(test)) { |
| 182 buf.write("$l\n"); | 207 buf.write("$l\n"); |
| 183 } | 208 } |
| 184 _appendToFlakyFile(buf.toString()); | 209 _appendToFlakyFile(buf.toString()); |
| 185 } | 210 } |
| 186 } | 211 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 return new VerboseProgressIndicator(startTime); | 689 return new VerboseProgressIndicator(startTime); |
| 665 case 'status': | 690 case 'status': |
| 666 return new ProgressIndicator(startTime); | 691 return new ProgressIndicator(startTime); |
| 667 case 'buildbot': | 692 case 'buildbot': |
| 668 return new BuildbotProgressIndicator(startTime); | 693 return new BuildbotProgressIndicator(startTime); |
| 669 default: | 694 default: |
| 670 assert(false); | 695 assert(false); |
| 671 break; | 696 break; |
| 672 } | 697 } |
| 673 } | 698 } |
| OLD | NEW |