| 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 = new Path('$compilationTempDir/$nameNoExt.js') | 
| 1110             .toNativePath(); | 1050             .toNativePath(); | 
| 1111         commands.add(configuration.compilerConfiguration.createCommand( | 1051         commands.add(configuration.compilerConfiguration.createCommand( | 
| 1112             dartWrapperFilename, toPath, | 1052             dartWrapperFilename, toPath, | 
| 1113             optionsFromFile["sharedOptions"] as List<String>)); | 1053             optionsFromFile["sharedOptions"] as List<String>)); | 
| 1114         break; | 1054         break; | 
| 1115 | 1055 | 
| 1116       case Compiler.none: |  | 
| 1117         break; |  | 
| 1118 |  | 
| 1119       default: | 1056       default: | 
| 1120         assert(false); | 1057         assert(false); | 
| 1121     } | 1058     } | 
| 1122 | 1059 | 
| 1123     // Some tests require compiling multiple input scripts. | 1060     // Some tests require compiling multiple input scripts. | 
| 1124     for (var name in optionsFromFile['otherScripts'] as List<String>) { | 1061     for (var name in optionsFromFile['otherScripts'] as List<String>) { | 
| 1125       var namePath = new Path(name); | 1062       var namePath = new Path(name); | 
| 1126       var fromPath = filePath.directoryPath.join(namePath); | 1063       var fromPath = info.filePath.directoryPath.join(namePath); | 
| 1127       var toPath = new Path('$tempDir/${namePath.filename}.js').toNativePath(); | 1064       var toPath = new Path('$tempDir/${namePath.filename}.js').toNativePath(); | 
| 1128 | 1065 | 
| 1129       switch (configuration.compiler) { | 1066       switch (configuration.compiler) { | 
| 1130         case Compiler.dart2js: | 1067         case Compiler.dart2js: | 
| 1131           commands.add(_dart2jsCompileCommand(fromPath.toNativePath(), | 1068           commands.add(_dart2jsCompileCommand( | 
| 1132               toPath, tempDir, optionsFromFile)); | 1069               fromPath.toNativePath(), toPath, tempDir, optionsFromFile)); | 
| 1133           break; | 1070           break; | 
| 1134 | 1071 | 
| 1135         case Compiler.dartdevc: | 1072         case Compiler.dartdevc: | 
| 1136           commands.add(configuration.compilerConfiguration.createCommand( | 1073           commands.add(configuration.compilerConfiguration.createCommand( | 
| 1137               fromPath.toNativePath(), toPath, | 1074               fromPath.toNativePath(), toPath, | 
| 1138               optionsFromFile["sharedOptions"] as List<String>)); | 1075               optionsFromFile["sharedOptions"] as List<String>)); | 
| 1139           break; | 1076           break; | 
| 1140 |  | 
| 1141         default: |  | 
| 1142           assert(configuration.compiler == Compiler.none); |  | 
| 1143       } |  | 
| 1144 |  | 
| 1145       if (configuration.compiler == Compiler.none) { |  | 
| 1146         // For the tests that require multiple input scripts but are not |  | 
| 1147         // compiled, move the input scripts over with the script so they can |  | 
| 1148         // be accessed. |  | 
| 1149         new File(fromPath.toNativePath()) |  | 
| 1150             .copySync('$tempDir/${namePath.filename}'); |  | 
| 1151       } | 1077       } | 
| 1152     } | 1078     } | 
| 1153 | 1079 | 
| 1154     if (info.optionsFromFile['isMultiHtmlTest'] as bool) { | 1080     if (info.optionsFromFile['isMultiHtmlTest'] as bool) { | 
| 1155       // Variables for browser multi-tests. | 1081       // Variables for browser multi-tests. | 
| 1156       var subtestNames = info.optionsFromFile['subtestNames'] as List<String>; | 1082       var subtestNames = info.optionsFromFile['subtestNames'] as List<String>; | 
| 1157       for (var subtestName in subtestNames) { | 1083       for (var subtestName in subtestNames) { | 
| 1158         _enqueueSingleBrowserTest(commands, info, '$testName/$subtestName', | 1084         _enqueueSingleBrowserTest(commands, info, '$testName/$subtestName', | 
| 1159             subtestName, expectations, vmOptions, htmlPath); | 1085             subtestName, expectations, vmOptions, htmlPath); | 
| 1160       } | 1086       } | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 1188       // Chrome may send a termination signal to a test.  The test will be | 1114       // Chrome may send a termination signal to a test.  The test will be | 
| 1189       // terminated if a machine (bot) doesn't have a GPU or if a test is | 1115       // terminated if a machine (bot) doesn't have a GPU or if a test is | 
| 1190       // still running after a certain period of time. | 1116       // still running after a certain period of time. | 
| 1191       if (configuration.system == System.linux && | 1117       if (configuration.system == System.linux && | 
| 1192           configuration.runtime == Runtime.drt) { | 1118           configuration.runtime == Runtime.drt) { | 
| 1193         contentShellOptions.add('--disable-gpu'); | 1119         contentShellOptions.add('--disable-gpu'); | 
| 1194         // TODO(terry): Roll 50 need this in conjection with disable-gpu. | 1120         // TODO(terry): Roll 50 need this in conjection with disable-gpu. | 
| 1195         contentShellOptions.add('--disable-gpu-early-init'); | 1121         contentShellOptions.add('--disable-gpu-early-init'); | 
| 1196       } | 1122       } | 
| 1197 | 1123 | 
| 1198       if (configuration.compiler == Compiler.none) { |  | 
| 1199         dartFlags.add('--ignore-unrecognized-flags'); |  | 
| 1200         if (configuration.isChecked) { |  | 
| 1201           dartFlags.add('--enable_asserts'); |  | 
| 1202           dartFlags.add("--enable_type_checks"); |  | 
| 1203         } |  | 
| 1204         dartFlags.addAll(vmOptions); |  | 
| 1205       } |  | 
| 1206 |  | 
| 1207       commands.add(Command.contentShell(contentShellFilename, fullHtmlPath, | 1124       commands.add(Command.contentShell(contentShellFilename, fullHtmlPath, | 
| 1208           contentShellOptions, dartFlags, environmentOverrides)); | 1125           contentShellOptions, dartFlags, environmentOverrides)); | 
| 1209     } else { | 1126     } else { | 
| 1210       commands.add(Command.browserTest(fullHtmlPath, configuration, | 1127       commands.add(Command.browserTest(fullHtmlPath, configuration, | 
| 1211           retry: !isNegative(info))); | 1128           retry: !isNegative(info))); | 
| 1212     } | 1129     } | 
| 1213 | 1130 | 
| 1214     // Create BrowserTestCase and queue it. | 1131     // Create BrowserTestCase and queue it. | 
| 1215     var expectation = expectations[testName]; | 1132     var expectation = expectations[testName]; | 
| 1216     var testCase = new BrowserTestCase('$suiteName/$testName', commands, | 1133     var testCase = new BrowserTestCase('$suiteName/$testName', commands, | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1320     args.add(inputFile); | 1237     args.add(inputFile); | 
| 1321 | 1238 | 
| 1322     var options = optionsFromFile['sharedOptions'] as List<String>; | 1239     var options = optionsFromFile['sharedOptions'] as List<String>; | 
| 1323     if (options != null) args.addAll(options); | 1240     if (options != null) args.addAll(options); | 
| 1324 | 1241 | 
| 1325     return Command.compilation(Compiler.dart2js.name, outputFile, | 1242     return Command.compilation(Compiler.dart2js.name, outputFile, | 
| 1326         dart2JsBootstrapDependencies, compilerPath, args, environmentOverrides, | 1243         dart2JsBootstrapDependencies, compilerPath, args, environmentOverrides, | 
| 1327         alwaysCompile: !useSdk); | 1244         alwaysCompile: !useSdk); | 
| 1328   } | 1245   } | 
| 1329 | 1246 | 
| 1330   String get scriptType { |  | 
| 1331     switch (configuration.compiler) { |  | 
| 1332       case Compiler.none: |  | 
| 1333         return 'application/dart'; |  | 
| 1334       case Compiler.dart2js: |  | 
| 1335       case Compiler.dart2analyzer: |  | 
| 1336       case Compiler.dartdevc: |  | 
| 1337         return 'text/javascript'; |  | 
| 1338       default: |  | 
| 1339         print('Non-web runtime, so no scriptType for: ' |  | 
| 1340             '${configuration.compiler.name}'); |  | 
| 1341         exit(1); |  | 
| 1342         return null; |  | 
| 1343     } |  | 
| 1344   } |  | 
| 1345 |  | 
| 1346   bool get hasRuntime => configuration.runtime != Runtime.none; | 1247   bool get hasRuntime => configuration.runtime != Runtime.none; | 
| 1347 | 1248 | 
| 1348   String get contentShellFilename { | 1249   String get contentShellFilename { | 
| 1349     if (configuration.drtPath != null) return configuration.drtPath; | 1250     if (configuration.drtPath != null) return configuration.drtPath; | 
| 1350 | 1251 | 
| 1351     if (Platform.operatingSystem == 'macos') { | 1252     if (Platform.operatingSystem == 'macos') { | 
| 1352       final path = dartDir.append( | 1253       final path = dartDir.append( | 
| 1353           '/client/tests/drt/Content Shell.app/Contents/MacOS/Content Shell'); | 1254           '/client/tests/drt/Content Shell.app/Contents/MacOS/Content Shell'); | 
| 1354       return path.toNativePath(); | 1255       return path.toNativePath(); | 
| 1355     } | 1256     } | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1399       return null; | 1300       return null; | 
| 1400     } | 1301     } | 
| 1401   } | 1302   } | 
| 1402 | 1303 | 
| 1403   /** | 1304   /** | 
| 1404    * Special options for individual tests are currently specified in various | 1305    * Special options for individual tests are currently specified in various | 
| 1405    * ways: with comments directly in test files, by using certain imports, or by | 1306    * ways: with comments directly in test files, by using certain imports, or by | 
| 1406    * creating additional files in the test directories. | 1307    * creating additional files in the test directories. | 
| 1407    * | 1308    * | 
| 1408    * Here is a list of options that are used by 'test.dart' today: | 1309    * Here is a list of options that are used by 'test.dart' today: | 
| 1409    *   - Flags can be passed to the vm or dartium process that runs the test by | 1310    *   - Flags can be passed to the vm process that runs the test by adding a | 
| 1410    *   adding a comment to the test file: | 1311    *   comment to the test file: | 
| 1411    * | 1312    * | 
| 1412    *     // VMOptions=--flag1 --flag2 | 1313    *     // VMOptions=--flag1 --flag2 | 
| 1413    * | 1314    * | 
| 1414    *   - Flags can be passed to dart2js or vm by adding a comment | 1315    *   - Flags can be passed to dart2js or vm by adding a comment | 
| 1415    *   to the test file: | 1316    *   to the test file: | 
| 1416    * | 1317    * | 
| 1417    *     // SharedOptions=--flag1 --flag2 | 1318    *     // SharedOptions=--flag1 --flag2 | 
| 1418    * | 1319    * | 
| 1419    *   - Flags can be passed to the dart script that contains the test also | 1320    *   - Flags can be passed to the dart script that contains the test also | 
| 1420    *   using comments, as follows: | 1321    *   using comments, as follows: | 
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1644       Compiler.dartkp, | 1545       Compiler.dartkp, | 
| 1645       Compiler.precompiler, | 1546       Compiler.precompiler, | 
| 1646       Compiler.appJit | 1547       Compiler.appJit | 
| 1647     ]; | 1548     ]; | 
| 1648 | 1549 | 
| 1649     const runtimes = const [ | 1550     const runtimes = const [ | 
| 1650       Runtime.none, | 1551       Runtime.none, | 
| 1651       Runtime.dartPrecompiled, | 1552       Runtime.dartPrecompiled, | 
| 1652       Runtime.vm, | 1553       Runtime.vm, | 
| 1653       Runtime.drt, | 1554       Runtime.drt, | 
| 1654       Runtime.dartium, | 1555       Runtime.contentShellOnAndroid | 
| 1655       Runtime.contentShellOnAndroid, |  | 
| 1656       Runtime.dartiumOnAndroid |  | 
| 1657     ]; | 1556     ]; | 
| 1658 | 1557 | 
| 1659     var needsVmOptions = compilers.contains(configuration.compiler) && | 1558     var needsVmOptions = compilers.contains(configuration.compiler) && | 
| 1660         runtimes.contains(configuration.runtime); | 1559         runtimes.contains(configuration.runtime); | 
| 1661     if (!needsVmOptions) return [[]]; | 1560     if (!needsVmOptions) return [[]]; | 
| 1662     return optionsFromFile['vmOptions'] as List<List<String>>; | 1561     return optionsFromFile['vmOptions'] as List<List<String>>; | 
| 1663   } | 1562   } | 
| 1664 | 1563 | 
| 1665   /** | 1564   /** | 
| 1666    * Read options from a co19 test file. | 1565    * Read options from a co19 test file. | 
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1769       Directory dir = new Directory(suiteDir.append(testDir).toNativePath()); | 1668       Directory dir = new Directory(suiteDir.append(testDir).toNativePath()); | 
| 1770       if (dir.existsSync()) { | 1669       if (dir.existsSync()) { | 
| 1771         enqueueDirectory(dir, group); | 1670         enqueueDirectory(dir, group); | 
| 1772       } | 1671       } | 
| 1773     } | 1672     } | 
| 1774 | 1673 | 
| 1775     return group.future; | 1674     return group.future; | 
| 1776   } | 1675   } | 
| 1777 } | 1676 } | 
| 1778 | 1677 | 
|  | 1678 // TODO(rnystrom): Merge with DartcCompilationTestSuite since that class isn't | 
|  | 1679 // used for anything but this now. | 
| 1779 class AnalyzeLibraryTestSuite extends DartcCompilationTestSuite { | 1680 class AnalyzeLibraryTestSuite extends DartcCompilationTestSuite { | 
| 1780   static String libraryPath(Configuration configuration) => | 1681   static String libraryPath(Configuration configuration) => | 
| 1781       configuration.useSdk ? '${configuration.buildDirectory}/dart-sdk' : 'sdk'; | 1682       configuration.useSdk ? '${configuration.buildDirectory}/dart-sdk' : 'sdk'; | 
| 1782 | 1683 | 
| 1783   AnalyzeLibraryTestSuite(Configuration configuration) | 1684   AnalyzeLibraryTestSuite(Configuration configuration) | 
| 1784       : super(configuration, 'analyze_library', libraryPath(configuration), | 1685       : super(configuration, 'analyze_library', libraryPath(configuration), | 
| 1785             ['lib'], ['tests/lib/analyzer/analyze_library.status']); | 1686             ['lib'], ['tests/lib/analyzer/analyze_library.status']); | 
| 1786 | 1687 | 
| 1787   List<String> additionalOptions(Path filePath, {bool showSdkWarnings}) { | 1688   List<String> additionalOptions(Path filePath, {bool showSdkWarnings}) { | 
| 1788     var options = super.additionalOptions(filePath); | 1689     var options = super.additionalOptions(filePath); | 
| 1789     options.add('--sdk-warnings'); | 1690     options.add('--sdk-warnings'); | 
| 1790     return options; | 1691     return options; | 
| 1791   } | 1692   } | 
| 1792 | 1693 | 
| 1793   bool isTestFile(String filename) { | 1694   bool isTestFile(String filename) { | 
| 1794     // NOTE: We exclude tests and patch files for now. | 1695     // NOTE: We exclude tests and patch files for now. | 
| 1795     return filename.endsWith(".dart") && | 1696     return filename.endsWith(".dart") && | 
| 1796         !filename.endsWith("_test.dart") && | 1697         !filename.endsWith("_test.dart") && | 
| 1797         !filename.contains("_internal/js_runtime/lib"); | 1698         !filename.contains("_internal/js_runtime/lib"); | 
| 1798   } | 1699   } | 
| 1799 | 1700 | 
| 1800   bool get listRecursively => true; | 1701   bool get listRecursively => true; | 
| 1801 } | 1702 } | 
| OLD | NEW | 
|---|