| 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, |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 doTest(testCase); | 692 doTest(testCase); |
| 693 } | 693 } |
| 694 } | 694 } |
| 695 | 695 |
| 696 /** Helper to create a compilation command for a single input file. */ | 696 /** Helper to create a compilation command for a single input file. */ |
| 697 Command _compileCommand(String inputFile, String outputFile, | 697 Command _compileCommand(String inputFile, String outputFile, |
| 698 String compiler, String dir, var vmOptions) { | 698 String compiler, String dir, var vmOptions) { |
| 699 String executable = TestUtils.compilerPath(configuration); | 699 String executable = TestUtils.compilerPath(configuration); |
| 700 List<String> args = TestUtils.standardOptions(configuration); | 700 List<String> args = TestUtils.standardOptions(configuration); |
| 701 switch (compiler) { | 701 switch (compiler) { |
| 702 case 'frog': | |
| 703 String libdir = configuration['froglib']; | |
| 704 if (libdir == '') { | |
| 705 libdir = dartDir.append('frog/lib').toNativePath(); | |
| 706 } | |
| 707 args.addAll(['--libdir=$libdir', | |
| 708 '--compile-only', | |
| 709 '--out=$outputFile']); | |
| 710 args.addAll(vmOptions); | |
| 711 args.add(inputFile); | |
| 712 break; | |
| 713 case 'dart2js': | 702 case 'dart2js': |
| 714 case 'dart2dart': | 703 case 'dart2dart': |
| 715 if (compiler == 'dart2dart') args.add('--out=$outputFile'); | 704 if (compiler == 'dart2dart') args.add('--out=$outputFile'); |
| 716 args.add('--out=$outputFile'); | 705 args.add('--out=$outputFile'); |
| 717 args.add(inputFile); | 706 args.add(inputFile); |
| 718 break; | 707 break; |
| 719 default: | 708 default: |
| 720 Expect.fail('unimplemented compiler $compiler'); | 709 Expect.fail('unimplemented compiler $compiler'); |
| 721 } | 710 } |
| 722 if (executable.endsWith('.dart')) { | 711 if (executable.endsWith('.dart')) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 | 747 |
| 759 TestUtils.mkdirRecursive(new Path('.'), new Path(generatedTestPath)); | 748 TestUtils.mkdirRecursive(new Path('.'), new Path(generatedTestPath)); |
| 760 return new File(generatedTestPath).fullPathSync().replaceAll('\\', '/'); | 749 return new File(generatedTestPath).fullPathSync().replaceAll('\\', '/'); |
| 761 } | 750 } |
| 762 | 751 |
| 763 String get scriptType() { | 752 String get scriptType() { |
| 764 switch (configuration['compiler']) { | 753 switch (configuration['compiler']) { |
| 765 case 'none': | 754 case 'none': |
| 766 case 'dart2dart': | 755 case 'dart2dart': |
| 767 return 'application/dart'; | 756 return 'application/dart'; |
| 768 case 'frog': | |
| 769 case 'dart2js': | 757 case 'dart2js': |
| 770 case 'dartc': | 758 case 'dartc': |
| 771 return 'text/javascript'; | 759 return 'text/javascript'; |
| 772 default: | 760 default: |
| 773 Expect.fail('Non-web runtime, so no scriptType for: ' | 761 Expect.fail('Non-web runtime, so no scriptType for: ' |
| 774 '${configuration["compiler"]}'); | 762 '${configuration["compiler"]}'); |
| 775 return null; | 763 return null; |
| 776 } | 764 } |
| 777 } | 765 } |
| 778 | 766 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 void completeHandler(TestCase testCase) { | 827 void completeHandler(TestCase testCase) { |
| 840 } | 828 } |
| 841 | 829 |
| 842 List<String> commonArgumentsFromFile(Path filePath, Map optionsFromFile) { | 830 List<String> commonArgumentsFromFile(Path filePath, Map optionsFromFile) { |
| 843 List args = TestUtils.standardOptions(configuration); | 831 List args = TestUtils.standardOptions(configuration); |
| 844 args.addAll(additionalOptions(filePath)); | 832 args.addAll(additionalOptions(filePath)); |
| 845 if (configuration['compiler'] == 'dartc') { | 833 if (configuration['compiler'] == 'dartc') { |
| 846 args.add('--error_format'); | 834 args.add('--error_format'); |
| 847 args.add('machine'); | 835 args.add('machine'); |
| 848 } | 836 } |
| 849 if ((configuration['compiler'] == 'frog') | |
| 850 && (configuration['runtime'] == 'none')) { | |
| 851 args.add('--compile-only'); | |
| 852 } | |
| 853 | 837 |
| 854 bool isMultitest = optionsFromFile["isMultitest"]; | 838 bool isMultitest = optionsFromFile["isMultitest"]; |
| 855 List<String> dartOptions = optionsFromFile["dartOptions"]; | 839 List<String> dartOptions = optionsFromFile["dartOptions"]; |
| 856 List<List<String>> vmOptionsList = getVmOptions(optionsFromFile); | 840 List<List<String>> vmOptionsList = getVmOptions(optionsFromFile); |
| 857 Expect.isTrue(!isMultitest || dartOptions == null); | 841 Expect.isTrue(!isMultitest || dartOptions == null); |
| 858 if (dartOptions == null) { | 842 if (dartOptions == null) { |
| 859 args.add(filePath.toNativePath()); | 843 args.add(filePath.toNativePath()); |
| 860 } else { | 844 } else { |
| 861 var executable_name = dartOptions[0]; | 845 var executable_name = dartOptions[0]; |
| 862 // TODO(ager): Get rid of this hack when the runtime checkout goes away. | 846 // TODO(ager): Get rid of this hack when the runtime checkout goes away. |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 var prefix = ''; | 1245 var prefix = ''; |
| 1262 if (configuration['use_sdk']) { | 1246 if (configuration['use_sdk']) { |
| 1263 prefix = 'dart-sdk/bin/'; | 1247 prefix = 'dart-sdk/bin/'; |
| 1264 } | 1248 } |
| 1265 if (configuration['host_checked']) { | 1249 if (configuration['host_checked']) { |
| 1266 // The script dart2js_developer is not in the SDK. | 1250 // The script dart2js_developer is not in the SDK. |
| 1267 return 'dart2js_developer$suffix'; | 1251 return 'dart2js_developer$suffix'; |
| 1268 } else { | 1252 } else { |
| 1269 return '${prefix}dart2js$suffix'; | 1253 return '${prefix}dart2js$suffix'; |
| 1270 } | 1254 } |
| 1271 case 'frog': | |
| 1272 return 'frog/bin/frog$suffix'; | |
| 1273 default: | 1255 default: |
| 1274 throw "Unknown executable for: ${configuration['compiler']}"; | 1256 throw "Unknown executable for: ${configuration['compiler']}"; |
| 1275 } | 1257 } |
| 1276 } | 1258 } |
| 1277 | 1259 |
| 1278 static String compilerName(Map configuration) { | 1260 static String compilerName(Map configuration) { |
| 1279 String suffix = executableSuffix(configuration['compiler']); | 1261 String suffix = executableSuffix(configuration['compiler']); |
| 1280 switch (configuration['compiler']) { | 1262 switch (configuration['compiler']) { |
| 1281 case 'dartc': | 1263 case 'dartc': |
| 1282 case 'dart2js': | 1264 case 'dart2js': |
| 1283 case 'dart2dart': | 1265 case 'dart2dart': |
| 1284 return executableName(configuration); | 1266 return executableName(configuration); |
| 1285 case 'frog': | |
| 1286 return 'frog/bin/frog$suffix'; | |
| 1287 default: | 1267 default: |
| 1288 throw "Unknown compiler for: ${configuration['compiler']}"; | 1268 throw "Unknown compiler for: ${configuration['compiler']}"; |
| 1289 } | 1269 } |
| 1290 } | 1270 } |
| 1291 | 1271 |
| 1292 static String dartShellFileName(Map configuration) { | 1272 static String dartShellFileName(Map configuration) { |
| 1293 var name = configuration['dart']; | 1273 var name = configuration['dart']; |
| 1294 if (name == '') { | 1274 if (name == '') { |
| 1295 name = '${buildDir(configuration)}/${executableName(configuration)}'; | 1275 name = '${buildDir(configuration)}/${executableName(configuration)}'; |
| 1296 } | 1276 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1315 static void ensureExists(String filename, Map configuration) { | 1295 static void ensureExists(String filename, Map configuration) { |
| 1316 if (!configuration['list'] && !(new File(filename).existsSync())) { | 1296 if (!configuration['list'] && !(new File(filename).existsSync())) { |
| 1317 throw "Executable '$filename' does not exist"; | 1297 throw "Executable '$filename' does not exist"; |
| 1318 } | 1298 } |
| 1319 } | 1299 } |
| 1320 | 1300 |
| 1321 static String compilerPath(Map configuration) { | 1301 static String compilerPath(Map configuration) { |
| 1322 if (configuration['compiler'] == 'none') { | 1302 if (configuration['compiler'] == 'none') { |
| 1323 return null; // No separate compiler for dartium tests. | 1303 return null; // No separate compiler for dartium tests. |
| 1324 } | 1304 } |
| 1325 var name = configuration['frog']; | 1305 var name = '${buildDir(configuration)}/${compilerName(configuration)}'; |
| 1326 if (name == '') { | |
| 1327 name = '${buildDir(configuration)}/${compilerName(configuration)}'; | |
| 1328 } | |
| 1329 if (!(new File(name)).existsSync() && !configuration['list']) { | 1306 if (!(new File(name)).existsSync() && !configuration['list']) { |
| 1330 throw "Executable '$name' does not exist"; | 1307 throw "Executable '$name' does not exist"; |
| 1331 } | 1308 } |
| 1332 return name; | 1309 return name; |
| 1333 } | 1310 } |
| 1334 | 1311 |
| 1335 static String outputDir(Map configuration) { | 1312 static String outputDir(Map configuration) { |
| 1336 var result = ''; | 1313 var result = ''; |
| 1337 var system = configuration['system']; | 1314 var system = configuration['system']; |
| 1338 if (system == 'linux') { | 1315 if (system == 'linux') { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 * $noCrash tests are expected to be flaky but not crash | 1407 * $noCrash tests are expected to be flaky but not crash |
| 1431 * $pass tests are expected to pass | 1408 * $pass tests are expected to pass |
| 1432 * $failOk tests are expected to fail that we won't fix | 1409 * $failOk tests are expected to fail that we won't fix |
| 1433 * $fail tests are expected to fail that we should fix | 1410 * $fail tests are expected to fail that we should fix |
| 1434 * $crash tests are expected to crash that we should fix | 1411 * $crash tests are expected to crash that we should fix |
| 1435 * $timeout tests are allowed to timeout | 1412 * $timeout tests are allowed to timeout |
| 1436 """; | 1413 """; |
| 1437 print(report); | 1414 print(report); |
| 1438 } | 1415 } |
| 1439 } | 1416 } |
| OLD | NEW |