| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 * A specialized [TestSuite] that runs tests written in C to unit test | 93 * A specialized [TestSuite] that runs tests written in C to unit test |
| 94 * the Dart virtual machine and its API. | 94 * the Dart virtual machine and its API. |
| 95 * | 95 * |
| 96 * The tests are compiled into a monolithic executable by the build step. | 96 * The tests are compiled into a monolithic executable by the build step. |
| 97 * The executable lists its tests when run with the --list command line flag. | 97 * The executable lists its tests when run with the --list command line flag. |
| 98 * Individual tests are run by specifying them on the command line. | 98 * Individual tests are run by specifying them on the command line. |
| 99 */ | 99 */ |
| 100 class CCTestSuite implements TestSuite { | 100 class CCTestSuite implements TestSuite { |
| 101 Map configuration; | 101 Map configuration; |
| 102 final String suiteName; | 102 final String suiteName; |
| 103 final String testPrefix; |
| 103 String runnerPath; | 104 String runnerPath; |
| 104 final String dartDir; | 105 final String dartDir; |
| 105 List<String> statusFilePaths; | 106 List<String> statusFilePaths; |
| 106 Function doTest; | 107 Function doTest; |
| 107 Function doDone; | 108 Function doDone; |
| 108 ReceivePort receiveTestName; | 109 ReceivePort receiveTestName; |
| 109 TestExpectations testExpectations; | 110 TestExpectations testExpectations; |
| 110 | 111 |
| 111 CCTestSuite(Map this.configuration, | 112 CCTestSuite(Map this.configuration, |
| 112 String this.suiteName, | 113 String this.suiteName, |
| 113 String runnerName, | 114 String runnerName, |
| 114 List<String> this.statusFilePaths) | 115 List<String> this.statusFilePaths, |
| 116 [this.testPrefix = '']) |
| 115 : dartDir = TestUtils.dartDir() { | 117 : dartDir = TestUtils.dartDir() { |
| 116 runnerPath = TestUtils.buildDir(configuration) + '/' + runnerName; | 118 runnerPath = TestUtils.buildDir(configuration) + '/' + runnerName; |
| 117 } | 119 } |
| 118 | 120 |
| 119 void testNameHandler(String testName, ignore) { | 121 void testNameHandler(String testName, ignore) { |
| 120 if (testName == "") { | 122 if (testName == "") { |
| 121 receiveTestName.close(); | 123 receiveTestName.close(); |
| 122 doDone(true); | 124 doDone(true); |
| 123 } else { | 125 } else { |
| 124 // Only run the tests that match the pattern. Use the name | 126 // Only run the tests that match the pattern. Use the name |
| 125 // "suiteName/testName" for cc tests. | 127 // "suiteName/testName" for cc tests. |
| 126 RegExp pattern = configuration['selectors'][suiteName]; | 128 RegExp pattern = configuration['selectors'][suiteName]; |
| 127 String constructedName = '$suiteName/$testName'; | 129 String constructedName = '$suiteName/$testPrefix$testName'; |
| 128 if (!pattern.hasMatch(constructedName)) return; | 130 if (!pattern.hasMatch(constructedName)) return; |
| 129 | 131 |
| 130 var expectations = testExpectations.expectations(testName); | 132 var expectations = testExpectations.expectations( |
| 133 '$testPrefix$testName'); |
| 131 | 134 |
| 132 if (configuration["report"]) { | 135 if (configuration["report"]) { |
| 133 SummaryReport.add(expectations); | 136 SummaryReport.add(expectations); |
| 134 } | 137 } |
| 135 | 138 |
| 136 if (expectations.contains(SKIP)) return; | 139 if (expectations.contains(SKIP)) return; |
| 137 | 140 |
| 138 // The cc test runner takes options after the name of the test | 141 // The cc test runner takes options after the name of the test |
| 139 // to run. | 142 // to run. |
| 140 var args = [testName]; | 143 var args = [testName]; |
| 141 args.addAll(TestUtils.standardOptions(configuration)); | 144 args.addAll(TestUtils.standardOptions(configuration)); |
| 142 | 145 |
| 143 doTest(new TestCase('$suiteName/$testName', | 146 doTest(new TestCase(constructedName, |
| 144 [new Command(runnerPath, args)], | 147 [new Command(runnerPath, args)], |
| 145 configuration, | 148 configuration, |
| 146 completeHandler, | 149 completeHandler, |
| 147 expectations)); | 150 expectations)); |
| 148 } | 151 } |
| 149 } | 152 } |
| 150 | 153 |
| 151 void forEachTest(Function onTest, Map testCache, String globalTempDir(), | 154 void forEachTest(Function onTest, Map testCache, String globalTempDir(), |
| 152 [Function onDone]) { | 155 [Function onDone]) { |
| 153 doTest = onTest; | 156 doTest = onTest; |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 * $noCrash tests are expected to be flaky but not crash | 1397 * $noCrash tests are expected to be flaky but not crash |
| 1395 * $pass tests are expected to pass | 1398 * $pass tests are expected to pass |
| 1396 * $failOk tests are expected to fail that we won't fix | 1399 * $failOk tests are expected to fail that we won't fix |
| 1397 * $fail tests are expected to fail that we should fix | 1400 * $fail tests are expected to fail that we should fix |
| 1398 * $crash tests are expected to crash that we should fix | 1401 * $crash tests are expected to crash that we should fix |
| 1399 * $timeout tests are allowed to timeout | 1402 * $timeout tests are allowed to timeout |
| 1400 """; | 1403 """; |
| 1401 print(report); | 1404 print(report); |
| 1402 } | 1405 } |
| 1403 } | 1406 } |
| OLD | NEW |