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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 /** | 400 /** |
401 * A standard [TestSuite] implementation that searches for tests in a | 401 * A standard [TestSuite] implementation that searches for tests in a |
402 * directory, and creates [TestCase]s that compile and/or run them. | 402 * directory, and creates [TestCase]s that compile and/or run them. |
403 */ | 403 */ |
404 class StandardTestSuite extends TestSuite { | 404 class StandardTestSuite extends TestSuite { |
405 final Path suiteDir; | 405 final Path suiteDir; |
406 final List<String> statusFilePaths; | 406 final List<String> statusFilePaths; |
407 TestCaseEvent doTest; | 407 TestCaseEvent doTest; |
408 TestExpectations testExpectations; | 408 TestExpectations testExpectations; |
409 List<TestInformation> cachedTests; | |
410 final Path dartDir; | 409 final Path dartDir; |
411 Predicate<String> isTestFilePredicate; | 410 Predicate<String> isTestFilePredicate; |
412 final bool listRecursively; | 411 final bool listRecursively; |
413 /** | 412 /** |
414 * The set of servers that have been started to run these tests (Could be | 413 * The set of servers that have been started to run these tests (Could be |
415 * none). | 414 * none). |
416 */ | 415 */ |
417 List serverList; | 416 List serverList; |
418 | 417 |
419 StandardTestSuite(Map configuration, | 418 StandardTestSuite(Map configuration, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 updateDartium().then((_) { | 494 updateDartium().then((_) { |
496 doTest = onTest; | 495 doTest = onTest; |
497 | 496 |
498 return readExpectations(); | 497 return readExpectations(); |
499 }).then((expectations) { | 498 }).then((expectations) { |
500 testExpectations = expectations; | 499 testExpectations = expectations; |
501 | 500 |
502 // Checked if we have already found and generated the tests for | 501 // Checked if we have already found and generated the tests for |
503 // this suite. | 502 // this suite. |
504 if (!testCache.containsKey(suiteName)) { | 503 if (!testCache.containsKey(suiteName)) { |
505 cachedTests = testCache[suiteName] = []; | 504 testCache[suiteName] = []; |
506 return enqueueTests(); | 505 return enqueueTests(); |
507 } else { | 506 } else { |
508 // We rely on enqueueing completing asynchronously. | 507 // We rely on enqueueing completing asynchronously. |
509 return asynchronously(() { | 508 return asynchronously(() { |
510 for (var info in testCache[suiteName]) { | 509 for (var info in testCache[suiteName]) { |
511 enqueueTestCaseFromTestInformation(info); | 510 enqueueTestCaseFromTestInformation(info); |
512 } | 511 } |
513 }); | 512 }); |
514 } | 513 } |
515 }).then((_) { | 514 }).then((_) { |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 bool hasFatalTypeErrors: false, | 795 bool hasFatalTypeErrors: false, |
797 Set<String> multitestOutcome: null}) { | 796 Set<String> multitestOutcome: null}) { |
798 // Cache the test information for each test case. | 797 // Cache the test information for each test case. |
799 var info = new TestInformation(filePath, | 798 var info = new TestInformation(filePath, |
800 optionsFromFile, | 799 optionsFromFile, |
801 hasCompileError, | 800 hasCompileError, |
802 hasRuntimeError, | 801 hasRuntimeError, |
803 isNegativeIfChecked, | 802 isNegativeIfChecked, |
804 hasFatalTypeErrors, | 803 hasFatalTypeErrors, |
805 multitestOutcome); | 804 multitestOutcome); |
806 cachedTests.add(info); | |
807 enqueueTestCaseFromTestInformation(info); | 805 enqueueTestCaseFromTestInformation(info); |
808 }; | 806 }; |
809 } | 807 } |
810 | 808 |
811 /** | 809 /** |
812 * The [StandardTestSuite] has support for tests that | 810 * The [StandardTestSuite] has support for tests that |
813 * compile a test from Dart to JavaScript, and then run the resulting | 811 * compile a test from Dart to JavaScript, and then run the resulting |
814 * JavaScript. This function creates a working directory to hold the | 812 * JavaScript. This function creates a working directory to hold the |
815 * JavaScript version of the test, and copies the appropriate framework | 813 * JavaScript version of the test, and copies the appropriate framework |
816 * files to that directory. It creates a [BrowserTestCase], which has | 814 * files to that directory. It creates a [BrowserTestCase], which has |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 * $pass tests are expected to pass | 1829 * $pass tests are expected to pass |
1832 * $failOk tests are expected to fail that we won't fix | 1830 * $failOk tests are expected to fail that we won't fix |
1833 * $fail tests are expected to fail that we should fix | 1831 * $fail tests are expected to fail that we should fix |
1834 * $crash tests are expected to crash that we should fix | 1832 * $crash tests are expected to crash that we should fix |
1835 * $timeout tests are allowed to timeout | 1833 * $timeout tests are allowed to timeout |
1836 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1834 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
1837 """; | 1835 """; |
1838 print(report); | 1836 print(report); |
1839 } | 1837 } |
1840 } | 1838 } |
OLD | NEW |