| 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) { | |
| 22 var buildDir = ''; | |
| 23 var system = configuration['system']; | |
| 24 if (system == 'linux') { | |
| 25 buildDir = 'out/'; | |
| 26 } else if (system == 'macos') { | |
| 27 buildDir = 'xcodebuild/'; | |
| 28 } | |
| 29 buildDir += (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_'; | |
| 30 buildDir += configuration['architecture'] + '/'; | |
| 31 return buildDir; | |
| 32 } | |
| 33 | |
| 34 | |
| 35 String getExecutableName(Map configuration) { | |
| 36 switch (configuration['component']) { | |
| 37 case 'vm': | |
| 38 return 'dart_bin'; | |
| 39 case 'dartc': | |
| 40 return 'compiler/bin/dartc_test'; | |
| 41 case 'frog': | |
| 42 case 'leg': | |
| 43 return 'frog/bin/frog'; | |
| 44 case 'frogsh': | |
| 45 return 'frog/bin/frogsh'; | |
| 46 default: | |
| 47 throw "Unknown executable for: ${configuration['component']}"; | |
| 48 } | |
| 49 } | |
| 50 | |
| 51 | |
| 52 String getDartShellFileName(Map configuration) { | |
| 53 var name = getBuildDir(configuration) + getExecutableName(configuration); | |
| 54 if (!(new File(name)).existsSync()) { | |
| 55 throw "Executable '$name' does not exist"; | |
| 56 } | |
| 57 return name; | |
| 58 } | |
| 59 | |
| 60 | |
| 61 class TestCase { | 21 class TestCase { |
| 62 String executablePath; | 22 String executablePath; |
| 63 List<String> arguments; | 23 List<String> arguments; |
| 64 int timeout; | 24 int timeout; |
| 65 String commandLine; | 25 String commandLine; |
| 66 String displayName; | 26 String displayName; |
| 67 TestOutput output; | 27 TestOutput output; |
| 68 bool isNegative; | 28 bool isNegative; |
| 69 Set<String> expectedOutcomes; | 29 Set<String> expectedOutcomes; |
| 70 Function completedHandler; | 30 Function completedHandler; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 numProcesses++; | 176 numProcesses++; |
| 217 } | 177 } |
| 218 } | 178 } |
| 219 | 179 |
| 220 runTest(TestCase test) { | 180 runTest(TestCase test) { |
| 221 progress.testAdded(); | 181 progress.testAdded(); |
| 222 tests.add(test); | 182 tests.add(test); |
| 223 tryRunTest(); | 183 tryRunTest(); |
| 224 } | 184 } |
| 225 } | 185 } |
| OLD | NEW |