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, |
11 * and creating [TestCase]s for those files that meet the relevant criteria. | 11 * and creating [TestCase]s for those files that meet the relevant criteria. |
12 * - Preparing tests, including copying files and frameworks to temporary | 12 * - Preparing tests, including copying files and frameworks to temporary |
13 * directories, and computing the command line and arguments to be run. | 13 * directories, and computing the command line and arguments to be run. |
14 */ | 14 */ |
15 library test_suite; | 15 library test_suite; |
16 | 16 |
17 import "dart:async"; | 17 import "dart:async"; |
18 import "dart:io"; | 18 import "dart:io"; |
19 import "dart:isolate"; | 19 import "dart:isolate"; |
20 import "status_file_parser.dart"; | 20 import "status_file_parser.dart"; |
21 import "test_runner.dart"; | 21 import "test_runner.dart"; |
22 import "multitest.dart"; | 22 import "multitest.dart"; |
23 import "drt_updater.dart"; | 23 import "drt_updater.dart"; |
24 import "dart:uri"; | 24 import "dart:uri"; |
25 import '../../../pkg/path/lib/path.dart' as pathLib; | |
ahe
2013/01/16 13:30:37
Also breaks test.dart.
| |
25 | 26 |
26 part "browser_test.dart"; | 27 part "browser_test.dart"; |
27 | 28 |
28 | 29 |
29 // TODO(rnystrom): Add to dart:core? | 30 // TODO(rnystrom): Add to dart:core? |
30 /** | 31 /** |
31 * A simple function that tests [arg] and returns `true` or `false`. | 32 * A simple function that tests [arg] and returns `true` or `false`. |
32 */ | 33 */ |
33 typedef bool Predicate<T>(T arg); | 34 typedef bool Predicate<T>(T arg); |
34 | 35 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 */ | 402 */ |
402 class StandardTestSuite extends TestSuite { | 403 class StandardTestSuite extends TestSuite { |
403 final Path suiteDir; | 404 final Path suiteDir; |
404 final List<String> statusFilePaths; | 405 final List<String> statusFilePaths; |
405 TestCaseEvent doTest; | 406 TestCaseEvent doTest; |
406 TestExpectations testExpectations; | 407 TestExpectations testExpectations; |
407 List<TestInformation> cachedTests; | 408 List<TestInformation> cachedTests; |
408 final Path dartDir; | 409 final Path dartDir; |
409 Predicate<String> isTestFilePredicate; | 410 Predicate<String> isTestFilePredicate; |
410 final bool listRecursively; | 411 final bool listRecursively; |
412 /** | |
413 * The set of servers that have been started to run these tests (Could be | |
414 * none). | |
415 */ | |
416 List serverList; | |
411 | 417 |
412 StandardTestSuite(Map configuration, | 418 StandardTestSuite(Map configuration, |
413 String suiteName, | 419 String suiteName, |
414 Path suiteDirectory, | 420 Path suiteDirectory, |
415 this.statusFilePaths, | 421 this.statusFilePaths, |
416 {this.isTestFilePredicate, | 422 {this.isTestFilePredicate, |
417 bool recursive: false}) | 423 bool recursive: false, |
424 this.serverList: const []}) | |
418 : super(configuration, suiteName), | 425 : super(configuration, suiteName), |
419 dartDir = TestUtils.dartDir(), | 426 dartDir = TestUtils.dartDir(), |
420 listRecursively = recursive, | 427 listRecursively = recursive, |
421 suiteDir = TestUtils.dartDir().join(suiteDirectory); | 428 suiteDir = TestUtils.dartDir().join(suiteDirectory); |
422 | 429 |
423 /** | 430 /** |
424 * Creates a test suite whose file organization matches an expected structure. | 431 * Creates a test suite whose file organization matches an expected structure. |
425 * To use this, your suite should look like: | 432 * To use this, your suite should look like: |
426 * | 433 * |
427 * dart/ | 434 * dart/ |
(...skipping 11 matching lines...) Expand all Loading... | |
439 * * The status file uses the same name. | 446 * * The status file uses the same name. |
440 * * Test files are directly in that directory and end in "_test.dart". | 447 * * Test files are directly in that directory and end in "_test.dart". |
441 * | 448 * |
442 * If you follow that convention, then you can construct one of these like: | 449 * If you follow that convention, then you can construct one of these like: |
443 * | 450 * |
444 * new StandardTestSuite.forDirectory(configuration, 'path/to/mytestsuite'); | 451 * new StandardTestSuite.forDirectory(configuration, 'path/to/mytestsuite'); |
445 * | 452 * |
446 * instead of having to create a custom [StandardTestSuite] subclass. In | 453 * instead of having to create a custom [StandardTestSuite] subclass. In |
447 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] | 454 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] |
448 * in test.dart, this will all be set up for you. | 455 * in test.dart, this will all be set up for you. |
456 * | |
457 * The [StandardTestSuite] also optionally takes a list of servers that have | |
458 * been started up by the test harness, to be used by browser tests. | |
449 */ | 459 */ |
450 factory StandardTestSuite.forDirectory( | 460 factory StandardTestSuite.forDirectory( |
451 Map configuration, Path directory) { | 461 Map configuration, Path directory, {List serverList : const []}) { |
452 final name = directory.filename; | 462 final name = directory.filename; |
453 | 463 |
454 return new StandardTestSuite(configuration, | 464 return new StandardTestSuite(configuration, |
455 name, directory, | 465 name, directory, |
456 ['$directory/$name.status', '$directory/${name}_dart2js.status'], | 466 ['$directory/$name.status', '$directory/${name}_dart2js.status'], |
457 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), | 467 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), |
458 recursive: true); | 468 recursive: true, serverList: serverList); |
459 } | 469 } |
460 | 470 |
461 Collection<Uri> get dart2JsBootstrapDependencies { | 471 Collection<Uri> get dart2JsBootstrapDependencies { |
462 if (!useSdk) return []; | 472 if (!useSdk) return []; |
463 | 473 |
464 var snapshotPath = TestUtils.absolutePath(new Path(buildDir).join( | 474 var snapshotPath = TestUtils.absolutePath(new Path(buildDir).join( |
465 new Path('dart-sdk/lib/_internal/compiler/' | 475 new Path('dart-sdk/lib/_internal/compiler/' |
466 'implementation/dart2js.dart.snapshot'))).toString(); | 476 'implementation/dart2js.dart.snapshot'))).toString(); |
467 return [new Uri.fromComponents(scheme: 'file', path: snapshotPath)]; | 477 return [new Uri.fromComponents(scheme: 'file', path: snapshotPath)]; |
468 } | 478 } |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
843 | 853 |
844 String dartWrapperFilename = '$tempDir/test.dart'; | 854 String dartWrapperFilename = '$tempDir/test.dart'; |
845 String compiledDartWrapperFilename = '$tempDir/test.js'; | 855 String compiledDartWrapperFilename = '$tempDir/test.js'; |
846 | 856 |
847 String htmlPath = '$tempDir/test.html'; | 857 String htmlPath = '$tempDir/test.html'; |
848 if (isWrappingRequired && !isWebTest) { | 858 if (isWrappingRequired && !isWebTest) { |
849 // test.dart will import the dart test directly, if it is a library, | 859 // test.dart will import the dart test directly, if it is a library, |
850 // or indirectly through test_as_library.dart, if it is not. | 860 // or indirectly through test_as_library.dart, if it is not. |
851 Path dartLibraryFilename = filePath; | 861 Path dartLibraryFilename = filePath; |
852 if (!isLibraryDefinition) { | 862 if (!isLibraryDefinition) { |
853 dartLibraryFilename = new Path('test_as_library.dart'); | 863 dartLibraryFilename = new Path(tempDir).append( |
854 File file = new File('$tempDir/$dartLibraryFilename'); | 864 'test_as_library.dart'); |
865 File file = new File(dartLibraryFilename.toNativePath()); | |
855 RandomAccessFile dartLibrary = file.openSync(FileMode.WRITE); | 866 RandomAccessFile dartLibrary = file.openSync(FileMode.WRITE); |
856 dartLibrary.writeStringSync(wrapDartTestInLibrary(filePath)); | 867 dartLibrary.writeStringSync( |
868 wrapDartTestInLibrary(filePath, file.name)); | |
857 dartLibrary.closeSync(); | 869 dartLibrary.closeSync(); |
858 } | 870 } |
859 | 871 |
860 File file = new File(dartWrapperFilename); | 872 File file = new File(dartWrapperFilename); |
861 RandomAccessFile dartWrapper = file.openSync(FileMode.WRITE); | 873 RandomAccessFile dartWrapper = file.openSync(FileMode.WRITE); |
862 dartWrapper.writeStringSync( | 874 dartWrapper.writeStringSync( |
863 dartTestWrapper(dartDir, dartLibraryFilename)); | 875 dartTestWrapper(dartDir, file.name, dartLibraryFilename)); |
864 dartWrapper.closeSync(); | 876 dartWrapper.closeSync(); |
865 } else { | 877 } else { |
866 dartWrapperFilename = filename; | 878 dartWrapperFilename = filename; |
867 // TODO(whesse): Once test.py is retired, adjust the relative path in | 879 // TODO(whesse): Once test.py is retired, adjust the relative path in |
868 // the client/samples/dartcombat test to its css file, remove the | 880 // the client/samples/dartcombat test to its css file, remove the |
869 // "../../" from this path, and move this out of the isWebTest guard. | 881 // "../../" from this path, and move this out of the isWebTest guard. |
870 // Also remove getHtmlName, and just use test.html. | 882 // Also remove getHtmlName, and just use test.html. |
871 // TODO(efortuna): this shortening of htmlFilename is a band-aid until | 883 // TODO(efortuna): this shortening of htmlFilename is a band-aid until |
872 // the above TODO gets fixed. Windows cannot have paths that are longer | 884 // the above TODO gets fixed. Windows cannot have paths that are longer |
873 // than 260 characters, and without this hack, we were running past the | 885 // than 260 characters, and without this hack, we were running past the |
874 // the limit. | 886 // the limit. |
875 String htmlFilename = getHtmlName(filename); | 887 String htmlFilename = getHtmlName(filename); |
876 while ('$tempDir/../$htmlFilename'.length >= 260) { | 888 while ('$tempDir/../$htmlFilename'.length >= 260) { |
877 htmlFilename = htmlFilename.substring(htmlFilename.length~/2); | 889 htmlFilename = htmlFilename.substring(htmlFilename.length~/2); |
878 } | 890 } |
879 htmlPath = '$tempDir/../$htmlFilename'; | 891 htmlPath = '$tempDir/../$htmlFilename'; |
880 } | 892 } |
881 final String scriptPath = (compiler == 'none') ? | 893 final String scriptPath = (compiler == 'none') ? |
882 dartWrapperFilename : compiledDartWrapperFilename; | 894 dartWrapperFilename : compiledDartWrapperFilename; |
883 // Create the HTML file for the test. | 895 // Create the HTML file for the test. |
884 RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE); | 896 RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE); |
885 String filePrefix = ''; | |
886 if (Platform.operatingSystem == 'windows') { | |
887 // Firefox on Windows does not like absolute file path names that start | |
888 // with 'C:' adding 'file:///' solves the problem. | |
889 filePrefix = 'file:///'; | |
890 } | |
891 String content = null; | 897 String content = null; |
892 Path dir = filePath.directoryPath; | 898 Path dir = filePath.directoryPath; |
893 String nameNoExt = filePath.filenameWithoutExtension; | 899 String nameNoExt = filePath.filenameWithoutExtension; |
894 Path pngPath = dir.append('$nameNoExt.png'); | 900 Path pngPath = dir.append('$nameNoExt.png'); |
895 Path txtPath = dir.append('$nameNoExt.txt'); | 901 Path txtPath = dir.append('$nameNoExt.txt'); |
896 Path expectedOutput = null; | 902 Path expectedOutput = null; |
897 if (new File.fromPath(pngPath).existsSync()) { | 903 if (new File.fromPath(pngPath).existsSync()) { |
898 expectedOutput = pngPath; | 904 expectedOutput = pngPath; |
899 content = getHtmlLayoutContents(scriptType, '$filePrefix$scriptPath'); | 905 // TODO(efortuna): Unify path libraries in test.dart. |
906 content = getHtmlLayoutContents(scriptType, pathLib.relative(scriptPath, | |
907 from: pathLib.dirname(htmlPath))); | |
900 } else if (new File.fromPath(txtPath).existsSync()) { | 908 } else if (new File.fromPath(txtPath).existsSync()) { |
901 expectedOutput = txtPath; | 909 expectedOutput = txtPath; |
902 content = getHtmlLayoutContents(scriptType, '$filePrefix$scriptPath'); | 910 content = getHtmlLayoutContents(scriptType, pathLib.relative(scriptPath, |
911 from: pathLib.dirname(htmlPath))); | |
903 } else { | 912 } else { |
904 final htmlLocation = new Path.fromNative(htmlPath); | 913 final htmlLocation = new Path.fromNative(htmlPath); |
905 content = getHtmlContents( | 914 content = getHtmlContents( |
906 filename, | 915 filename, |
907 dartDir.append('pkg/unittest/test_controller.js') | 916 dartDir.append('pkg/unittest/test_controller.js') |
908 .relativeTo(htmlLocation), | 917 .relativeTo(htmlLocation), |
909 dartDir.append('pkg/browser/lib/dart.js').relativeTo(htmlLocation), | 918 dartDir.append('pkg/browser/lib/dart.js').relativeTo(htmlLocation), |
910 scriptType, | 919 scriptType, |
911 new Path.fromNative(scriptPath).relativeTo(htmlLocation)); | 920 new Path.fromNative(scriptPath).relativeTo(htmlLocation)); |
912 } | 921 } |
(...skipping 29 matching lines...) Expand all Loading... | |
942 do { | 951 do { |
943 List<Command> commandSet = new List<Command>.from(commands); | 952 List<Command> commandSet = new List<Command>.from(commands); |
944 if (subtestIndex != 0) { | 953 if (subtestIndex != 0) { |
945 // NOTE: The first time we enter this loop, all the compilation | 954 // NOTE: The first time we enter this loop, all the compilation |
946 // commands will be executed. On subsequent loop iterations, we | 955 // commands will be executed. On subsequent loop iterations, we |
947 // don't need to do any compilations. Thus we set "commandSet = []". | 956 // don't need to do any compilations. Thus we set "commandSet = []". |
948 commandSet = []; | 957 commandSet = []; |
949 } | 958 } |
950 | 959 |
951 List<String> args = <String>[]; | 960 List<String> args = <String>[]; |
952 String fullHtmlPath = htmlPath.startsWith('http:') ? htmlPath : | 961 var basePath = TestUtils.dartDir().toString(); |
953 (htmlPath.startsWith('/') ? | 962 if (!htmlPath.startsWith('/') && !htmlPath.startsWith('http')) { |
954 'file://$htmlPath' : | 963 htmlPath = '/$htmlPath'; |
955 'file:///$htmlPath'); | 964 } |
965 htmlPath = htmlPath.startsWith(basePath) ? | |
966 htmlPath.substring(basePath.length) : htmlPath; | |
967 String fullHtmlPath = htmlPath; | |
968 if (!htmlPath.startsWith('http')) { | |
969 fullHtmlPath = 'http://127.0.0.1:${serverList[0].port}$htmlPath?' | |
970 'crossOriginPort=${serverList[1].port}'; | |
971 } | |
956 if (info.optionsFromFile['isMultiHtmlTest'] | 972 if (info.optionsFromFile['isMultiHtmlTest'] |
957 && subtestNames.length > 0) { | 973 && subtestNames.length > 0) { |
958 fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}'; | 974 fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}'; |
959 } | 975 } |
960 | 976 |
961 if (TestUtils.usesWebDriver(runtime)) { | 977 if (TestUtils.usesWebDriver(runtime)) { |
962 args = [ | 978 args = [ |
963 dartDir.append('tools/testing/run_selenium.py').toNativePath(), | 979 dartDir.append('tools/testing/run_selenium.py').toNativePath(), |
964 '--browser=$runtime', | 980 '--browser=$runtime', |
965 '--timeout=${configuration["timeout"] - 2}', | 981 '--timeout=${configuration["timeout"] - 2}', |
966 '--out="$fullHtmlPath"']; | 982 '--out="$fullHtmlPath"']; |
967 if (runtime == 'dartium') { | 983 if (runtime == 'dartium') { |
968 args.add('--executable=$dartiumFilename'); | 984 args.add('--executable=$dartiumFilename'); |
969 } | 985 } |
970 if (subtestIndex != 0) { | 986 if (subtestIndex != 0) { |
971 args.add('--force-refresh'); | 987 args.add('--force-refresh'); |
972 } | 988 } |
973 commandSet.add(new Command('python', args)); | 989 commandSet.add(new Command('python', args)); |
974 } else { | 990 } else { |
975 Expect.isTrue(runtime == "drt"); | 991 Expect.isTrue(runtime == "drt"); |
976 | 992 |
977 var dartFlags = []; | 993 var dartFlags = []; |
978 var dumpRenderTreeOptions = []; | 994 var dumpRenderTreeOptions = []; |
979 var packageRootUri; | |
980 | 995 |
981 dumpRenderTreeOptions.add('--no-timeout'); | 996 dumpRenderTreeOptions.add('--no-timeout'); |
982 | 997 |
983 if (compiler == 'none' || compiler == 'dart2dart') { | 998 if (compiler == 'none' || compiler == 'dart2dart') { |
984 dartFlags.add('--ignore-unrecognized-flags'); | 999 dartFlags.add('--ignore-unrecognized-flags'); |
985 if (configuration["checked"]) { | 1000 if (configuration["checked"]) { |
986 dartFlags.add('--enable_asserts'); | 1001 dartFlags.add('--enable_asserts'); |
987 dartFlags.add("--enable_type_checks"); | 1002 dartFlags.add("--enable_type_checks"); |
988 } | 1003 } |
989 dartFlags.addAll(vmOptions); | 1004 dartFlags.addAll(vmOptions); |
990 } | 1005 } |
991 if (compiler == 'none') { | |
992 var packageRootPath = packageRoot(optionsFromFile['packageRoot']); | |
993 if (packageRootPath != null) { | |
994 var absolutePath = | |
995 TestUtils.absolutePath(new Path(packageRootPath)); | |
996 packageRootUri = new Uri.fromComponents( | |
997 scheme: 'file', | |
998 path: absolutePath.toString()); | |
999 } | |
1000 } | |
1001 | 1006 |
1002 if (expectedOutput != null) { | 1007 if (expectedOutput != null) { |
1003 if (expectedOutput.toNativePath().endsWith('.png')) { | 1008 if (expectedOutput.toNativePath().endsWith('.png')) { |
1004 // pixel tests are specified by running DRT "foo.html'-p" | 1009 // pixel tests are specified by running DRT "foo.html'-p" |
1005 dumpRenderTreeOptions.add('--notree'); | 1010 dumpRenderTreeOptions.add('--notree'); |
1006 fullHtmlPath = "${fullHtmlPath}'-p"; | 1011 fullHtmlPath = "${fullHtmlPath}'-p"; |
1007 } | 1012 } |
1008 } | 1013 } |
1009 commandSet.add(new DumpRenderTreeCommand(dumpRenderTreeFilename, | 1014 commandSet.add(new DumpRenderTreeCommand(dumpRenderTreeFilename, |
1010 fullHtmlPath, | 1015 fullHtmlPath, |
1011 dumpRenderTreeOptions, | 1016 dumpRenderTreeOptions, |
1012 dartFlags, | 1017 dartFlags, |
1013 packageRootUri, | |
1014 expectedOutput)); | 1018 expectedOutput)); |
1015 } | 1019 } |
1016 | 1020 |
1017 // Create BrowserTestCase and queue it. | 1021 // Create BrowserTestCase and queue it. |
1018 String testDisplayName = '$suiteName/$testName'; | 1022 String testDisplayName = '$suiteName/$testName'; |
1019 var testCase; | 1023 var testCase; |
1020 if (info.optionsFromFile['isMultiHtmlTest']) { | 1024 if (info.optionsFromFile['isMultiHtmlTest']) { |
1021 testDisplayName = '$testDisplayName/${subtestNames[subtestIndex]}'; | 1025 testDisplayName = '$testDisplayName/${subtestNames[subtestIndex]}'; |
1022 testCase = new BrowserTestCase(testDisplayName, | 1026 testCase = new BrowserTestCase(testDisplayName, |
1023 commandSet, configuration, completeHandler, | 1027 commandSet, configuration, completeHandler, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1097 } | 1101 } |
1098 | 1102 |
1099 // Create '[build dir]/generated_tests/$compiler-$runtime/$testUniqueName', | 1103 // Create '[build dir]/generated_tests/$compiler-$runtime/$testUniqueName', |
1100 // including any intermediate directories that don't exist. | 1104 // including any intermediate directories that don't exist. |
1101 // If the tests are run in checked or minified mode we add that to the | 1105 // If the tests are run in checked or minified mode we add that to the |
1102 // '$compile-$runtime' directory name. | 1106 // '$compile-$runtime' directory name. |
1103 var checked = configuration['checked'] ? '-checked' : ''; | 1107 var checked = configuration['checked'] ? '-checked' : ''; |
1104 var minified = configuration['minified'] ? '-minified' : ''; | 1108 var minified = configuration['minified'] ? '-minified' : ''; |
1105 var dirName = "${configuration['compiler']}-${configuration['runtime']}" | 1109 var dirName = "${configuration['compiler']}-${configuration['runtime']}" |
1106 "$checked$minified"; | 1110 "$checked$minified"; |
1107 Path generatedTestPath = new Path.fromNative(buildDir) | 1111 Path generatedTestPath = new Path.fromNative(dartDir.toNativePath()) |
1112 .append(buildDir) | |
1108 .append('generated_tests') | 1113 .append('generated_tests') |
1109 .append(dirName) | 1114 .append(dirName) |
1110 .append(testUniqueName); | 1115 .append(testUniqueName); |
1111 | 1116 |
1112 TestUtils.mkdirRecursive(new Path('.'), generatedTestPath); | 1117 TestUtils.mkdirRecursive(new Path('.'), generatedTestPath); |
1113 return new File.fromPath(generatedTestPath).fullPathSync() | 1118 return new File.fromPath(generatedTestPath).fullPathSync() |
1114 .replaceAll('\\', '/'); | 1119 .replaceAll('\\', '/'); |
1115 } | 1120 } |
1116 | 1121 |
1117 String get scriptType { | 1122 String get scriptType { |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1749 outputDir = 'out/'; | 1754 outputDir = 'out/'; |
1750 } else if (system == 'macos') { | 1755 } else if (system == 'macos') { |
1751 outputDir = 'xcodebuild/'; | 1756 outputDir = 'xcodebuild/'; |
1752 } else if (system == 'windows') { | 1757 } else if (system == 'windows') { |
1753 outputDir = 'build/'; | 1758 outputDir = 'build/'; |
1754 } | 1759 } |
1755 return "$outputDir${configurationDir(configuration)}"; | 1760 return "$outputDir${configurationDir(configuration)}"; |
1756 } | 1761 } |
1757 | 1762 |
1758 static String configurationDir(Map configuration) { | 1763 static String configurationDir(Map configuration) { |
1764 // For regular dart checkouts, the configDir by default is mode+arch. | |
1765 // For Dartium, the configDir by default is mode (as defined by the Chrome | |
1766 // build setup). We can detect this because in the dartium checkout, the | |
1767 // "output" directory is a sibling of the dart directory instead of a child. | |
1759 var mode = (configuration['mode'] == 'debug') ? 'Debug' : 'Release'; | 1768 var mode = (configuration['mode'] == 'debug') ? 'Debug' : 'Release'; |
1760 var arch = configuration['arch'].toUpperCase(); | 1769 var arch = configuration['arch'].toUpperCase(); |
1761 return '$mode$arch'; | 1770 if (currentWorkingDirectory != dartDir()) { |
1771 return '$mode$arch'; | |
1772 } else { | |
1773 return mode; | |
1774 } | |
1775 } | |
1776 | |
1777 /** | |
1778 * Returns the path to the dart binary checked into the repo, used for | |
1779 * bootstrapping test.dart. | |
1780 */ | |
1781 static Path get dartTestExecutable { | |
1782 var path = '${TestUtils.dartDir()}/tools/testing/bin/' | |
1783 '${Platform.operatingSystem}/dart'; | |
1784 if (Platform.operatingSystem == 'windows') { | |
1785 path = '$path.exe'; | |
1786 } | |
1787 return new Path(path); | |
1762 } | 1788 } |
1763 } | 1789 } |
1764 | 1790 |
1765 class SummaryReport { | 1791 class SummaryReport { |
1766 static int total = 0; | 1792 static int total = 0; |
1767 static int skipped = 0; | 1793 static int skipped = 0; |
1768 static int noCrash = 0; | 1794 static int noCrash = 0; |
1769 static int pass = 0; | 1795 static int pass = 0; |
1770 static int failOk = 0; | 1796 static int failOk = 0; |
1771 static int fail = 0; | 1797 static int fail = 0; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1813 * $pass tests are expected to pass | 1839 * $pass tests are expected to pass |
1814 * $failOk tests are expected to fail that we won't fix | 1840 * $failOk tests are expected to fail that we won't fix |
1815 * $fail tests are expected to fail that we should fix | 1841 * $fail tests are expected to fail that we should fix |
1816 * $crash tests are expected to crash that we should fix | 1842 * $crash tests are expected to crash that we should fix |
1817 * $timeout tests are allowed to timeout | 1843 * $timeout tests are allowed to timeout |
1818 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1844 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
1819 """; | 1845 """; |
1820 print(report); | 1846 print(report); |
1821 } | 1847 } |
1822 } | 1848 } |
OLD | NEW |