| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 stdout, stderr, time); | 250 stdout, stderr, time); |
| 251 } | 251 } |
| 252 | 252 |
| 253 String get result() => | 253 String get result() => |
| 254 hasCrashed ? CRASH : (hasTimedOut ? TIMEOUT : (hasFailed ? FAIL : PASS)); | 254 hasCrashed ? CRASH : (hasTimedOut ? TIMEOUT : (hasFailed ? FAIL : PASS)); |
| 255 | 255 |
| 256 bool get unexpectedOutput() => !testCase.expectedOutcomes.contains(result); | 256 bool get unexpectedOutput() => !testCase.expectedOutcomes.contains(result); |
| 257 | 257 |
| 258 bool get hasCrashed() { | 258 bool get hasCrashed() { |
| 259 if (Platform.operatingSystem() == 'windows') { | 259 if (Platform.operatingSystem() == 'windows') { |
| 260 if (exitCode != 0) { | |
| 261 // Suppress some flaky errors that crash the VM. | |
| 262 // TODO(sigmund,efortuna): remove this when bug 2124 gets fixed. | |
| 263 for (String line in testCase.output.stdout) { | |
| 264 if (line.startsWith('Kind:')) { | |
| 265 if (!alreadyPrintedWarning) { | |
| 266 print("WARNING: VM crashed: $line, exit code: $exitCode. " | |
| 267 " This is a fake pass!!"); | |
| 268 alreadyPrintedWarning = true; | |
| 269 } | |
| 270 return false; | |
| 271 } | |
| 272 } | |
| 273 } | |
| 274 | |
| 275 // The VM uses std::abort to terminate on asserts. | 260 // The VM uses std::abort to terminate on asserts. |
| 276 // std::abort terminates with exit code 3 on Windows. | 261 // std::abort terminates with exit code 3 on Windows. |
| 277 if (exitCode == 3) { | 262 if (exitCode == 3) { |
| 278 return !timedOut; | 263 return !timedOut; |
| 279 } | 264 } |
| 280 return (!timedOut && (exitCode < 0) && ((0x3FFFFF00 & exitCode) == 0)); | 265 return (!timedOut && (exitCode < 0) && ((0x3FFFFF00 & exitCode) == 0)); |
| 281 } | 266 } |
| 282 // The Java dartc runner exits with code 253 in case of unhandled | 267 // The Java dartc runner exits with code 253 in case of unhandled |
| 283 // exceptions. | 268 // exceptions. |
| 284 return (!timedOut && ((exitCode < 0) || (exitCode == 253))); | 269 return (!timedOut && ((exitCode < 0) || (exitCode == 253))); |
| 285 } | 270 } |
| 286 | 271 |
| 287 bool get hasTimedOut() => timedOut; | 272 bool get hasTimedOut() => timedOut; |
| 288 | 273 |
| 289 bool get didFail() { | 274 bool get didFail() { |
| 290 return (exitCode != 0 && !hasCrashed); | 275 return (exitCode != 0 && !hasCrashed); |
| 291 } | 276 } |
| 292 | 277 |
| 293 // Reverse result of a negative test. | 278 // Reverse result of a negative test. |
| 294 bool get hasFailed() { | 279 bool get hasFailed() => testCase.isNegative ? !didFail : didFail; |
| 295 // TODO(efortuna): This is a total hack to keep our buildbots (more) green | |
| 296 // while the VM team solves Issue 2124. Remove when issue is fixed. | |
| 297 if (Platform.operatingSystem() == 'windows' && (exitCode == 253 || | |
| 298 exitCode == 3)) { | |
| 299 for (String line in testCase.output.stdout) { | |
| 300 if (line.startsWith('VM exited with signal 1073741819') || | |
| 301 line.startsWith('Kind:')) { | |
| 302 if (!alreadyPrintedWarning) { | |
| 303 print("WARNING: VM crashed: $line This is a fake pass!!"); | |
| 304 alreadyPrintedWarning = true; | |
| 305 } | |
| 306 return testCase.expectedOutcomes.iterator().next() == FAIL; | |
| 307 } | |
| 308 } | |
| 309 } | |
| 310 return (testCase.isNegative ? !didFail : didFail); | |
| 311 } | |
| 312 | 280 |
| 313 } | 281 } |
| 314 | 282 |
| 315 class BrowserTestOutputImpl extends TestOutputImpl { | 283 class BrowserTestOutputImpl extends TestOutputImpl { |
| 316 BrowserTestOutputImpl(testCase, exitCode, timedOut, stdout, stderr, time) : | 284 BrowserTestOutputImpl(testCase, exitCode, timedOut, stdout, stderr, time) : |
| 317 super(testCase, exitCode, timedOut, stdout, stderr, time); | 285 super(testCase, exitCode, timedOut, stdout, stderr, time); |
| 318 | 286 |
| 319 bool get didFail() { | 287 bool get didFail() { |
| 320 // Browser case: | 288 // Browser case: |
| 321 // If the browser test failed, it may have been because DumpRenderTree | 289 // If the browser test failed, it may have been because DumpRenderTree |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 // the developer doesn't waste his or her time trying to fix a bunch of | 1132 // the developer doesn't waste his or her time trying to fix a bunch of |
| 1165 // tests that appear to be broken but were actually just flakes that | 1133 // tests that appear to be broken but were actually just flakes that |
| 1166 // didn't get retried because there had already been one failure. | 1134 // didn't get retried because there had already been one failure. |
| 1167 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; | 1135 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; |
| 1168 new RunningProcess(test, allowRetry, this).start(); | 1136 new RunningProcess(test, allowRetry, this).start(); |
| 1169 } | 1137 } |
| 1170 _numProcesses++; | 1138 _numProcesses++; |
| 1171 } | 1139 } |
| 1172 } | 1140 } |
| 1173 } | 1141 } |
| OLD | NEW |