| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_runner"); | 5 #library("test_runner"); |
| 6 | 6 |
| 7 #import("status_file_parser.dart"); | 7 #import("status_file_parser.dart"); |
| 8 #import("test_progress.dart"); | 8 #import("test_progress.dart"); |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Classes and methods for executing tests. | 11 * Classes and methods for executing tests. |
| 12 * | 12 * |
| 13 * This module includes: | 13 * This module includes: |
| 14 * - Managing parallel execution of tests, including timeout checks. | 14 * - Managing parallel execution of tests, including timeout checks. |
| 15 * - Evaluating the output of each test as pass/fail/crash/timeout. | 15 * - Evaluating the output of each test as pass/fail/crash/timeout. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 final int NO_TIMEOUT = 0; | 18 final int NO_TIMEOUT = 0; |
| 19 | 19 |
| 20 | 20 |
| 21 String getBuildDir(Map configuration) { | 21 String getBuildDir(Map configuration) { |
| 22 var buildDir = ''; | 22 var buildDir = ''; |
| 23 var os = configuration['os']; | 23 var system = configuration['system']; |
| 24 if (os == 'linux') { | 24 if (system == 'linux') { |
| 25 buildDir = 'out/'; | 25 buildDir = 'out/'; |
| 26 } else if (os == 'macos') { | 26 } else if (system == 'macos') { |
| 27 buildDir = 'xcodebuild/'; | 27 buildDir = 'xcodebuild/'; |
| 28 } | 28 } |
| 29 buildDir += (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_'; | 29 buildDir += (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_'; |
| 30 buildDir += configuration['architecture'] + '/'; | 30 buildDir += configuration['architecture'] + '/'; |
| 31 return buildDir; | 31 return buildDir; |
| 32 } | 32 } |
| 33 | 33 |
| 34 | 34 |
| 35 String getExecutableName(Map configuration) { | 35 String getExecutableName(Map configuration) { |
| 36 switch (configuration['component']) { | 36 switch (configuration['component']) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 class TestCase { | 61 class TestCase { |
| 62 String executablePath; | 62 String executablePath; |
| 63 List<String> arguments; | 63 List<String> arguments; |
| 64 int timeout; | 64 int timeout; |
| 65 String commandLine; | 65 String commandLine; |
| 66 String displayName; | 66 String displayName; |
| 67 TestOutput output; | 67 TestOutput output; |
| 68 bool isNegative; |
| 68 Set<String> expectedOutcomes; | 69 Set<String> expectedOutcomes; |
| 69 Function completedHandler; | 70 Function completedHandler; |
| 70 | 71 |
| 71 TestCase(this.displayName, this.executablePath, this.arguments, | 72 TestCase(this.displayName, |
| 72 this.timeout, this.completedHandler, this.expectedOutcomes) { | 73 this.executablePath, |
| 74 this.arguments, |
| 75 this.timeout, |
| 76 this.completedHandler, |
| 77 this.expectedOutcomes, |
| 78 [this.isNegative = false]) { |
| 79 if (!isNegative) { |
| 80 isNegative = displayName.contains("NegativeTest"); |
| 81 } |
| 73 commandLine = executablePath; | 82 commandLine = executablePath; |
| 74 for (var arg in arguments) { | 83 for (var arg in arguments) { |
| 75 commandLine += " " + arg; | 84 commandLine += " " + arg; |
| 76 } | 85 } |
| 77 } | 86 } |
| 78 | 87 |
| 79 bool get isNegative() => displayName.contains("NegativeTest"); | |
| 80 | |
| 81 void completed() { completedHandler(this); } | 88 void completed() { completedHandler(this); } |
| 82 } | 89 } |
| 83 | 90 |
| 84 | 91 |
| 85 class TestOutput { | 92 class TestOutput { |
| 86 // The TestCase this is the output from. | 93 // The TestCase this is the output from. |
| 87 TestCase testCase; | 94 TestCase testCase; |
| 88 int exitCode; | 95 int exitCode; |
| 89 bool timedOut; | 96 bool timedOut; |
| 90 bool failed = false; | 97 bool failed = false; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 numProcesses++; | 213 numProcesses++; |
| 207 } | 214 } |
| 208 } | 215 } |
| 209 | 216 |
| 210 runTest(TestCase test) { | 217 runTest(TestCase test) { |
| 211 progress.testAdded(); | 218 progress.testAdded(); |
| 212 tests.add(test); | 219 tests.add(test); |
| 213 tryRunTest(); | 220 tryRunTest(); |
| 214 } | 221 } |
| 215 } | 222 } |
| OLD | NEW |