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

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

Issue 234673003: Reduce test.dart memory usage. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve Created 6 years, 8 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
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 ? '$buildDir/dart-sdk/bin/dart$suffix' 196 ? '$buildDir/dart-sdk/bin/dart$suffix'
197 : '$buildDir/dart$suffix'; 197 : '$buildDir/dart$suffix';
198 } 198 }
199 199
200 TestUtils.ensureExists(dartExecutable, configuration); 200 TestUtils.ensureExists(dartExecutable, configuration);
201 return dartExecutable; 201 return dartExecutable;
202 } 202 }
203 203
204 String get d8FileName { 204 String get d8FileName {
205 var suffix = getExecutableSuffix('d8'); 205 var suffix = getExecutableSuffix('d8');
206 var d8Dir = TestUtils.dartDir().append('third_party/d8'); 206 var d8Dir = TestUtils.dartDir.append('third_party/d8');
207 var d8Path = d8Dir.append('${Platform.operatingSystem}/d8$suffix'); 207 var d8Path = d8Dir.append('${Platform.operatingSystem}/d8$suffix');
208 var d8 = d8Path.toNativePath(); 208 var d8 = d8Path.toNativePath();
209 TestUtils.ensureExists(d8, configuration); 209 TestUtils.ensureExists(d8, configuration);
210 return d8; 210 return d8;
211 } 211 }
212 212
213 String get jsShellFileName { 213 String get jsShellFileName {
214 var executableSuffix = getExecutableSuffix('jsshell'); 214 var executableSuffix = getExecutableSuffix('jsshell');
215 var executable = 'jsshell$executableSuffix'; 215 var executable = 'jsshell$executableSuffix';
216 var jsshellDir = '${TestUtils.dartDir()}/tools/testing/bin'; 216 var jsshellDir = '${TestUtils.dartDir}/tools/testing/bin';
217 return '$jsshellDir/$executable'; 217 return '$jsshellDir/$executable';
218 } 218 }
219 219
220 /** 220 /**
221 * The file extension (if any) that should be added to the given executable 221 * The file extension (if any) that should be added to the given executable
222 * name for the current platform. 222 * name for the current platform.
223 */ 223 */
224 // TODO(ahe): Get rid of this. Use executableBinarySuffix instead. 224 // TODO(ahe): Get rid of this. Use executableBinarySuffix instead.
225 String getExecutableSuffix(String executable) { 225 String getExecutableSuffix(String executable) {
226 if (Platform.operatingSystem == 'windows') { 226 if (Platform.operatingSystem == 'windows') {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // and will enqueue the test (if necessary). 258 // and will enqueue the test (if necessary).
259 void enqueueNewTestCase(TestCase testCase) { 259 void enqueueNewTestCase(TestCase testCase) {
260 var expectations = testCase.expectedOutcomes; 260 var expectations = testCase.expectedOutcomes;
261 261
262 // Handle sharding based on the original test path (i.e. all multitests 262 // Handle sharding based on the original test path (i.e. all multitests
263 // of a given original test belong to the same shard) 263 // of a given original test belong to the same shard)
264 int shards = configuration['shards']; 264 int shards = configuration['shards'];
265 if (shards > 1) { 265 if (shards > 1) {
266 int shard = configuration['shard']; 266 int shard = configuration['shard'];
267 var testPath = 267 var testPath =
268 testCase.info.originTestPath.relativeTo(TestUtils.dartDir()); 268 testCase.info.originTestPath.relativeTo(TestUtils.dartDir);
269 if ("$testPath".hashCode % shards != shard - 1) { 269 if ("$testPath".hashCode % shards != shard - 1) {
270 return; 270 return;
271 } 271 }
272 } 272 }
273 // Test if the selector includes this test. 273 // Test if the selector includes this test.
274 RegExp pattern = configuration['selectors'][suiteName]; 274 RegExp pattern = configuration['selectors'][suiteName];
275 if (!pattern.hasMatch(testCase.displayName)) { 275 if (!pattern.hasMatch(testCase.displayName)) {
276 return; 276 return;
277 } 277 }
278 278
(...skipping 13 matching lines...) Expand all
292 if (expectations.contains(Expectation.SKIP) || 292 if (expectations.contains(Expectation.SKIP) ||
293 expectations.contains(Expectation.SKIP_BY_DESIGN)) { 293 expectations.contains(Expectation.SKIP_BY_DESIGN)) {
294 return; 294 return;
295 } 295 }
296 296
297 doTest(testCase); 297 doTest(testCase);
298 } 298 }
299 299
300 String createGeneratedTestDirectoryHelper( 300 String createGeneratedTestDirectoryHelper(
301 String name, String dirname, Path testPath, String optionsName) { 301 String name, String dirname, Path testPath, String optionsName) {
302 Path relative = testPath.relativeTo(TestUtils.dartDir()); 302 Path relative = testPath.relativeTo(TestUtils.dartDir);
303 relative = relative.directoryPath.append(relative.filenameWithoutExtension); 303 relative = relative.directoryPath.append(relative.filenameWithoutExtension);
304 String testUniqueName = TestUtils.getShortName(relative.toString()); 304 String testUniqueName = TestUtils.getShortName(relative.toString());
305 if (!optionsName.isEmpty) { 305 if (!optionsName.isEmpty) {
306 testUniqueName = '$testUniqueName-$optionsName'; 306 testUniqueName = '$testUniqueName-$optionsName';
307 } 307 }
308 308
309 Path generatedTestPath = new Path(buildDir) 309 Path generatedTestPath = new Path(buildDir)
310 .append('generated_$name') 310 .append('generated_$name')
311 .append(dirname) 311 .append(dirname)
312 .append(testUniqueName); 312 .append(testUniqueName);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 var sdk = configuration['use_sdk'] ? '-sdk' : ''; 359 var sdk = configuration['use_sdk'] ? '-sdk' : '';
360 var packages = configuration['use_public_packages'] 360 var packages = configuration['use_public_packages']
361 ? '-public_packages' : ''; 361 ? '-public_packages' : '';
362 var dirName = "${configuration['compiler']}" 362 var dirName = "${configuration['compiler']}"
363 "$checked$minified$csp$packages$sdk"; 363 "$checked$minified$csp$packages$sdk";
364 return createGeneratedTestDirectoryHelper( 364 return createGeneratedTestDirectoryHelper(
365 "compilations", dirName, testPath, ""); 365 "compilations", dirName, testPath, "");
366 } 366 }
367 367
368 String createPubspecCheckoutDirectory(Path directoryOfPubspecYaml) { 368 String createPubspecCheckoutDirectory(Path directoryOfPubspecYaml) {
369 var relativeDir = directoryOfPubspecYaml.relativeTo(TestUtils.dartDir()); 369 var relativeDir = directoryOfPubspecYaml.relativeTo(TestUtils.dartDir);
370 var sdk = configuration['use_sdk'] ? '-sdk' : ''; 370 var sdk = configuration['use_sdk'] ? '-sdk' : '';
371 var pkg = configuration['use_public_packages'] 371 var pkg = configuration['use_public_packages']
372 ? 'public_packages' : 'repo_packages'; 372 ? 'public_packages' : 'repo_packages';
373 return createGeneratedTestDirectoryHelper( 373 return createGeneratedTestDirectoryHelper(
374 "pubspec_checkouts", '$pkg$sdk', directoryOfPubspecYaml, ""); 374 "pubspec_checkouts", '$pkg$sdk', directoryOfPubspecYaml, "");
375 } 375 }
376 376
377 String createPubPackageBuildsDirectory(Path directoryOfPubspecYaml) { 377 String createPubPackageBuildsDirectory(Path directoryOfPubspecYaml) {
378 var relativeDir = directoryOfPubspecYaml.relativeTo(TestUtils.dartDir()); 378 var relativeDir = directoryOfPubspecYaml.relativeTo(TestUtils.dartDir);
379 var pkg = configuration['use_public_packages'] 379 var pkg = configuration['use_public_packages']
380 ? 'public_packages' : 'repo_packages'; 380 ? 'public_packages' : 'repo_packages';
381 return createGeneratedTestDirectoryHelper( 381 return createGeneratedTestDirectoryHelper(
382 "pub_package_builds", pkg, directoryOfPubspecYaml, ""); 382 "pub_package_builds", pkg, directoryOfPubspecYaml, "");
383 } 383 }
384 384
385 /** 385 /**
386 * Helper function for discovering the packages in the dart repository. 386 * Helper function for discovering the packages in the dart repository.
387 */ 387 */
388 Future<List> listDir(Path path, Function isValid) { 388 Future<List> listDir(Path path, Function isValid) {
(...skipping 16 matching lines...) Expand all
405 /* 405 /*
406 * Layout of packages inside the dart repository: 406 * Layout of packages inside the dart repository:
407 * dart/ 407 * dart/
408 * pkg/PACKAGE_NAME 408 * pkg/PACKAGE_NAME
409 * pkg/third_party/PACKAGE_NAME 409 * pkg/third_party/PACKAGE_NAME
410 * third_party/pkg/PACKAGE_NAME 410 * third_party/pkg/PACKAGE_NAME
411 */ 411 */
412 412
413 isValid(packageName) => packageName != 'third_party'; 413 isValid(packageName) => packageName != 'third_party';
414 414
415 var dartDir = TestUtils.dartDir(); 415 var dartDir = TestUtils.dartDir;
416 var futures = [ 416 var futures = [
417 listDir(dartDir.append('pkg'), isValid), 417 listDir(dartDir.append('pkg'), isValid),
418 listDir(dartDir.append('pkg').append('third_party'), isValid), 418 listDir(dartDir.append('pkg').append('third_party'), isValid),
419 listDir(dartDir.append('third_party').append('pkg'), isValid), 419 listDir(dartDir.append('third_party').append('pkg'), isValid),
420 ]; 420 ];
421 return Future.wait(futures).then((results) { 421 return Future.wait(futures).then((results) {
422 var packageDirectories = {}; 422 var packageDirectories = {};
423 for (var result in results) { 423 for (var result in results) {
424 for (var packageTuple in result) { 424 for (var packageTuple in result) {
425 String packageName = packageTuple[0]; 425 String packageName = packageTuple[0];
(...skipping 12 matching lines...) Expand all
438 Future<Map> discoverSamplesInRepository() { 438 Future<Map> discoverSamplesInRepository() {
439 /* 439 /*
440 * Layout of samples inside the dart repository: 440 * Layout of samples inside the dart repository:
441 * dart/ 441 * dart/
442 * samples/SAMPLE_NAME 442 * samples/SAMPLE_NAME
443 * samples/third_party/SAMPLE_NAME 443 * samples/third_party/SAMPLE_NAME
444 */ 444 */
445 445
446 isValid(packageName) => packageName != 'third_party'; 446 isValid(packageName) => packageName != 'third_party';
447 447
448 var dartDir = TestUtils.dartDir(); 448 var dartDir = TestUtils.dartDir;
449 var futures = [ 449 var futures = [
450 listDir(dartDir.append('samples'), isValid), 450 listDir(dartDir.append('samples'), isValid),
451 listDir(dartDir.append('samples').append('third_party'), isValid), 451 listDir(dartDir.append('samples').append('third_party'), isValid),
452 ]; 452 ];
453 return Future.wait(futures).then((results) { 453 return Future.wait(futures).then((results) {
454 var packageDirectories = {}; 454 var packageDirectories = {};
455 for (var result in results) { 455 for (var result in results) {
456 for (var packageTuple in result) { 456 for (var packageTuple in result) {
457 String packageName = packageTuple[0]; 457 String packageName = packageTuple[0];
458 String fullPath = packageTuple[1]; 458 String fullPath = packageTuple[1];
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 final String dartDir; 506 final String dartDir;
507 List<String> statusFilePaths; 507 List<String> statusFilePaths;
508 VoidFunction doDone; 508 VoidFunction doDone;
509 509
510 CCTestSuite(Map configuration, 510 CCTestSuite(Map configuration,
511 String suiteName, 511 String suiteName,
512 String runnerName, 512 String runnerName,
513 this.statusFilePaths, 513 this.statusFilePaths,
514 {this.testPrefix: ''}) 514 {this.testPrefix: ''})
515 : super(configuration, suiteName), 515 : super(configuration, suiteName),
516 dartDir = TestUtils.dartDir().toNativePath() { 516 dartDir = TestUtils.dartDir.toNativePath() {
517 // For running the tests we use the given '$runnerName' binary 517 // For running the tests we use the given '$runnerName' binary
518 targetRunnerPath = '$buildDir/$runnerName'; 518 targetRunnerPath = '$buildDir/$runnerName';
519 519
520 // For listing the tests we use the '$runnerName.host' binary if it exists 520 // For listing the tests we use the '$runnerName.host' binary if it exists
521 // and use '$runnerName' if it doesn't. 521 // and use '$runnerName' if it doesn't.
522 var binarySuffix = Platform.operatingSystem == 'windows' ? '.exe' : ''; 522 var binarySuffix = Platform.operatingSystem == 'windows' ? '.exe' : '';
523 var hostBinary = '$targetRunnerPath.host$binarySuffix'; 523 var hostBinary = '$targetRunnerPath.host$binarySuffix';
524 if (new File(hostBinary).existsSync()) { 524 if (new File(hostBinary).existsSync()) {
525 hostRunnerPath = hostBinary; 525 hostRunnerPath = hostBinary;
526 } else { 526 } else {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 final bool listRecursively; 603 final bool listRecursively;
604 final extraVmOptions; 604 final extraVmOptions;
605 605
606 StandardTestSuite(Map configuration, 606 StandardTestSuite(Map configuration,
607 String suiteName, 607 String suiteName,
608 Path suiteDirectory, 608 Path suiteDirectory,
609 this.statusFilePaths, 609 this.statusFilePaths,
610 {this.isTestFilePredicate, 610 {this.isTestFilePredicate,
611 bool recursive: false}) 611 bool recursive: false})
612 : super(configuration, suiteName), 612 : super(configuration, suiteName),
613 dartDir = TestUtils.dartDir(), 613 dartDir = TestUtils.dartDir,
614 listRecursively = recursive, 614 listRecursively = recursive,
615 suiteDir = TestUtils.dartDir().join(suiteDirectory), 615 suiteDir = TestUtils.dartDir.join(suiteDirectory),
616 extraVmOptions = TestUtils.getExtraVmOptions(configuration); 616 extraVmOptions = TestUtils.getExtraVmOptions(configuration);
617 617
618 /** 618 /**
619 * Creates a test suite whose file organization matches an expected structure. 619 * Creates a test suite whose file organization matches an expected structure.
620 * To use this, your suite should look like: 620 * To use this, your suite should look like:
621 * 621 *
622 * dart/ 622 * dart/
623 * path/ 623 * path/
624 * to/ 624 * to/
625 * mytestsuite/ 625 * mytestsuite/
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 createTestCase(filePath, 788 createTestCase(filePath,
789 optionsFromFile['hasCompileError'], 789 optionsFromFile['hasCompileError'],
790 optionsFromFile['hasRuntimeError'], 790 optionsFromFile['hasRuntimeError'],
791 hasStaticWarning: optionsFromFile['hasStaticWarning']); 791 hasStaticWarning: optionsFromFile['hasStaticWarning']);
792 } 792 }
793 } 793 }
794 794
795 static Path _findPubspecYamlFile(Path filePath) { 795 static Path _findPubspecYamlFile(Path filePath) {
796 final existsCache = TestUtils.existsCache; 796 final existsCache = TestUtils.existsCache;
797 797
798 Path root = TestUtils.dartDir(); 798 Path root = TestUtils.dartDir;
799 assert ("$filePath".startsWith("$root")); 799 assert ("$filePath".startsWith("$root"));
800 800
801 // We start with the parent directory of [filePath] and go up until 801 // We start with the parent directory of [filePath] and go up until
802 // the root directory (excluding the root). 802 // the root directory (excluding the root).
803 List<String> segments = 803 List<String> segments =
804 filePath.directoryPath.relativeTo(root).segments(); 804 filePath.directoryPath.relativeTo(root).segments();
805 while (segments.length > 0) { 805 while (segments.length > 0) {
806 var pubspecYamlPath = 806 var pubspecYamlPath =
807 new Path(segments.join('/')).append('pubspec.yaml'); 807 new Path(segments.join('/')).append('pubspec.yaml');
808 if (existsCache.doesFileExist(pubspecYamlPath.toNativePath())) { 808 if (existsCache.doesFileExist(pubspecYamlPath.toNativePath())) {
(...skipping 27 matching lines...) Expand all
836 836
837 // NOTE: We make a link in the package-root to [packageName], since 837 // NOTE: We make a link in the package-root to [packageName], since
838 // 'pub get' doesn't create the link to the package containing 838 // 'pub get' doesn't create the link to the package containing
839 // pubspec.yaml if there is no lib directory. 839 // pubspec.yaml if there is no lib directory.
840 var packageLink = newPackageRoot.append(packageName); 840 var packageLink = newPackageRoot.append(packageName);
841 var packageLinkTarget = packageDir.append('lib'); 841 var packageLinkTarget = packageDir.append('lib');
842 842
843 // NOTE: We make a link in the package-root to pkg/expect, since 843 // NOTE: We make a link in the package-root to pkg/expect, since
844 // 'package:expect' is not available on pub.dartlang.org! 844 // 'package:expect' is not available on pub.dartlang.org!
845 var expectLink = newPackageRoot.append('expect'); 845 var expectLink = newPackageRoot.append('expect');
846 var expectLinkTarget = TestUtils.dartDir() 846 var expectLinkTarget = TestUtils.dartDir
847 .append('pkg').append('expect').append('lib'); 847 .append('pkg').append('expect').append('lib');
848 848
849 // Generate dependency overrides if we use repository packages. 849 // Generate dependency overrides if we use repository packages.
850 var packageDirectories = {}; 850 var packageDirectories = {};
851 if (configuration['use_repository_packages']) { 851 if (configuration['use_repository_packages']) {
852 packageDirectories = new Map.from(localPackageDirectories); 852 packageDirectories = new Map.from(localPackageDirectories);
853 // Do not create an dependency override for the package itself. 853 // Do not create an dependency override for the package itself.
854 if (packageDirectories.containsKey(packageName)) { 854 if (packageDirectories.containsKey(packageName)) {
855 packageDirectories.remove(packageName); 855 packageDirectories.remove(packageName);
856 } 856 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 * the relative path to either the dart or the build directory. 1050 * the relative path to either the dart or the build directory.
1051 * Thus, the returned [String] will be the path component of the URL 1051 * Thus, the returned [String] will be the path component of the URL
1052 * corresponding to [file] (the http server serves files relative to the 1052 * corresponding to [file] (the http server serves files relative to the
1053 * dart/build directories). 1053 * dart/build directories).
1054 */ 1054 */
1055 String _createUrlPathFromFile(Path file) { 1055 String _createUrlPathFromFile(Path file) {
1056 file = TestUtils.absolutePath(file); 1056 file = TestUtils.absolutePath(file);
1057 1057
1058 var relativeBuildDir = new Path(TestUtils.buildDir(configuration)); 1058 var relativeBuildDir = new Path(TestUtils.buildDir(configuration));
1059 var buildDir = TestUtils.absolutePath(relativeBuildDir); 1059 var buildDir = TestUtils.absolutePath(relativeBuildDir);
1060 var dartDir = TestUtils.absolutePath(TestUtils.dartDir()); 1060 var dartDir = TestUtils.absolutePath(TestUtils.dartDir);
1061 1061
1062 var fileString = file.toString(); 1062 var fileString = file.toString();
1063 if (fileString.startsWith(buildDir.toString())) { 1063 if (fileString.startsWith(buildDir.toString())) {
1064 var fileRelativeToBuildDir = file.relativeTo(buildDir); 1064 var fileRelativeToBuildDir = file.relativeTo(buildDir);
1065 return "/$PREFIX_BUILDDIR/$fileRelativeToBuildDir"; 1065 return "/$PREFIX_BUILDDIR/$fileRelativeToBuildDir";
1066 } else if (fileString.startsWith(dartDir.toString())) { 1066 } else if (fileString.startsWith(dartDir.toString())) {
1067 var fileRelativeToDartDir = file.relativeTo(dartDir); 1067 var fileRelativeToDartDir = file.relativeTo(dartDir);
1068 return "/$PREFIX_DARTDIR/$fileRelativeToDartDir"; 1068 return "/$PREFIX_DARTDIR/$fileRelativeToDartDir";
1069 } 1069 }
1070 // Unreachable 1070 // Unreachable
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 TestExpectations testExpectations) { 1745 TestExpectations testExpectations) {
1746 enqueueTestCase(String packageName, String directory) { 1746 enqueueTestCase(String packageName, String directory) {
1747 var absoluteDirectoryPath = new Path(directory); 1747 var absoluteDirectoryPath = new Path(directory);
1748 1748
1749 // Early return if this package is not using pub. 1749 // Early return if this package is not using pub.
1750 if (!fileExists(absoluteDirectoryPath.append('pubspec.yaml'))) { 1750 if (!fileExists(absoluteDirectoryPath.append('pubspec.yaml'))) {
1751 return; 1751 return;
1752 } 1752 }
1753 1753
1754 var directoryPath = 1754 var directoryPath =
1755 absoluteDirectoryPath.relativeTo(TestUtils.dartDir()); 1755 absoluteDirectoryPath.relativeTo(TestUtils.dartDir);
1756 var testName = "$directoryPath"; 1756 var testName = "$directoryPath";
1757 var displayName = '$suiteName/$testName'; 1757 var displayName = '$suiteName/$testName';
1758 var packageName = directoryPath.filename; 1758 var packageName = directoryPath.filename;
1759 1759
1760 // Collect necessary paths for pubspec.yaml overrides, pub-cache, ... 1760 // Collect necessary paths for pubspec.yaml overrides, pub-cache, ...
1761 var checkoutDir = 1761 var checkoutDir =
1762 createPubPackageBuildsDirectory(absoluteDirectoryPath); 1762 createPubPackageBuildsDirectory(absoluteDirectoryPath);
1763 var cacheDir = new Path(checkoutDir).append("pub-cache").toNativePath(); 1763 var cacheDir = new Path(checkoutDir).append("pub-cache").toNativePath();
1764 var pubspecYamlFile = 1764 var pubspecYamlFile =
1765 new Path(checkoutDir).append('pubspec.yaml').toNativePath(); 1765 new Path(checkoutDir).append('pubspec.yaml').toNativePath();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 localSampleDirectories.forEach(enqueueTestCase); 1814 localSampleDirectories.forEach(enqueueTestCase);
1815 1815
1816 // Notify we're done 1816 // Notify we're done
1817 if (onDone != null) onDone(); 1817 if (onDone != null) onDone();
1818 } 1818 }
1819 1819
1820 doTest = onTest; 1820 doTest = onTest;
1821 Map<String, String> _localPackageDirectories; 1821 Map<String, String> _localPackageDirectories;
1822 Map<String, String> _localSampleDirectories; 1822 Map<String, String> _localSampleDirectories;
1823 List<String> statusFiles = [ 1823 List<String> statusFiles = [
1824 TestUtils.dartDir().join(new Path(statusFilePath)).toNativePath()]; 1824 TestUtils.dartDir.join(new Path(statusFilePath)).toNativePath()];
1825 ReadTestExpectations(statusFiles, configuration).then((expectations) { 1825 ReadTestExpectations(statusFiles, configuration).then((expectations) {
1826 Future.wait([discoverPackagesInRepository(), 1826 Future.wait([discoverPackagesInRepository(),
1827 discoverSamplesInRepository()]).then((List results) { 1827 discoverSamplesInRepository()]).then((List results) {
1828 Map packageDirectories = results[0]; 1828 Map packageDirectories = results[0];
1829 Map sampleDirectories = results[1]; 1829 Map sampleDirectories = results[1];
1830 enqueueTestCases(packageDirectories, sampleDirectories, expectations); 1830 enqueueTestCases(packageDirectories, sampleDirectories, expectations);
1831 }); 1831 });
1832 }); 1832 });
1833 } 1833 }
1834 } 1834 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 * The libraries in this directory relies on finding various files 1880 * The libraries in this directory relies on finding various files
1881 * relative to the 'test.dart' script in '.../dart/tools/test.dart'. If 1881 * relative to the 'test.dart' script in '.../dart/tools/test.dart'. If
1882 * the main script using 'test_suite.dart' is not there, the main 1882 * the main script using 'test_suite.dart' is not there, the main
1883 * script must set this to '.../dart/tools/test.dart'. 1883 * script must set this to '.../dart/tools/test.dart'.
1884 */ 1884 */
1885 static String testScriptPath = new Path(Platform.script.path).toNativePath(); 1885 static String testScriptPath = new Path(Platform.script.path).toNativePath();
1886 static LastModifiedCache lastModifiedCache = new LastModifiedCache(); 1886 static LastModifiedCache lastModifiedCache = new LastModifiedCache();
1887 static ExistsCache existsCache = new ExistsCache(); 1887 static ExistsCache existsCache = new ExistsCache();
1888 static Path currentWorkingDirectory = 1888 static Path currentWorkingDirectory =
1889 new Path(Directory.current.path); 1889 new Path(Directory.current.path);
1890 static Path dartDir = new Path(new File(testScriptPath).absolute.path)
1891 .directoryPath.directoryPath;
1892
1890 /** 1893 /**
1891 * Creates a directory using a [relativePath] to an existing 1894 * Creates a directory using a [relativePath] to an existing
1892 * [base] directory if that [relativePath] does not already exist. 1895 * [base] directory if that [relativePath] does not already exist.
1893 */ 1896 */
1894 static Directory mkdirRecursive(Path base, Path relativePath) { 1897 static Directory mkdirRecursive(Path base, Path relativePath) {
1895 if (relativePath.isAbsolute) { 1898 if (relativePath.isAbsolute) {
1896 base = new Path('/'); 1899 base = new Path('/');
1897 } 1900 }
1898 Directory dir = new Directory(base.toNativePath()); 1901 Directory dir = new Directory(base.toNativePath());
1899 assert(dir.existsSync()); 1902 assert(dir.existsSync());
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 if (system == 'linux') { 1983 if (system == 'linux') {
1981 result = 'out/'; 1984 result = 'out/';
1982 } else if (system == 'macos') { 1985 } else if (system == 'macos') {
1983 result = 'xcodebuild/'; 1986 result = 'xcodebuild/';
1984 } else if (system == 'windows') { 1987 } else if (system == 'windows') {
1985 result = 'build/'; 1988 result = 'build/';
1986 } 1989 }
1987 return result; 1990 return result;
1988 } 1991 }
1989 1992
1990 static Path dartDir() {
1991 File scriptFile = new File(testScriptPath);
1992 Path scriptPath = new Path(scriptFile.absolute.path);
1993 return scriptPath.directoryPath.directoryPath;
1994 }
1995
1996 static List<String> standardOptions(Map configuration) { 1993 static List<String> standardOptions(Map configuration) {
1997 List args = ["--ignore-unrecognized-flags"]; 1994 List args = ["--ignore-unrecognized-flags"];
1998 if (configuration["checked"]) { 1995 if (configuration["checked"]) {
1999 args.add('--enable_asserts'); 1996 args.add('--enable_asserts');
2000 args.add("--enable_type_checks"); 1997 args.add("--enable_type_checks");
2001 } 1998 }
2002 String compiler = configuration["compiler"]; 1999 String compiler = configuration["compiler"];
2003 if (compiler == "dart2js" || compiler == "dart2dart") { 2000 if (compiler == "dart2js" || compiler == "dart2dart") {
2004 args = []; 2001 args = [];
2005 if (configuration["checked"]) { 2002 if (configuration["checked"]) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 return normal; 2074 return normal;
2078 } 2075 }
2079 2076
2080 static String configurationDir(Map configuration) { 2077 static String configurationDir(Map configuration) {
2081 // For regular dart checkouts, the configDir by default is mode+arch. 2078 // For regular dart checkouts, the configDir by default is mode+arch.
2082 // For Dartium, the configDir by default is mode (as defined by the Chrome 2079 // For Dartium, the configDir by default is mode (as defined by the Chrome
2083 // build setup). We can detect this because in the dartium checkout, the 2080 // build setup). We can detect this because in the dartium checkout, the
2084 // "output" directory is a sibling of the dart directory instead of a child. 2081 // "output" directory is a sibling of the dart directory instead of a child.
2085 var mode = (configuration['mode'] == 'debug') ? 'Debug' : 'Release'; 2082 var mode = (configuration['mode'] == 'debug') ? 'Debug' : 'Release';
2086 var arch = configuration['arch'].toUpperCase(); 2083 var arch = configuration['arch'].toUpperCase();
2087 if (currentWorkingDirectory != dartDir()) { 2084 if (currentWorkingDirectory != dartDir) {
2088 return getValidOutputDir(configuration, mode, arch); 2085 return getValidOutputDir(configuration, mode, arch);
2089 } else { 2086 } else {
2090 return mode; 2087 return mode;
2091 } 2088 }
2092 } 2089 }
2093 2090
2094 /** 2091 /**
2095 * Returns the path to the dart binary checked into the repo, used for 2092 * Returns the path to the dart binary checked into the repo, used for
2096 * bootstrapping test.dart. 2093 * bootstrapping test.dart.
2097 */ 2094 */
2098 static Path get dartTestExecutable { 2095 static Path get dartTestExecutable {
2099 var path = '${TestUtils.dartDir()}/tools/testing/bin/' 2096 var path = '$dartDir/tools/testing/bin/'
2100 '${Platform.operatingSystem}/dart'; 2097 '${Platform.operatingSystem}/dart';
2101 if (Platform.operatingSystem == 'windows') { 2098 if (Platform.operatingSystem == 'windows') {
2102 path = '$path.exe'; 2099 path = '$path.exe';
2103 } 2100 }
2104 return new Path(path); 2101 return new Path(path);
2105 } 2102 }
2106 2103
2107 /** 2104 /**
2108 * Gets extra vm options passed to the testing script. 2105 * Gets extra vm options passed to the testing script.
2109 */ 2106 */
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 * $pass tests are expected to pass 2219 * $pass tests are expected to pass
2223 * $failOk tests are expected to fail that we won't fix 2220 * $failOk tests are expected to fail that we won't fix
2224 * $fail tests are expected to fail that we should fix 2221 * $fail tests are expected to fail that we should fix
2225 * $crash tests are expected to crash that we should fix 2222 * $crash tests are expected to crash that we should fix
2226 * $timeout tests are allowed to timeout 2223 * $timeout tests are allowed to timeout
2227 * $compileErrorSkip tests are skipped on browsers due to compile-time error 2224 * $compileErrorSkip tests are skipped on browsers due to compile-time error
2228 """; 2225 """;
2229 print(report); 2226 print(report);
2230 } 2227 }
2231 } 2228 }
OLDNEW
« tools/testing/dart/test_progress.dart ('K') | « tools/testing/dart/test_progress.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698