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

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

Issue 645533002: Clean up test_runner Command subclass hash/equality. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove stray changes Created 6 years, 2 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 | « tools/testing/dart/test_runner.dart ('k') | tools/testing/dart/utils.dart » ('j') | 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 * object for each test to be run, and passes the test cases to a callback. 115 * object for each test to be run, and passes the test cases to a callback.
116 * 116 *
117 * Most TestSuites represent a directory or directory tree containing tests, 117 * Most TestSuites represent a directory or directory tree containing tests,
118 * and a status file containing the expected results when these tests are run. 118 * and a status file containing the expected results when these tests are run.
119 */ 119 */
120 abstract class TestSuite { 120 abstract class TestSuite {
121 final Map configuration; 121 final Map configuration;
122 final String suiteName; 122 final String suiteName;
123 // This function is set by subclasses before enqueueing starts. 123 // This function is set by subclasses before enqueueing starts.
124 Function doTest; 124 Function doTest;
125 Map<String, String> _environmentOverrides;
125 126
126 127 TestSuite(this.configuration, this.suiteName) {
127 TestSuite(this.configuration, this.suiteName); 128 _environmentOverrides = {
128 129 'DART_CONFIGURATION' : TestUtils.configurationDir(configuration)
129 Map<String, String> get environmentOverrides {
130 return {
131 'DART_CONFIGURATION' : TestUtils.configurationDir(configuration),
132 }; 130 };
133 } 131 }
134 132
133 Map<String, String> get environmentOverrides => _environmentOverrides;
134
135 /** 135 /**
136 * Whether or not binaries should be found in the root build directory or 136 * Whether or not binaries should be found in the root build directory or
137 * in the built SDK. 137 * in the built SDK.
138 */ 138 */
139 bool get useSdk { 139 bool get useSdk {
140 // The pub suite always uses the SDK. 140 // The pub suite always uses the SDK.
141 // TODO(rnystrom): Eventually, all test suites should run out of the SDK 141 // TODO(rnystrom): Eventually, all test suites should run out of the SDK
142 // and this check should go away. 142 // and this check should go away.
143 // TODO(ahe): This check is broken for several reasons: 143 // TODO(ahe): This check is broken for several reasons:
144 // First, it is not true that all tests should be running out of the 144 // First, it is not true that all tests should be running out of the
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 */ 589 */
590 class StandardTestSuite extends TestSuite { 590 class StandardTestSuite extends TestSuite {
591 final Path suiteDir; 591 final Path suiteDir;
592 final List<String> statusFilePaths; 592 final List<String> statusFilePaths;
593 TestExpectations testExpectations; 593 TestExpectations testExpectations;
594 List<TestInformation> cachedTests; 594 List<TestInformation> cachedTests;
595 final Path dartDir; 595 final Path dartDir;
596 Predicate<String> isTestFilePredicate; 596 Predicate<String> isTestFilePredicate;
597 final bool listRecursively; 597 final bool listRecursively;
598 final extraVmOptions; 598 final extraVmOptions;
599 List<Uri> _dart2JsBootstrapDependencies;
599 600
600 StandardTestSuite(Map configuration, 601 StandardTestSuite(Map configuration,
601 String suiteName, 602 String suiteName,
602 Path suiteDirectory, 603 Path suiteDirectory,
603 this.statusFilePaths, 604 this.statusFilePaths,
604 {this.isTestFilePredicate, 605 {this.isTestFilePredicate,
605 bool recursive: false}) 606 bool recursive: false})
606 : super(configuration, suiteName), 607 : super(configuration, suiteName),
607 dartDir = TestUtils.dartDir, 608 dartDir = TestUtils.dartDir,
608 listRecursively = recursive, 609 listRecursively = recursive,
609 suiteDir = TestUtils.dartDir.join(suiteDirectory), 610 suiteDir = TestUtils.dartDir.join(suiteDirectory),
610 extraVmOptions = TestUtils.getExtraVmOptions(configuration); 611 extraVmOptions = TestUtils.getExtraVmOptions(configuration) {
612 if (!useSdk) {
613 _dart2JsBootstrapDependencies = [];
614 } else {
615 var snapshotPath = TestUtils.absolutePath(new Path(buildDir).join(
616 new Path('dart-sdk/bin/snapshots/'
617 'utils_wrapper.dart.snapshot'))).toString();
618 _dart2JsBootstrapDependencies =
619 [new Uri(scheme: 'file', path: snapshotPath)];
620 }
621 }
611 622
612 /** 623 /**
613 * Creates a test suite whose file organization matches an expected structure. 624 * Creates a test suite whose file organization matches an expected structure.
614 * To use this, your suite should look like: 625 * To use this, your suite should look like:
615 * 626 *
616 * dart/ 627 * dart/
617 * path/ 628 * path/
618 * to/ 629 * to/
619 * mytestsuite/ 630 * mytestsuite/
620 * mytestsuite.status 631 * mytestsuite.status
(...skipping 23 matching lines...) Expand all
644 '$directory/${name}_analyzer.status', 655 '$directory/${name}_analyzer.status',
645 '$directory/${name}_analyzer2.status']; 656 '$directory/${name}_analyzer2.status'];
646 657
647 return new StandardTestSuite(configuration, 658 return new StandardTestSuite(configuration,
648 name, directory, 659 name, directory,
649 status_paths, 660 status_paths,
650 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), 661 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'),
651 recursive: true); 662 recursive: true);
652 } 663 }
653 664
654 List<Uri> get dart2JsBootstrapDependencies { 665 List<Uri> get dart2JsBootstrapDependencies => _dart2JsBootstrapDependencies;
655 if (!useSdk) return [];
656
657 var snapshotPath = TestUtils.absolutePath(new Path(buildDir).join(
658 new Path('dart-sdk/bin/snapshots/'
659 'utils_wrapper.dart.snapshot'))).toString();
660 return [new Uri(scheme: 'file', path: snapshotPath)];
661 }
662 666
663 /** 667 /**
664 * The default implementation assumes a file is a test if 668 * The default implementation assumes a file is a test if
665 * it ends in "Test.dart". 669 * it ends in "Test.dart".
666 */ 670 */
667 bool isTestFile(String filename) { 671 bool isTestFile(String filename) {
668 // Use the specified predicate, if provided. 672 // Use the specified predicate, if provided.
669 if (isTestFilePredicate != null) return isTestFilePredicate(filename); 673 if (isTestFilePredicate != null) return isTestFilePredicate(filename);
670 674
671 return filename.endsWith("Test.dart"); 675 return filename.endsWith("Test.dart");
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 * $pass tests are expected to pass 2337 * $pass tests are expected to pass
2334 * $failOk tests are expected to fail that we won't fix 2338 * $failOk tests are expected to fail that we won't fix
2335 * $fail tests are expected to fail that we should fix 2339 * $fail tests are expected to fail that we should fix
2336 * $crash tests are expected to crash that we should fix 2340 * $crash tests are expected to crash that we should fix
2337 * $timeout tests are allowed to timeout 2341 * $timeout tests are allowed to timeout
2338 * $compileErrorSkip tests are skipped on browsers due to compile-time error 2342 * $compileErrorSkip tests are skipped on browsers due to compile-time error
2339 """; 2343 """;
2340 print(report); 2344 print(report);
2341 } 2345 }
2342 } 2346 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | tools/testing/dart/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698