| 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 enumerating and preparing tests. | 6 * Classes and methods for enumerating and preparing tests. |
| 7 * | 7 * |
| 8 * This library includes: | 8 * This library includes: |
| 9 * | 9 * |
| 10 * - Creating tests by listing all the Dart files in certain directories, | 10 * - Creating tests by listing all the Dart files in certain directories, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 * | 116 * |
| 117 * Most TestSuites represent a directory or directory tree containing tests, | 117 * Most TestSuites represent a directory or directory tree containing tests, |
| 118 * and a status file containing the expected results when these tests are run. | 118 * and a status file containing the expected results when these tests are run. |
| 119 */ | 119 */ |
| 120 abstract class TestSuite { | 120 abstract class TestSuite { |
| 121 final Map configuration; | 121 final Map configuration; |
| 122 final String suiteName; | 122 final String suiteName; |
| 123 // This function is set by subclasses before enqueueing starts. | 123 // This function is set by subclasses before enqueueing starts. |
| 124 Function doTest; | 124 Function doTest; |
| 125 Map<String, String> _environmentOverrides; | 125 Map<String, String> _environmentOverrides; |
| 126 RuntimeConfiguration runtimeConfiguration; |
| 126 | 127 |
| 127 TestSuite(this.configuration, this.suiteName) { | 128 TestSuite(this.configuration, this.suiteName) { |
| 128 TestUtils.buildDir(configuration); // Sets configuration_directory. | 129 TestUtils.buildDir(configuration); // Sets configuration_directory. |
| 129 if (configuration['configuration_directory'] != null) { | 130 if (configuration['configuration_directory'] != null) { |
| 130 _environmentOverrides = { | 131 _environmentOverrides = { |
| 131 'DART_CONFIGURATION': configuration['configuration_directory'] | 132 'DART_CONFIGURATION': configuration['configuration_directory'] |
| 132 }; | 133 }; |
| 133 } | 134 } |
| 135 runtimeConfiguration = new RuntimeConfiguration(configuration); |
| 134 } | 136 } |
| 135 | 137 |
| 136 Map<String, String> get environmentOverrides => _environmentOverrides; | 138 Map<String, String> get environmentOverrides => _environmentOverrides; |
| 137 | 139 |
| 138 /** | 140 /** |
| 139 * Whether or not binaries should be found in the root build directory or | 141 * Whether or not binaries should be found in the root build directory or |
| 140 * in the built SDK. | 142 * in the built SDK. |
| 141 */ | 143 */ |
| 142 bool get useSdk { | 144 bool get useSdk { |
| 143 // The pub suite always uses the SDK. | 145 // The pub suite always uses the SDK. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]); | 288 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]); |
| 287 | 289 |
| 288 // This function will be called for every TestCase of this test suite. | 290 // This function will be called for every TestCase of this test suite. |
| 289 // It will | 291 // It will |
| 290 // - handle sharding | 292 // - handle sharding |
| 291 // - update SummaryReport | 293 // - update SummaryReport |
| 292 // - handle SKIP/SKIP_BY_DESIGN markers | 294 // - handle SKIP/SKIP_BY_DESIGN markers |
| 293 // - test if the selector matches | 295 // - test if the selector matches |
| 294 // and will enqueue the test (if necessary). | 296 // and will enqueue the test (if necessary). |
| 295 void enqueueNewTestCase(TestCase testCase) { | 297 void enqueueNewTestCase(TestCase testCase) { |
| 298 if (testCase.isNegative && runtimeConfiguration.shouldSkipNegativeTests) { |
| 299 return; |
| 300 } |
| 296 var expectations = testCase.expectedOutcomes; | 301 var expectations = testCase.expectedOutcomes; |
| 297 | 302 |
| 298 // Handle sharding based on the original test path (i.e. all multitests | 303 // Handle sharding based on the original test path (i.e. all multitests |
| 299 // of a given original test belong to the same shard) | 304 // of a given original test belong to the same shard) |
| 300 int shards = configuration['shards']; | 305 int shards = configuration['shards']; |
| 301 if (shards > 1 && testCase.hash % shards != configuration['shard'] - 1) { | 306 if (shards > 1 && testCase.hash % shards != configuration['shard'] - 1) { |
| 302 return; | 307 return; |
| 303 } | 308 } |
| 304 // Test if the selector includes this test. | 309 // Test if the selector includes this test. |
| 305 RegExp pattern = configuration['selectors'][suiteName]; | 310 RegExp pattern = configuration['selectors'][suiteName]; |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 } | 1093 } |
| 1089 } | 1094 } |
| 1090 | 1095 |
| 1091 CommandArtifact compilationArtifact = | 1096 CommandArtifact compilationArtifact = |
| 1092 compilerConfiguration.computeCompilationArtifact( | 1097 compilerConfiguration.computeCompilationArtifact( |
| 1093 buildDir, | 1098 buildDir, |
| 1094 tempDir, | 1099 tempDir, |
| 1095 CommandBuilder.instance, | 1100 CommandBuilder.instance, |
| 1096 compileTimeArguments, | 1101 compileTimeArguments, |
| 1097 environmentOverrides); | 1102 environmentOverrides); |
| 1098 commands.addAll(compilationArtifact.commands); | 1103 if (!configuration['skip-compilation']) { |
| 1104 commands.addAll(compilationArtifact.commands); |
| 1105 } |
| 1099 | 1106 |
| 1100 if (expectCompileError(info) && compilerConfiguration.hasCompiler) { | 1107 if (expectCompileError(info) && compilerConfiguration.hasCompiler) { |
| 1101 // Do not attempt to run the compiled result. A compilation | 1108 // Do not attempt to run the compiled result. A compilation |
| 1102 // error should be reported by the compilation command. | 1109 // error should be reported by the compilation command. |
| 1103 return commands; | 1110 return commands; |
| 1104 } | 1111 } |
| 1105 | 1112 |
| 1106 RuntimeConfiguration runtimeConfiguration = | |
| 1107 new RuntimeConfiguration(configuration); | |
| 1108 List<String> runtimeArguments = | 1113 List<String> runtimeArguments = |
| 1109 compilerConfiguration.computeRuntimeArguments( | 1114 compilerConfiguration.computeRuntimeArguments( |
| 1110 runtimeConfiguration, | 1115 runtimeConfiguration, |
| 1111 buildDir, | 1116 buildDir, |
| 1112 info, | 1117 info, |
| 1113 vmOptions, | 1118 vmOptions, |
| 1114 sharedOptions, | 1119 sharedOptions, |
| 1115 args, | 1120 args, |
| 1116 compilationArtifact); | 1121 compilationArtifact); |
| 1117 | 1122 |
| (...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2532 } | 2537 } |
| 2533 if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) { | 2538 if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) { |
| 2534 ++shortNameCounter; | 2539 ++shortNameCounter; |
| 2535 var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH); | 2540 var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH); |
| 2536 path = "short${shortNameCounter}_$pathEnd"; | 2541 path = "short${shortNameCounter}_$pathEnd"; |
| 2537 } | 2542 } |
| 2538 } | 2543 } |
| 2539 return path; | 2544 return path; |
| 2540 } | 2545 } |
| 2541 } | 2546 } |
| OLD | NEW |