Chromium Code Reviews| 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 608 }, | 608 }, |
| 609 onDone: listCompleter.complete); | 609 onDone: listCompleter.complete); |
| 610 } | 610 } |
| 611 | 611 |
| 612 void enqueueFile(String filename, FutureGroup group) { | 612 void enqueueFile(String filename, FutureGroup group) { |
| 613 if (!isTestFile(filename)) return; | 613 if (!isTestFile(filename)) return; |
| 614 Path filePath = new Path(filename); | 614 Path filePath = new Path(filename); |
| 615 | 615 |
| 616 // Only run the tests that match the pattern. | 616 // Only run the tests that match the pattern. |
| 617 RegExp pattern = configuration['selectors'][suiteName]; | 617 RegExp pattern = configuration['selectors'][suiteName]; |
| 618 if (!pattern.hasMatch('$filePath')) return; | |
| 619 if (filePath.filename.endsWith('test_config.dart')) return; | 618 if (filePath.filename.endsWith('test_config.dart')) return; |
| 620 | 619 |
| 621 var optionsFromFile = readOptionsFromFile(filePath); | 620 var optionsFromFile = readOptionsFromFile(filePath); |
| 622 CreateTest createTestCase = makeTestCaseCreator(optionsFromFile); | 621 CreateTest createTestCase = makeTestCaseCreator(pattern, optionsFromFile); |
| 623 | 622 |
| 624 if (optionsFromFile['isMultitest']) { | 623 if (optionsFromFile['isMultitest']) { |
| 625 group.add(doMultitest(filePath, buildDir, suiteDir, createTestCase)); | 624 group.add(doMultitest(filePath, buildDir, suiteDir, createTestCase)); |
|
kustermann
2013/07/05 08:41:37
doMultitest() will basically call [createTestCase]
| |
| 626 } else { | 625 } else { |
| 627 createTestCase(filePath, | 626 createTestCase(filePath, |
| 628 optionsFromFile['hasCompileError'], | 627 optionsFromFile['hasCompileError'], |
| 629 optionsFromFile['hasRuntimeError']); | 628 optionsFromFile['hasRuntimeError']); |
| 630 } | 629 } |
| 631 } | 630 } |
| 632 | 631 |
| 633 void enqueueTestCaseFromTestInformation(TestInformation info) { | 632 void enqueueTestCaseFromTestInformation(TestInformation info) { |
| 634 var filePath = info.filePath; | 633 var filePath = info.filePath; |
| 635 var optionsFromFile = info.optionsFromFile; | 634 var optionsFromFile = info.optionsFromFile; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 801 case 'dart2analyzer': | 800 case 'dart2analyzer': |
| 802 var arguments = new List.from(vmOptions); | 801 var arguments = new List.from(vmOptions); |
| 803 arguments.addAll(args); | 802 arguments.addAll(args); |
| 804 return <Command>[new Command(dartShellFileName, arguments)]; | 803 return <Command>[new Command(dartShellFileName, arguments)]; |
| 805 | 804 |
| 806 default: | 805 default: |
| 807 throw 'Unknown compiler ${configuration["compiler"]}'; | 806 throw 'Unknown compiler ${configuration["compiler"]}'; |
| 808 } | 807 } |
| 809 } | 808 } |
| 810 | 809 |
| 811 CreateTest makeTestCaseCreator(Map optionsFromFile) { | 810 CreateTest makeTestCaseCreator(RegExp pattern, Map optionsFromFile) { |
| 812 return (Path filePath, | 811 return (Path filePath, |
| 813 bool hasCompileError, | 812 bool hasCompileError, |
| 814 bool hasRuntimeError, | 813 bool hasRuntimeError, |
| 815 {bool isNegativeIfChecked: false, | 814 {bool isNegativeIfChecked: false, |
| 816 bool hasFatalTypeErrors: false, | 815 bool hasFatalTypeErrors: false, |
| 817 Set<String> multitestOutcome: null}) { | 816 Set<String> multitestOutcome: null}) { |
| 818 // Cache the test information for each test case. | 817 if (pattern.hasMatch('$filePath')) { |
| 819 var info = new TestInformation(filePath, | 818 // Cache the test information for each test case. |
| 820 optionsFromFile, | 819 var info = new TestInformation(filePath, |
| 821 hasCompileError, | 820 optionsFromFile, |
| 822 hasRuntimeError, | 821 hasCompileError, |
| 823 isNegativeIfChecked, | 822 hasRuntimeError, |
| 824 hasFatalTypeErrors, | 823 isNegativeIfChecked, |
| 825 multitestOutcome); | 824 hasFatalTypeErrors, |
| 826 cachedTests.add(info); | 825 multitestOutcome); |
| 827 enqueueTestCaseFromTestInformation(info); | 826 cachedTests.add(info); |
| 827 enqueueTestCaseFromTestInformation(info); | |
| 828 } | |
| 828 }; | 829 }; |
| 829 } | 830 } |
| 830 | 831 |
| 831 | 832 |
| 832 /** | 833 /** |
| 833 * _createUrlPathFromFile takes a [file], which is either located in the dart | 834 * _createUrlPathFromFile takes a [file], which is either located in the dart |
| 834 * or in the build directory, and will return a String representing | 835 * or in the build directory, and will return a String representing |
| 835 * the relative path to either the dart or the build directory. | 836 * the relative path to either the dart or the build directory. |
| 836 * Thus, the returned [String] will be the path component of the URL | 837 * Thus, the returned [String] will be the path component of the URL |
| 837 * corresponding to [file] (the http server serves files relative to the | 838 * corresponding to [file] (the http server serves files relative to the |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1965 * $pass tests are expected to pass | 1966 * $pass tests are expected to pass |
| 1966 * $failOk tests are expected to fail that we won't fix | 1967 * $failOk tests are expected to fail that we won't fix |
| 1967 * $fail tests are expected to fail that we should fix | 1968 * $fail tests are expected to fail that we should fix |
| 1968 * $crash tests are expected to crash that we should fix | 1969 * $crash tests are expected to crash that we should fix |
| 1969 * $timeout tests are allowed to timeout | 1970 * $timeout tests are allowed to timeout |
| 1970 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1971 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 1971 """; | 1972 """; |
| 1972 print(report); | 1973 print(report); |
| 1973 } | 1974 } |
| 1974 } | 1975 } |
| OLD | NEW |