Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(755)

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 11968016: Revert "Removed unused StandardTestSuite.cachedTests field" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
409 final Path dartDir; 410 final Path dartDir;
410 Predicate<String> isTestFilePredicate; 411 Predicate<String> isTestFilePredicate;
411 final bool listRecursively; 412 final bool listRecursively;
412 /** 413 /**
413 * The set of servers that have been started to run these tests (Could be 414 * The set of servers that have been started to run these tests (Could be
414 * none). 415 * none).
415 */ 416 */
416 List serverList; 417 List serverList;
417 418
418 StandardTestSuite(Map configuration, 419 StandardTestSuite(Map configuration,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 updateDartium().then((_) { 495 updateDartium().then((_) {
495 doTest = onTest; 496 doTest = onTest;
496 497
497 return readExpectations(); 498 return readExpectations();
498 }).then((expectations) { 499 }).then((expectations) {
499 testExpectations = expectations; 500 testExpectations = expectations;
500 501
501 // Checked if we have already found and generated the tests for 502 // Checked if we have already found and generated the tests for
502 // this suite. 503 // this suite.
503 if (!testCache.containsKey(suiteName)) { 504 if (!testCache.containsKey(suiteName)) {
504 testCache[suiteName] = []; 505 cachedTests = testCache[suiteName] = [];
505 return enqueueTests(); 506 return enqueueTests();
506 } else { 507 } else {
507 // We rely on enqueueing completing asynchronously. 508 // We rely on enqueueing completing asynchronously.
508 return asynchronously(() { 509 return asynchronously(() {
509 for (var info in testCache[suiteName]) { 510 for (var info in testCache[suiteName]) {
510 enqueueTestCaseFromTestInformation(info); 511 enqueueTestCaseFromTestInformation(info);
511 } 512 }
512 }); 513 });
513 } 514 }
514 }).then((_) { 515 }).then((_) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 var isNegative = info.hasCompileError; 618 var isNegative = info.hasCompileError;
618 if (info.hasRuntimeError && hasRuntime) { 619 if (info.hasRuntimeError && hasRuntime) {
619 isNegative = true; 620 isNegative = true;
620 } 621 }
621 622
622 // Look up expectations in status files using a test name generated 623 // Look up expectations in status files using a test name generated
623 // from the test file's path. 624 // from the test file's path.
624 String testName; 625 String testName;
625 626
626 if (optionsFromFile['isMultitest']) { 627 if (optionsFromFile['isMultitest']) {
627 // Multitests do not run on browsers.
628 if (TestUtils.isBrowserRuntime(configuration['runtime'])) return;
629 // Multitests are in [build directory]/generated_tests/... . 628 // Multitests are in [build directory]/generated_tests/... .
630 // The test name will be '[test filename (no extension)]/[multitest key]. 629 // The test name will be '[test filename (no extension)]/[multitest key].
631 String name = filePath.filenameWithoutExtension; 630 String name = filePath.filenameWithoutExtension;
632 int middle = name.lastIndexOf('_'); 631 int middle = name.lastIndexOf('_');
633 testName = '${name.substring(0, middle)}/${name.substring(middle + 1)}'; 632 testName = '${name.substring(0, middle)}/${name.substring(middle + 1)}';
634 } else { 633 } else {
635 // The test name is the relative path from the test suite directory to 634 // The test name is the relative path from the test suite directory to
636 // the test, with the .dart extension removed. 635 // the test, with the .dart extension removed.
637 Expect.isTrue(filePath.toNativePath().startsWith( 636 Expect.isTrue(filePath.toNativePath().startsWith(
638 suiteDir.toNativePath())); 637 suiteDir.toNativePath()));
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 bool hasFatalTypeErrors: false, 794 bool hasFatalTypeErrors: false,
796 Set<String> multitestOutcome: null}) { 795 Set<String> multitestOutcome: null}) {
797 // Cache the test information for each test case. 796 // Cache the test information for each test case.
798 var info = new TestInformation(filePath, 797 var info = new TestInformation(filePath,
799 optionsFromFile, 798 optionsFromFile,
800 hasCompileError, 799 hasCompileError,
801 hasRuntimeError, 800 hasRuntimeError,
802 isNegativeIfChecked, 801 isNegativeIfChecked,
803 hasFatalTypeErrors, 802 hasFatalTypeErrors,
804 multitestOutcome); 803 multitestOutcome);
804 cachedTests.add(info);
805 enqueueTestCaseFromTestInformation(info); 805 enqueueTestCaseFromTestInformation(info);
806 }; 806 };
807 } 807 }
808 808
809 /** 809 /**
810 * The [StandardTestSuite] has support for tests that 810 * The [StandardTestSuite] has support for tests that
811 * 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
812 * JavaScript. This function creates a working directory to hold the 812 * JavaScript. This function creates a working directory to hold the
813 * JavaScript version of the test, and copies the appropriate framework 813 * JavaScript version of the test, and copies the appropriate framework
814 * 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
1829 * $pass tests are expected to pass 1829 * $pass tests are expected to pass
1830 * $failOk tests are expected to fail that we won't fix 1830 * $failOk tests are expected to fail that we won't fix
1831 * $fail tests are expected to fail that we should fix 1831 * $fail tests are expected to fail that we should fix
1832 * $crash tests are expected to crash that we should fix 1832 * $crash tests are expected to crash that we should fix
1833 * $timeout tests are allowed to timeout 1833 * $timeout tests are allowed to timeout
1834 * $compileErrorSkip tests are skipped on browsers due to compile-time error 1834 * $compileErrorSkip tests are skipped on browsers due to compile-time error
1835 """; 1835 """;
1836 print(report); 1836 print(report);
1837 } 1837 }
1838 } 1838 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698