| 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_suite"); | 5 #library("test_suite"); |
| 6 | 6 |
| 7 #import("status_file_parser.dart"); | 7 #import("status_file_parser.dart"); |
| 8 #import("test_runner.dart"); | 8 #import("test_runner.dart"); |
| 9 #import("multitest.dart"); | 9 #import("multitest.dart"); |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 if (configuration["report"]) { | 80 if (configuration["report"]) { |
| 81 SummaryReport.add(expectations); | 81 SummaryReport.add(expectations); |
| 82 } | 82 } |
| 83 | 83 |
| 84 if (expectations.contains(SKIP)) return; | 84 if (expectations.contains(SKIP)) return; |
| 85 | 85 |
| 86 // The cc test runner takes options after the name of the test | 86 // The cc test runner takes options after the name of the test |
| 87 // to run. | 87 // to run. |
| 88 var args = [testName]; | 88 var args = [testName]; |
| 89 args.addAll(TestUtils.standardOptions(configuration)); | 89 args.addAll(TestUtils.standardOptions(configuration)); |
| 90 var timeout = configuration['timeout']; | |
| 91 | 90 |
| 92 doTest(new TestCase(testName, | 91 doTest(new TestCase(testName, |
| 93 runnerPath, | 92 runnerPath, |
| 94 args, | 93 args, |
| 95 timeout, | 94 configuration, |
| 96 completeHandler, | 95 completeHandler, |
| 97 expectations)); | 96 expectations)); |
| 98 | 97 |
| 99 receiveTestName.receive(testNameHandler); | 98 receiveTestName.receive(testNameHandler); |
| 100 } | 99 } |
| 101 } | 100 } |
| 102 | 101 |
| 103 void forEachTest(Function onTest, [Function onDone]) { | 102 void forEachTest(Function onTest, [Function onDone]) { |
| 104 doTest = onTest; | 103 doTest = onTest; |
| 105 doDone = (ignore) => (onDone != null) ? onDone() : null; | 104 doDone = (ignore) => (onDone != null) ? onDone() : null; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 directoryPath = getDirname(directoryPath); | 169 directoryPath = getDirname(directoryPath); |
| 171 Directory dir = new Directory(directoryPath); | 170 Directory dir = new Directory(directoryPath); |
| 172 dir.errorHandler = (s) { | 171 dir.errorHandler = (s) { |
| 173 throw s; | 172 throw s; |
| 174 }; | 173 }; |
| 175 dir.fileHandler = processFile; | 174 dir.fileHandler = processFile; |
| 176 dir.doneHandler = directoryListingDone; | 175 dir.doneHandler = directoryListingDone; |
| 177 dir.list(recursive: listRecursively()); | 176 dir.list(recursive: listRecursively()); |
| 178 } | 177 } |
| 179 | 178 |
| 180 Function makeTestCaseCreator(Map optionsFromFile, int timeout) { | 179 Function makeTestCaseCreator(Map optionsFromFile, Map configuration) { |
| 181 return (String filename, | 180 return (String filename, |
| 182 bool isNegative, | 181 bool isNegative, |
| 183 [bool isNegativeIfChecked = false, | 182 [bool isNegativeIfChecked = false, |
| 184 bool enableFatalTypeErrors = false]) { | 183 bool enableFatalTypeErrors = false]) { |
| 185 // Look up expectations in status files using a modified file path. | 184 // Look up expectations in status files using a modified file path. |
| 186 String pathSeparator = new Platform().pathSeparator(); | 185 String pathSeparator = new Platform().pathSeparator(); |
| 187 String testName; | 186 String testName; |
| 188 int start = filename.lastIndexOf('src' + pathSeparator); | 187 int start = filename.lastIndexOf('src' + pathSeparator); |
| 189 if (start != -1) { | 188 if (start != -1) { |
| 190 testName = filename.substring(start + 4, filename.length - 5); | 189 testName = filename.substring(start + 4, filename.length - 5); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 214 | 213 |
| 215 isNegative = isNegative || | 214 isNegative = isNegative || |
| 216 (configuration['checked'] && isNegativeIfChecked); | 215 (configuration['checked'] && isNegativeIfChecked); |
| 217 var argumentLists = argumentListsFromFile(filename, | 216 var argumentLists = argumentListsFromFile(filename, |
| 218 optionsFromFile, | 217 optionsFromFile, |
| 219 enableFatalTypeErrors); | 218 enableFatalTypeErrors); |
| 220 for (var args in argumentLists) { | 219 for (var args in argumentLists) { |
| 221 doTest(new TestCase(testName, | 220 doTest(new TestCase(testName, |
| 222 shellPath(), | 221 shellPath(), |
| 223 args, | 222 args, |
| 224 timeout, | 223 configuration, |
| 225 completeHandler, | 224 completeHandler, |
| 226 expectations, | 225 expectations, |
| 227 isNegative)); | 226 isNegative)); |
| 228 } | 227 } |
| 229 }; | 228 }; |
| 230 } | 229 } |
| 231 | 230 |
| 232 void processFile(String filename) { | 231 void processFile(String filename) { |
| 233 if (!isTestFile(filename)) return; | 232 if (!isTestFile(filename)) return; |
| 234 | 233 |
| 235 // Only run the tests that match the pattern. | 234 // Only run the tests that match the pattern. |
| 236 RegExp pattern = configuration['selectors'][suiteName]; | 235 RegExp pattern = configuration['selectors'][suiteName]; |
| 237 if (!pattern.hasMatch(filename)) return; | 236 if (!pattern.hasMatch(filename)) return; |
| 238 | 237 |
| 239 var optionsFromFile = optionsFromFile(filename); | 238 var optionsFromFile = optionsFromFile(filename); |
| 240 var timeout = configuration['timeout']; | 239 Function createTestCase = |
| 241 Function createTestCase = makeTestCaseCreator(optionsFromFile, timeout); | 240 makeTestCaseCreator(optionsFromFile, configuration); |
| 242 | 241 |
| 243 if (optionsFromFile['isMultitest']) { | 242 if (optionsFromFile['isMultitest']) { |
| 244 bool supportsFatalTypeErrors = (configuration['component'] == 'dartc'); | 243 bool supportsFatalTypeErrors = (configuration['component'] == 'dartc'); |
| 245 testGeneratorStarted(); | 244 testGeneratorStarted(); |
| 246 DoMultitest(filename, | 245 DoMultitest(filename, |
| 247 TestUtils.buildDir(configuration), | 246 TestUtils.buildDir(configuration), |
| 248 directoryPath, | 247 directoryPath, |
| 249 supportsFatalTypeErrors, | 248 supportsFatalTypeErrors, |
| 250 createTestCase, | 249 createTestCase, |
| 251 testGeneratorDone); | 250 testGeneratorDone); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 * $noCrash tests are expected to be flaky but not crash | 542 * $noCrash tests are expected to be flaky but not crash |
| 544 * $pass tests are expected to pass | 543 * $pass tests are expected to pass |
| 545 * $failOk tests are expected to fail that we won't fix | 544 * $failOk tests are expected to fail that we won't fix |
| 546 * $fail tests are expected to fail that we should fix | 545 * $fail tests are expected to fail that we should fix |
| 547 * $crash tests are expected to crash that we should fix | 546 * $crash tests are expected to crash that we should fix |
| 548 * $timeout tests are allowed to timeout\ | 547 * $timeout tests are allowed to timeout\ |
| 549 """; | 548 """; |
| 550 print(report); | 549 print(report); |
| 551 } | 550 } |
| 552 } | 551 } |
| OLD | NEW |