OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * Classes and methods for executing tests. | 6 * Classes and methods for executing tests. |
7 * | 7 * |
8 * This module includes: | 8 * This module includes: |
9 * - Managing parallel execution of tests, including timeout checks. | 9 * - Managing parallel execution of tests, including timeout checks. |
10 * - Evaluating the output of each test as pass/fail/crash/timeout. | 10 * - Evaluating the output of each test as pass/fail/crash/timeout. |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 String displayName, | 226 String displayName, |
227 String outputFile, | 227 String outputFile, |
228 bool neverSkipCompilation, | 228 bool neverSkipCompilation, |
229 List<Uri> bootstrapDependencies, | 229 List<Uri> bootstrapDependencies, |
230 String executable, | 230 String executable, |
231 List<String> arguments, | 231 List<String> arguments, |
232 Map<String, String> environmentOverrides) | 232 Map<String, String> environmentOverrides) |
233 : super._(displayName, outputFile, neverSkipCompilation, | 233 : super._(displayName, outputFile, neverSkipCompilation, |
234 bootstrapDependencies, executable, arguments, | 234 bootstrapDependencies, executable, arguments, |
235 environmentOverrides); | 235 environmentOverrides); |
| 236 |
| 237 int get maxNumRetries => 1; |
236 } | 238 } |
237 | 239 |
238 /// This is just a Pair(String, Map) class with hashCode and operator == | 240 /// This is just a Pair(String, Map) class with hashCode and operator == |
239 class AddFlagsKey { | 241 class AddFlagsKey { |
240 final String flags; | 242 final String flags; |
241 final Map env; | 243 final Map env; |
242 AddFlagsKey(this.flags, this.env); | 244 AddFlagsKey(this.flags, this.env); |
243 // Just use object identity for environment map | 245 // Just use object identity for environment map |
244 bool operator ==(other) => | 246 bool operator ==(other) => |
245 other is AddFlagsKey && flags == other.flags && env == other.env; | 247 other is AddFlagsKey && flags == other.flags && env == other.env; |
(...skipping 2588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2834 if (!output.successful) { | 2836 if (!output.successful) { |
2835 List<String> stdout, stderr; | 2837 List<String> stdout, stderr; |
2836 | 2838 |
2837 decodeOutput() { | 2839 decodeOutput() { |
2838 if (stdout == null && stderr == null) { | 2840 if (stdout == null && stderr == null) { |
2839 stdout = decodeUtf8(output.stderr).split("\n"); | 2841 stdout = decodeUtf8(output.stderr).split("\n"); |
2840 stderr = decodeUtf8(output.stderr).split("\n"); | 2842 stderr = decodeUtf8(output.stderr).split("\n"); |
2841 } | 2843 } |
2842 } | 2844 } |
2843 | 2845 |
| 2846 final command = output.command; |
| 2847 |
| 2848 // The dartk batch compiler sometimes runs out of memory. In such a case we |
| 2849 // will retry running it. |
| 2850 if (command is KernelCompilationCommand) { |
| 2851 if (output.hasCrashed) { |
| 2852 bool containsOutOfMemoryMessage(String line) { |
| 2853 return line.contains('Exhausted heap space, trying to allocat'); |
| 2854 } |
| 2855 |
| 2856 decodeOutput(); |
| 2857 if (stdout.any(containsOutOfMemoryMessage) || |
| 2858 stderr.any(containsOutOfMemoryMessage)) { |
| 2859 return true; |
| 2860 } |
| 2861 } |
| 2862 } |
| 2863 |
| 2864 // We currently rerun dartium tests, see issue 14074. |
| 2865 if (command is BrowserTestCommand && |
| 2866 command.retry && |
| 2867 command.browser == 'dartium') { |
| 2868 return true; |
| 2869 } |
| 2870 |
2844 if (io.Platform.operatingSystem == 'linux') { | 2871 if (io.Platform.operatingSystem == 'linux') { |
2845 decodeOutput(); | 2872 decodeOutput(); |
2846 // No matter which command we ran: If we get failures due to the | 2873 // No matter which command we ran: If we get failures due to the |
2847 // "xvfb-run" issue 7564, try re-running the test. | 2874 // "xvfb-run" issue 7564, try re-running the test. |
2848 bool containsFailureMsg(String line) { | 2875 bool containsFailureMsg(String line) { |
2849 return line.contains(MESSAGE_CANNOT_OPEN_DISPLAY) || | 2876 return line.contains(MESSAGE_CANNOT_OPEN_DISPLAY) || |
2850 line.contains(MESSAGE_FAILED_TO_RUN_COMMAND); | 2877 line.contains(MESSAGE_FAILED_TO_RUN_COMMAND); |
2851 } | 2878 } |
2852 if (stdout.any(containsFailureMsg) || stderr.any(containsFailureMsg)) { | 2879 if (stdout.any(containsFailureMsg) || stderr.any(containsFailureMsg)) { |
2853 return true; | 2880 return true; |
2854 } | 2881 } |
2855 } | 2882 } |
2856 | 2883 |
2857 // We currently rerun dartium tests, see issue 14074. | |
2858 final command = output.command; | |
2859 if (command is BrowserTestCommand && | |
2860 command.retry && | |
2861 command.browser == 'dartium') { | |
2862 return true; | |
2863 } | |
2864 } | 2884 } |
2865 return false; | 2885 return false; |
2866 } | 2886 } |
2867 | 2887 |
2868 /* | 2888 /* |
2869 * [TestCaseCompleter] will listen for | 2889 * [TestCaseCompleter] will listen for |
2870 * NodeState.Processing -> NodeState.{Successful,Failed} state changes and | 2890 * NodeState.Processing -> NodeState.{Successful,Failed} state changes and |
2871 * will complete a TestCase if it is finished. | 2891 * will complete a TestCase if it is finished. |
2872 * | 2892 * |
2873 * It provides a stream [finishedTestCases], which will stream all TestCases | 2893 * It provides a stream [finishedTestCases], which will stream all TestCases |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3152 } | 3172 } |
3153 } | 3173 } |
3154 | 3174 |
3155 void eventAllTestsDone() { | 3175 void eventAllTestsDone() { |
3156 for (var listener in _eventListener) { | 3176 for (var listener in _eventListener) { |
3157 listener.allDone(); | 3177 listener.allDone(); |
3158 } | 3178 } |
3159 _allDone(); | 3179 _allDone(); |
3160 } | 3180 } |
3161 } | 3181 } |
OLD | NEW |