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 import 'dart:async'; | 15 import 'dart:async'; |
16 import 'dart:io'; | 16 import 'dart:io'; |
17 | 17 |
18 import 'browser_test.dart'; | 18 import 'browser_test.dart'; |
19 import 'command.dart'; | 19 import 'command.dart'; |
20 import 'compiler_configuration.dart'; | 20 import 'compiler_configuration.dart'; |
21 import 'configuration.dart'; | 21 import 'configuration.dart'; |
22 import 'drt_updater.dart'; | |
23 import 'expectation.dart'; | 22 import 'expectation.dart'; |
24 import 'expectation_set.dart'; | 23 import 'expectation_set.dart'; |
25 import 'html_test.dart' as html_test; | 24 import 'html_test.dart' as html_test; |
26 import 'http_server.dart'; | 25 import 'http_server.dart'; |
27 import 'multitest.dart'; | 26 import 'multitest.dart'; |
28 import 'path.dart'; | 27 import 'path.dart'; |
| 28 import 'runtime_updater.dart'; |
29 import 'summary_report.dart'; | 29 import 'summary_report.dart'; |
30 import 'test_configurations.dart'; | 30 import 'test_configurations.dart'; |
31 import 'test_runner.dart'; | 31 import 'test_runner.dart'; |
32 import 'utils.dart'; | 32 import 'utils.dart'; |
33 | 33 |
34 RegExp multiHtmlTestGroupRegExp = new RegExp(r"\s*[^/]\s*group\('[^,']*"); | 34 RegExp multiHtmlTestGroupRegExp = new RegExp(r"\s*[^/]\s*group\('[^,']*"); |
35 RegExp multiHtmlTestRegExp = new RegExp(r"useHtmlIndividualConfiguration()"); | 35 RegExp multiHtmlTestRegExp = new RegExp(r"useHtmlIndividualConfiguration()"); |
36 // Require at least one non-space character before '//[/#]' | 36 // Require at least one non-space character before '//[/#]' |
37 RegExp multiTestRegExp = new RegExp(r"\S *" | 37 RegExp multiTestRegExp = new RegExp(r"\S *" |
38 r"//[#/] \w+:(.*)"); | 38 r"//[#/] \w+:(.*)"); |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 return filename.endsWith("Test.dart"); | 639 return filename.endsWith("Test.dart"); |
640 } | 640 } |
641 | 641 |
642 bool isHtmlTestFile(String filename) => filename.endsWith('_htmltest.html'); | 642 bool isHtmlTestFile(String filename) => filename.endsWith('_htmltest.html'); |
643 | 643 |
644 List<String> additionalOptions(Path filePath) => []; | 644 List<String> additionalOptions(Path filePath) => []; |
645 | 645 |
646 Future forEachTest( | 646 Future forEachTest( |
647 Function onTest, Map<String, List<TestInformation>> testCache, | 647 Function onTest, Map<String, List<TestInformation>> testCache, |
648 [VoidFunction onDone]) async { | 648 [VoidFunction onDone]) async { |
649 await updateDartium(); | 649 if (configuration.runtime == Runtime.drt && !configuration.listTests) { |
| 650 await updateContentShell(configuration.drtPath); |
| 651 } |
| 652 |
650 doTest = onTest; | 653 doTest = onTest; |
651 testExpectations = readExpectations(); | 654 testExpectations = readExpectations(); |
652 | 655 |
653 // Check if we have already found and generated the tests for this suite. | 656 // Check if we have already found and generated the tests for this suite. |
654 if (!testCache.containsKey(suiteName)) { | 657 if (!testCache.containsKey(suiteName)) { |
655 cachedTests = testCache[suiteName] = <TestInformation>[]; | 658 cachedTests = testCache[suiteName] = <TestInformation>[]; |
656 await enqueueTests(); | 659 await enqueueTests(); |
657 } else { | 660 } else { |
658 for (var info in testCache[suiteName]) { | 661 for (var info in testCache[suiteName]) { |
659 enqueueTestCaseFromTestInformation(info); | 662 enqueueTestCaseFromTestInformation(info); |
660 } | 663 } |
661 } | 664 } |
662 testExpectations = null; | 665 testExpectations = null; |
663 cachedTests = null; | 666 cachedTests = null; |
664 doTest = null; | 667 doTest = null; |
665 if (onDone != null) onDone(); | 668 if (onDone != null) onDone(); |
666 } | 669 } |
667 | 670 |
668 /** | 671 /** |
669 * If Content shell/Dartium is required, and not yet updated, waits for | |
670 * the update then completes. Otherwise completes immediately. | |
671 */ | |
672 Future updateDartium() { | |
673 var completer = new Completer(); | |
674 var updater = runtimeUpdater(configuration.runtime, configuration.drtPath, | |
675 configuration.dartiumPath); | |
676 if (updater == null || updater.updated) { | |
677 return new Future.value(null); | |
678 } | |
679 | |
680 assert(updater.isActive); | |
681 updater.onUpdated.add(() => completer.complete(null)); | |
682 | |
683 return completer.future; | |
684 } | |
685 | |
686 /** | |
687 * Reads the status files and completes with the parsed expectations. | 672 * Reads the status files and completes with the parsed expectations. |
688 */ | 673 */ |
689 ExpectationSet readExpectations() { | 674 ExpectationSet readExpectations() { |
690 var statusFiles = statusFilePaths.where((String statusFilePath) { | 675 var statusFiles = statusFilePaths.where((String statusFilePath) { |
691 var file = new File(dartDir.append(statusFilePath).toNativePath()); | 676 var file = new File(dartDir.append(statusFilePath).toNativePath()); |
692 return file.existsSync(); | 677 return file.existsSync(); |
693 }).map((statusFilePath) { | 678 }).map((statusFilePath) { |
694 return dartDir.append(statusFilePath).toNativePath(); | 679 return dartDir.append(statusFilePath).toNativePath(); |
695 }).toList(); | 680 }).toList(); |
696 | 681 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 parameters['group'] = subtestName; | 958 parameters['group'] = subtestName; |
974 } | 959 } |
975 return new Uri( | 960 return new Uri( |
976 scheme: 'http', | 961 scheme: 'http', |
977 host: configuration.localIP, | 962 host: configuration.localIP, |
978 port: serverPort, | 963 port: serverPort, |
979 path: pathComponent, | 964 path: pathComponent, |
980 queryParameters: parameters); | 965 queryParameters: parameters); |
981 } | 966 } |
982 | 967 |
983 void _createWrapperFile( | |
984 String dartWrapperFilename, Path localDartLibraryFilename) { | |
985 File file = new File(dartWrapperFilename); | |
986 RandomAccessFile dartWrapper = file.openSync(mode: FileMode.WRITE); | |
987 | |
988 var libraryPathComponent = _createUrlPathFromFile(localDartLibraryFilename); | |
989 var generatedSource = dartTestWrapper(libraryPathComponent); | |
990 dartWrapper.writeStringSync(generatedSource); | |
991 dartWrapper.closeSync(); | |
992 } | |
993 | |
994 /** | 968 /** |
995 * The [StandardTestSuite] has support for tests that | 969 * The [StandardTestSuite] has support for tests that |
996 * compile a test from Dart to JavaScript, and then run the resulting | 970 * compile a test from Dart to JavaScript, and then run the resulting |
997 * JavaScript. This function creates a working directory to hold the | 971 * JavaScript. This function creates a working directory to hold the |
998 * JavaScript version of the test, and copies the appropriate framework | 972 * JavaScript version of the test, and copies the appropriate framework |
999 * files to that directory. It creates a [BrowserTestCase], which has | 973 * files to that directory. It creates a [BrowserTestCase], which has |
1000 * two sequential steps to be run by the [ProcessQueue] when the test is | 974 * two sequential steps to be run by the [ProcessQueue] when the test is |
1001 * executed: a compilation step and an execution step, both with the | 975 * executed: a compilation step and an execution step, both with the |
1002 * appropriate executable and arguments. The [expectations] object can be | 976 * appropriate executable and arguments. The [expectations] object can be |
1003 * either a Set<String> if the test is a regular test, or a Map<String | 977 * either a Set<String> if the test is a regular test, or a Map<String |
(...skipping 19 matching lines...) Expand all Loading... |
1023 } | 997 } |
1024 | 998 |
1025 void _enqueueBrowserTestWithOptions( | 999 void _enqueueBrowserTestWithOptions( |
1026 Path packageRoot, | 1000 Path packageRoot, |
1027 Path packages, | 1001 Path packages, |
1028 TestInformation info, | 1002 TestInformation info, |
1029 String testName, | 1003 String testName, |
1030 Map<String, Set<Expectation>> expectations, | 1004 Map<String, Set<Expectation>> expectations, |
1031 List<String> vmOptions, | 1005 List<String> vmOptions, |
1032 String tempDir) { | 1006 String tempDir) { |
1033 // TODO(Issue 14651): If we're on dartium, we need to pass [packageRoot] | 1007 var fileName = info.filePath.toNativePath(); |
1034 // on to the browser (it may be test specific). | |
1035 var filePath = info.filePath; | |
1036 var fileName = filePath.toNativePath(); | |
1037 | |
1038 var optionsFromFile = info.optionsFromFile; | 1008 var optionsFromFile = info.optionsFromFile; |
1039 var compilationTempDir = createCompilationOutputDirectory(info.filePath); | 1009 var compilationTempDir = createCompilationOutputDirectory(info.filePath); |
1040 var dartWrapperFilename = '$tempDir/test.dart'; | 1010 var jsWrapperFileName = '$compilationTempDir/test.js'; |
1041 var compiledDartWrapperFilename = '$compilationTempDir/test.js'; | 1011 var nameNoExt = info.filePath.filenameWithoutExtension; |
1042 var dir = filePath.directoryPath; | |
1043 var nameNoExt = filePath.filenameWithoutExtension; | |
1044 var customHtmlPath = dir.append('$nameNoExt.html').toNativePath(); | |
1045 var customHtml = new File(customHtmlPath); | |
1046 | 1012 |
1047 // Use existing HTML document if available. | 1013 // Use existing HTML document if available. |
1048 String htmlPath; | |
1049 String content; | 1014 String content; |
| 1015 var customHtml = new File( |
| 1016 info.filePath.directoryPath.append('$nameNoExt.html').toNativePath()); |
1050 if (customHtml.existsSync()) { | 1017 if (customHtml.existsSync()) { |
1051 htmlPath = '$tempDir/test.html'; | 1018 jsWrapperFileName = '$tempDir/$nameNoExt.js'; |
1052 dartWrapperFilename = filePath.toNativePath(); | 1019 content = customHtml.readAsStringSync().replaceAll( |
1053 | 1020 '%TEST_SCRIPTS%', '<script src="$nameNoExt.js"></script>'); |
1054 var htmlContents = customHtml.readAsStringSync(); | |
1055 if (configuration.compiler == Compiler.none) { | |
1056 var dartUrl = _createUrlPathFromFile(filePath); | |
1057 var dartScript = | |
1058 '<script type="application/dart" src="$dartUrl"></script>'; | |
1059 var jsUrl = '/packages/browser/dart.js'; | |
1060 var jsScript = '<script type="text/javascript" src="$jsUrl"></script>'; | |
1061 htmlContents = | |
1062 htmlContents.replaceAll('%TEST_SCRIPTS%', '$dartScript\n$jsScript'); | |
1063 } else { | |
1064 compiledDartWrapperFilename = '$tempDir/$nameNoExt.js'; | |
1065 htmlContents = htmlContents.replaceAll( | |
1066 '%TEST_SCRIPTS%', '<script src="$nameNoExt.js"></script>'); | |
1067 } | |
1068 new File(htmlPath).writeAsStringSync(htmlContents); | |
1069 } else { | 1021 } else { |
1070 htmlPath = '$tempDir/test.html'; | 1022 // Synthesize an HTML file for the test. |
1071 if (configuration.compiler != Compiler.dart2js && | 1023 var scriptPath = _createUrlPathFromFile(new Path(jsWrapperFileName)); |
1072 configuration.compiler != Compiler.dartdevc) { | |
1073 // test.dart will import the dart test. | |
1074 _createWrapperFile(dartWrapperFilename, filePath); | |
1075 } else { | |
1076 dartWrapperFilename = fileName; | |
1077 } | |
1078 | |
1079 // Create the HTML file for the test. | |
1080 var scriptPath = dartWrapperFilename; | |
1081 if (configuration.compiler != Compiler.none) { | |
1082 scriptPath = compiledDartWrapperFilename; | |
1083 } | |
1084 scriptPath = _createUrlPathFromFile(new Path(scriptPath)); | |
1085 | 1024 |
1086 if (configuration.compiler != Compiler.dartdevc) { | 1025 if (configuration.compiler != Compiler.dartdevc) { |
1087 content = getHtmlContents(fileName, scriptType, scriptPath); | 1026 content = dart2jsHtml(fileName, scriptPath); |
1088 } else { | 1027 } else { |
1089 var jsDir = new Path(compilationTempDir) | 1028 var jsDir = new Path(compilationTempDir) |
1090 .relativeTo(TestUtils.dartDir) | 1029 .relativeTo(TestUtils.dartDir) |
1091 .toString(); | 1030 .toString(); |
1092 content = dartdevcHtml(nameNoExt, jsDir, buildDir); | 1031 content = dartdevcHtml(nameNoExt, jsDir, buildDir); |
1093 } | 1032 } |
| 1033 } |
1094 | 1034 |
1095 new File(htmlPath).writeAsStringSync(content); | 1035 var htmlPath = '$tempDir/test.html'; |
1096 } | 1036 new File(htmlPath).writeAsStringSync(content); |
1097 | 1037 |
1098 // Construct the command(s) that compile all the inputs needed by the | 1038 // Construct the command(s) that compile all the inputs needed by the |
1099 // browser test. For running Dart in DRT, this will be noop commands. | 1039 // browser test. For running Dart in DRT, this will be noop commands. |
1100 var commands = <Command>[]; | 1040 var commands = <Command>[]; |
1101 | 1041 |
1102 switch (configuration.compiler) { | 1042 switch (configuration.compiler) { |
1103 case Compiler.dart2js: | 1043 case Compiler.dart2js: |
1104 commands.add(_dart2jsCompileCommand(dartWrapperFilename, | 1044 commands.add(_dart2jsCompileCommand( |
1105 compiledDartWrapperFilename, tempDir, optionsFromFile)); | 1045 fileName, jsWrapperFileName, tempDir, optionsFromFile)); |
1106 break; | 1046 break; |
1107 | 1047 |
1108 case Compiler.dartdevc: | 1048 case Compiler.dartdevc: |
1109 var toPath = new Path('$compilationTempDir/$nameNoExt.js') | 1049 var toPath = |
1110 .toNativePath(); | 1050 new Path('$compilationTempDir/$nameNoExt.js').toNativePath(); |
1111 commands.add(configuration.compilerConfiguration.createCommand( | 1051 commands.add(configuration.compilerConfiguration |
1112 dartWrapperFilename, toPath)); | 1052 .createCommand(fileName, toPath)); |
1113 break; | |
1114 | |
1115 case Compiler.none: | |
1116 break; | 1053 break; |
1117 | 1054 |
1118 default: | 1055 default: |
1119 assert(false); | 1056 assert(false); |
1120 } | 1057 } |
1121 | 1058 |
1122 // Some tests require compiling multiple input scripts. | 1059 // Some tests require compiling multiple input scripts. |
1123 for (var name in optionsFromFile['otherScripts'] as List<String>) { | 1060 for (var name in optionsFromFile['otherScripts'] as List<String>) { |
1124 var namePath = new Path(name); | 1061 var namePath = new Path(name); |
1125 var fromPath = filePath.directoryPath.join(namePath); | 1062 var fromPath = info.filePath.directoryPath.join(namePath); |
1126 var toPath = new Path('$tempDir/${namePath.filename}.js').toNativePath(); | 1063 var toPath = new Path('$tempDir/${namePath.filename}.js').toNativePath(); |
1127 | 1064 |
1128 switch (configuration.compiler) { | 1065 switch (configuration.compiler) { |
1129 case Compiler.dart2js: | 1066 case Compiler.dart2js: |
1130 commands.add(_dart2jsCompileCommand(fromPath.toNativePath(), | 1067 commands.add(_dart2jsCompileCommand( |
1131 toPath, tempDir, optionsFromFile)); | 1068 fromPath.toNativePath(), toPath, tempDir, optionsFromFile)); |
1132 break; | 1069 break; |
1133 | 1070 |
1134 case Compiler.dartdevc: | 1071 case Compiler.dartdevc: |
1135 commands.add(configuration.compilerConfiguration.createCommand( | 1072 commands.add(configuration.compilerConfiguration |
1136 fromPath.toNativePath(), toPath)); | 1073 .createCommand(fromPath.toNativePath(), toPath)); |
1137 break; | 1074 break; |
1138 | |
1139 default: | |
1140 assert(configuration.compiler == Compiler.none); | |
1141 } | |
1142 | |
1143 if (configuration.compiler == Compiler.none) { | |
1144 // For the tests that require multiple input scripts but are not | |
1145 // compiled, move the input scripts over with the script so they can | |
1146 // be accessed. | |
1147 new File(fromPath.toNativePath()) | |
1148 .copySync('$tempDir/${namePath.filename}'); | |
1149 } | 1075 } |
1150 } | 1076 } |
1151 | 1077 |
1152 if (info.optionsFromFile['isMultiHtmlTest'] as bool) { | 1078 if (info.optionsFromFile['isMultiHtmlTest'] as bool) { |
1153 // Variables for browser multi-tests. | 1079 // Variables for browser multi-tests. |
1154 var subtestNames = info.optionsFromFile['subtestNames'] as List<String>; | 1080 var subtestNames = info.optionsFromFile['subtestNames'] as List<String>; |
1155 for (var subtestName in subtestNames) { | 1081 for (var subtestName in subtestNames) { |
1156 _enqueueSingleBrowserTest(commands, info, '$testName/$subtestName', | 1082 _enqueueSingleBrowserTest(commands, info, '$testName/$subtestName', |
1157 subtestName, expectations, vmOptions, htmlPath); | 1083 subtestName, expectations, vmOptions, htmlPath); |
1158 } | 1084 } |
(...skipping 27 matching lines...) Expand all Loading... |
1186 // Chrome may send a termination signal to a test. The test will be | 1112 // Chrome may send a termination signal to a test. The test will be |
1187 // terminated if a machine (bot) doesn't have a GPU or if a test is | 1113 // terminated if a machine (bot) doesn't have a GPU or if a test is |
1188 // still running after a certain period of time. | 1114 // still running after a certain period of time. |
1189 if (configuration.system == System.linux && | 1115 if (configuration.system == System.linux && |
1190 configuration.runtime == Runtime.drt) { | 1116 configuration.runtime == Runtime.drt) { |
1191 contentShellOptions.add('--disable-gpu'); | 1117 contentShellOptions.add('--disable-gpu'); |
1192 // TODO(terry): Roll 50 need this in conjection with disable-gpu. | 1118 // TODO(terry): Roll 50 need this in conjection with disable-gpu. |
1193 contentShellOptions.add('--disable-gpu-early-init'); | 1119 contentShellOptions.add('--disable-gpu-early-init'); |
1194 } | 1120 } |
1195 | 1121 |
1196 if (configuration.compiler == Compiler.none) { | |
1197 dartFlags.add('--ignore-unrecognized-flags'); | |
1198 if (configuration.isChecked) { | |
1199 dartFlags.add('--enable_asserts'); | |
1200 dartFlags.add("--enable_type_checks"); | |
1201 } | |
1202 dartFlags.addAll(vmOptions); | |
1203 } | |
1204 | |
1205 commands.add(Command.contentShell(contentShellFilename, fullHtmlPath, | 1122 commands.add(Command.contentShell(contentShellFilename, fullHtmlPath, |
1206 contentShellOptions, dartFlags, environmentOverrides)); | 1123 contentShellOptions, dartFlags, environmentOverrides)); |
1207 } else { | 1124 } else { |
1208 commands.add(Command.browserTest(fullHtmlPath, configuration, | 1125 commands.add(Command.browserTest(fullHtmlPath, configuration, |
1209 retry: !isNegative(info))); | 1126 retry: !isNegative(info))); |
1210 } | 1127 } |
1211 | 1128 |
1212 // Create BrowserTestCase and queue it. | 1129 // Create BrowserTestCase and queue it. |
1213 var expectation = expectations[testName]; | 1130 var expectation = expectations[testName]; |
1214 var testCase = new BrowserTestCase('$suiteName/$testName', commands, | 1131 var testCase = new BrowserTestCase('$suiteName/$testName', commands, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 args.add(inputFile); | 1235 args.add(inputFile); |
1319 | 1236 |
1320 var options = optionsFromFile['sharedOptions'] as List<String>; | 1237 var options = optionsFromFile['sharedOptions'] as List<String>; |
1321 if (options != null) args.addAll(options); | 1238 if (options != null) args.addAll(options); |
1322 | 1239 |
1323 return Command.compilation(Compiler.dart2js.name, outputFile, | 1240 return Command.compilation(Compiler.dart2js.name, outputFile, |
1324 dart2JsBootstrapDependencies, compilerPath, args, environmentOverrides, | 1241 dart2JsBootstrapDependencies, compilerPath, args, environmentOverrides, |
1325 alwaysCompile: !useSdk); | 1242 alwaysCompile: !useSdk); |
1326 } | 1243 } |
1327 | 1244 |
1328 String get scriptType { | |
1329 switch (configuration.compiler) { | |
1330 case Compiler.none: | |
1331 return 'application/dart'; | |
1332 case Compiler.dart2js: | |
1333 case Compiler.dart2analyzer: | |
1334 case Compiler.dartdevc: | |
1335 return 'text/javascript'; | |
1336 default: | |
1337 print('Non-web runtime, so no scriptType for: ' | |
1338 '${configuration.compiler.name}'); | |
1339 exit(1); | |
1340 return null; | |
1341 } | |
1342 } | |
1343 | |
1344 bool get hasRuntime => configuration.runtime != Runtime.none; | 1245 bool get hasRuntime => configuration.runtime != Runtime.none; |
1345 | 1246 |
1346 String get contentShellFilename { | 1247 String get contentShellFilename { |
1347 if (configuration.drtPath != null) return configuration.drtPath; | 1248 if (configuration.drtPath != null) return configuration.drtPath; |
1348 | 1249 |
1349 if (Platform.operatingSystem == 'macos') { | 1250 if (Platform.operatingSystem == 'macos') { |
1350 final path = dartDir.append( | 1251 final path = dartDir.append( |
1351 '/client/tests/drt/Content Shell.app/Contents/MacOS/Content Shell'); | 1252 '/client/tests/drt/Content Shell.app/Contents/MacOS/Content Shell'); |
1352 return path.toNativePath(); | 1253 return path.toNativePath(); |
1353 } | 1254 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 return null; | 1298 return null; |
1398 } | 1299 } |
1399 } | 1300 } |
1400 | 1301 |
1401 /** | 1302 /** |
1402 * Special options for individual tests are currently specified in various | 1303 * Special options for individual tests are currently specified in various |
1403 * ways: with comments directly in test files, by using certain imports, or by | 1304 * ways: with comments directly in test files, by using certain imports, or by |
1404 * creating additional files in the test directories. | 1305 * creating additional files in the test directories. |
1405 * | 1306 * |
1406 * Here is a list of options that are used by 'test.dart' today: | 1307 * Here is a list of options that are used by 'test.dart' today: |
1407 * - Flags can be passed to the vm or dartium process that runs the test by | 1308 * - Flags can be passed to the vm process that runs the test by adding a |
1408 * adding a comment to the test file: | 1309 * comment to the test file: |
1409 * | 1310 * |
1410 * // VMOptions=--flag1 --flag2 | 1311 * // VMOptions=--flag1 --flag2 |
1411 * | 1312 * |
1412 * - Flags can be passed to dart2js or vm by adding a comment | 1313 * - Flags can be passed to dart2js or vm by adding a comment |
1413 * to the test file: | 1314 * to the test file: |
1414 * | 1315 * |
1415 * // SharedOptions=--flag1 --flag2 | 1316 * // SharedOptions=--flag1 --flag2 |
1416 * | 1317 * |
1417 * - Flags can be passed to the dart script that contains the test also | 1318 * - Flags can be passed to the dart script that contains the test also |
1418 * using comments, as follows: | 1319 * using comments, as follows: |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 Compiler.dartkp, | 1543 Compiler.dartkp, |
1643 Compiler.precompiler, | 1544 Compiler.precompiler, |
1644 Compiler.appJit | 1545 Compiler.appJit |
1645 ]; | 1546 ]; |
1646 | 1547 |
1647 const runtimes = const [ | 1548 const runtimes = const [ |
1648 Runtime.none, | 1549 Runtime.none, |
1649 Runtime.dartPrecompiled, | 1550 Runtime.dartPrecompiled, |
1650 Runtime.vm, | 1551 Runtime.vm, |
1651 Runtime.drt, | 1552 Runtime.drt, |
1652 Runtime.dartium, | 1553 Runtime.contentShellOnAndroid |
1653 Runtime.contentShellOnAndroid, | |
1654 Runtime.dartiumOnAndroid | |
1655 ]; | 1554 ]; |
1656 | 1555 |
1657 var needsVmOptions = compilers.contains(configuration.compiler) && | 1556 var needsVmOptions = compilers.contains(configuration.compiler) && |
1658 runtimes.contains(configuration.runtime); | 1557 runtimes.contains(configuration.runtime); |
1659 if (!needsVmOptions) return [[]]; | 1558 if (!needsVmOptions) return [[]]; |
1660 return optionsFromFile['vmOptions'] as List<List<String>>; | 1559 return optionsFromFile['vmOptions'] as List<List<String>>; |
1661 } | 1560 } |
1662 | 1561 |
1663 /** | 1562 /** |
1664 * Read options from a co19 test file. | 1563 * Read options from a co19 test file. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 Directory dir = new Directory(suiteDir.append(testDir).toNativePath()); | 1666 Directory dir = new Directory(suiteDir.append(testDir).toNativePath()); |
1768 if (dir.existsSync()) { | 1667 if (dir.existsSync()) { |
1769 enqueueDirectory(dir, group); | 1668 enqueueDirectory(dir, group); |
1770 } | 1669 } |
1771 } | 1670 } |
1772 | 1671 |
1773 return group.future; | 1672 return group.future; |
1774 } | 1673 } |
1775 } | 1674 } |
1776 | 1675 |
| 1676 // TODO(rnystrom): Merge with DartcCompilationTestSuite since that class isn't |
| 1677 // used for anything but this now. |
1777 class AnalyzeLibraryTestSuite extends DartcCompilationTestSuite { | 1678 class AnalyzeLibraryTestSuite extends DartcCompilationTestSuite { |
1778 static String libraryPath(Configuration configuration) => | 1679 static String libraryPath(Configuration configuration) => |
1779 configuration.useSdk ? '${configuration.buildDirectory}/dart-sdk' : 'sdk'; | 1680 configuration.useSdk ? '${configuration.buildDirectory}/dart-sdk' : 'sdk'; |
1780 | 1681 |
1781 AnalyzeLibraryTestSuite(Configuration configuration) | 1682 AnalyzeLibraryTestSuite(Configuration configuration) |
1782 : super(configuration, 'analyze_library', libraryPath(configuration), | 1683 : super(configuration, 'analyze_library', libraryPath(configuration), |
1783 ['lib'], ['tests/lib/analyzer/analyze_library.status']); | 1684 ['lib'], ['tests/lib/analyzer/analyze_library.status']); |
1784 | 1685 |
1785 List<String> additionalOptions(Path filePath, {bool showSdkWarnings}) { | 1686 List<String> additionalOptions(Path filePath, {bool showSdkWarnings}) { |
1786 var options = super.additionalOptions(filePath); | 1687 var options = super.additionalOptions(filePath); |
1787 options.add('--sdk-warnings'); | 1688 options.add('--sdk-warnings'); |
1788 return options; | 1689 return options; |
1789 } | 1690 } |
1790 | 1691 |
1791 bool isTestFile(String filename) { | 1692 bool isTestFile(String filename) { |
1792 // NOTE: We exclude tests and patch files for now. | 1693 // NOTE: We exclude tests and patch files for now. |
1793 return filename.endsWith(".dart") && | 1694 return filename.endsWith(".dart") && |
1794 !filename.endsWith("_test.dart") && | 1695 !filename.endsWith("_test.dart") && |
1795 !filename.contains("_internal/js_runtime/lib"); | 1696 !filename.contains("_internal/js_runtime/lib"); |
1796 } | 1697 } |
1797 | 1698 |
1798 bool get listRecursively => true; | 1699 bool get listRecursively => true; |
1799 } | 1700 } |
OLD | NEW |