Chromium Code Reviews| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 runnerPath = TestUtils.buildDir(configuration) + runnerName; | 62 runnerPath = TestUtils.buildDir(configuration) + runnerName; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void complexStatusMatching() => false; | 65 void complexStatusMatching() => false; |
| 66 | 66 |
| 67 void testNameHandler(String testName, ignore) { | 67 void testNameHandler(String testName, ignore) { |
| 68 if (testName == "") { | 68 if (testName == "") { |
| 69 receiveTestName.close(); | 69 receiveTestName.close(); |
| 70 doDone(true); | 70 doDone(true); |
| 71 } else { | 71 } else { |
| 72 // If patterns are given only list the files that match one of the | 72 // Only run the tests that match the pattern. Use the name |
|
Bill Hesse
2011/12/02 10:21:05
Are you only allowing one pattern per suite? What
Mads Ager (google)
2011/12/02 10:36:53
If you want that you probably have a failure and w
| |
| 73 // patterns. Use the name "suiteName/testName" for cc tests. | 73 // "suiteName/testName" for cc tests. |
| 74 var patterns = configuration['patterns']; | 74 RegExp pattern = configuration['selectors'][suiteName]; |
| 75 if (!patterns.isEmpty()) { | 75 String constructedName = '$suiteName/$testName'; |
| 76 var constructedName = '$suiteName/$testName'; | 76 if (!pattern.hasMatch(constructedName)) return; |
| 77 if (!patterns.some((re) => re.hasMatch(constructedName))) return; | |
| 78 } | |
| 79 | 77 |
| 80 var expectations = testExpectations.expectations(testName); | 78 var expectations = testExpectations.expectations(testName); |
| 81 | 79 |
| 82 if (expectations.contains(SKIP)) return; | 80 if (expectations.contains(SKIP)) return; |
| 83 | 81 |
| 84 // The cc test runner takes options after the name of the test | 82 // The cc test runner takes options after the name of the test |
| 85 // to run. | 83 // to run. |
| 86 var args = [testName]; | 84 var args = [testName]; |
| 87 args.addAll(TestUtils.standardOptions(configuration)); | 85 args.addAll(TestUtils.standardOptions(configuration)); |
| 88 var timeout = configuration['timeout']; | 86 var timeout = configuration['timeout']; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 117 }); | 115 }); |
| 118 } | 116 } |
| 119 | 117 |
| 120 void completeHandler(TestCase testCase) { | 118 void completeHandler(TestCase testCase) { |
| 121 } | 119 } |
| 122 } | 120 } |
| 123 | 121 |
| 124 | 122 |
| 125 class StandardTestSuite implements TestSuite { | 123 class StandardTestSuite implements TestSuite { |
| 126 Map configuration; | 124 Map configuration; |
| 125 String suiteName; | |
| 127 String directoryPath; | 126 String directoryPath; |
| 128 List<String> statusFilePaths; | 127 List<String> statusFilePaths; |
| 129 Function doTest; | 128 Function doTest; |
| 130 Function doDone; | 129 Function doDone; |
| 131 int activeMultitests = 0; | 130 int activeMultitests = 0; |
| 132 bool listingDone = false; | 131 bool listingDone = false; |
| 133 String shellPath; | 132 String shellPath; |
| 134 TestExpectations testExpectations; | 133 TestExpectations testExpectations; |
| 135 | 134 |
| 136 StandardTestSuite(Map this.configuration, | 135 StandardTestSuite(Map this.configuration, |
| 136 String this.suiteName, | |
| 137 String this.directoryPath, | 137 String this.directoryPath, |
| 138 List<String> this.statusFilePaths) { | 138 List<String> this.statusFilePaths) { |
| 139 shellPath = TestUtils.dartShellFileName(configuration) ; | 139 shellPath = TestUtils.dartShellFileName(configuration) ; |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 void isTestFile(String filename) => filename.endsWith("Test.dart"); | 143 void isTestFile(String filename) => filename.endsWith("Test.dart"); |
| 144 | 144 |
| 145 void listRecursively() => false; | 145 void listRecursively() => false; |
| 146 | 146 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 171 throw s; | 171 throw s; |
| 172 }; | 172 }; |
| 173 dir.fileHandler = processFile; | 173 dir.fileHandler = processFile; |
| 174 dir.doneHandler = directoryListingDone; | 174 dir.doneHandler = directoryListingDone; |
| 175 dir.list(recursive: listRecursively()); | 175 dir.list(recursive: listRecursively()); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void processFile(String filename) { | 178 void processFile(String filename) { |
| 179 if (!isTestFile(filename)) return; | 179 if (!isTestFile(filename)) return; |
| 180 | 180 |
| 181 // If patterns are given only list the files that match one of the | 181 // Only run the tests that match the pattern. |
| 182 // patterns. | 182 RegExp pattern = configuration['selectors'][suiteName]; |
| 183 var patterns = configuration['patterns']; | 183 if (!pattern.hasMatch(filename)) return; |
| 184 if (!patterns.isEmpty() && | |
| 185 !patterns.some((re) => re.hasMatch(filename))) { | |
| 186 return; | |
| 187 } | |
| 188 | |
| 189 | 184 |
| 190 var timeout = configuration['timeout']; | 185 var timeout = configuration['timeout']; |
| 191 var optionsFromFile = optionsFromFile(filename); | 186 var optionsFromFile = optionsFromFile(filename); |
| 192 | 187 |
| 193 Function createTestCase(String filename, | 188 Function createTestCase(String filename, |
| 194 bool isNegative, | 189 bool isNegative, |
| 195 [bool isNegativeIfChecked = false]) { | 190 [bool isNegativeIfChecked = false]) { |
| 196 // Look up expectations in status files using a modified file path. | 191 // Look up expectations in status files using a modified file path. |
| 197 String pathSeparator = new Platform().pathSeparator(); | 192 String pathSeparator = new Platform().pathSeparator(); |
| 198 String testName; | 193 String testName; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 args.add("--enable_leg"); | 393 args.add("--enable_leg"); |
| 399 } | 394 } |
| 400 if (configuration["component"] == "dartc") { | 395 if (configuration["component"] == "dartc") { |
| 401 if (configuration["mode"] == "release") { | 396 if (configuration["mode"] == "release") { |
| 402 args.add("--optimize"); | 397 args.add("--optimize"); |
| 403 } | 398 } |
| 404 } | 399 } |
| 405 return args; | 400 return args; |
| 406 } | 401 } |
| 407 } | 402 } |
| OLD | NEW |