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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 } | 645 } |
646 } | 646 } |
647 | 647 |
648 /** Helper to create a compilation command for a single input file. */ | 648 /** Helper to create a compilation command for a single input file. */ |
649 Command _compileCommand(String inputFile, String outputFile, | 649 Command _compileCommand(String inputFile, String outputFile, |
650 String compiler, String dir, var vmOptions) { | 650 String compiler, String dir, var vmOptions) { |
651 String executable = TestUtils.compilerPath(configuration); | 651 String executable = TestUtils.compilerPath(configuration); |
652 List<String> args = TestUtils.standardOptions(configuration); | 652 List<String> args = TestUtils.standardOptions(configuration); |
653 switch (compiler) { | 653 switch (compiler) { |
654 case 'frog': | 654 case 'frog': |
655 case 'frogsh': | |
656 case 'dart2js': | 655 case 'dart2js': |
657 String libdir = configuration['froglib']; | 656 String libdir = configuration['froglib']; |
658 if (libdir == '') { | 657 if (libdir == '') { |
659 libdir = '$dartDir/frog/lib'; | 658 libdir = '$dartDir/frog/lib'; |
660 } | 659 } |
661 args.addAll(['--libdir=$libdir', | 660 args.addAll(['--libdir=$libdir', |
662 '--compile-only', | 661 '--compile-only', |
663 '--out=$outputFile']); | 662 '--out=$outputFile']); |
664 args.addAll(vmOptions); | 663 args.addAll(vmOptions); |
665 args.add(inputFile); | 664 args.add(inputFile); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); | 737 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); |
739 return TestUtils.mkdirRecursive(tempDirPath, | 738 return TestUtils.mkdirRecursive(tempDirPath, |
740 Strings.join(generatedTestPath, '/')); | 739 Strings.join(generatedTestPath, '/')); |
741 } | 740 } |
742 | 741 |
743 String get scriptType() { | 742 String get scriptType() { |
744 switch (configuration['compiler']) { | 743 switch (configuration['compiler']) { |
745 case 'none': | 744 case 'none': |
746 return 'application/dart'; | 745 return 'application/dart'; |
747 case 'frog': | 746 case 'frog': |
748 case 'frogsh': | |
749 case 'dart2js': | 747 case 'dart2js': |
750 case 'dartc': | 748 case 'dartc': |
751 return 'text/javascript'; | 749 return 'text/javascript'; |
752 default: | 750 default: |
753 Expect.fail('Non-web runtime, so no scriptType for: ' + | 751 Expect.fail('Non-web runtime, so no scriptType for: ' + |
754 '${configuration["compiler"]}'); | 752 '${configuration["compiler"]}'); |
755 return null; | 753 return null; |
756 } | 754 } |
757 } | 755 } |
758 | 756 |
759 bool get hasRuntime() { | 757 bool get hasRuntime() { |
760 switch(configuration['runtime']) { | 758 switch(configuration['runtime']) { |
761 case null: | 759 case null: |
762 Expect.fail("configuration['runtime'] is not set"); | 760 Expect.fail("configuration['runtime'] is not set"); |
763 case 'none': | 761 case 'none': |
764 return false; | 762 return false; |
765 default: | 763 default: |
766 return true; | 764 return true; |
767 } | 765 } |
768 } | 766 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 | 816 |
819 List<List<String>> argumentListsFromFile(String filename, | 817 List<List<String>> argumentListsFromFile(String filename, |
820 Map optionsFromFile) { | 818 Map optionsFromFile) { |
821 List args = TestUtils.standardOptions(configuration); | 819 List args = TestUtils.standardOptions(configuration); |
822 args.addAll(additionalOptions(filename)); | 820 args.addAll(additionalOptions(filename)); |
823 if (configuration['compiler'] == 'dartc') { | 821 if (configuration['compiler'] == 'dartc') { |
824 args.add('--error_format'); | 822 args.add('--error_format'); |
825 args.add('machine'); | 823 args.add('machine'); |
826 } | 824 } |
827 if ((configuration['compiler'] == 'frog' | 825 if ((configuration['compiler'] == 'frog' |
828 || configuration['compiler'] == 'frogsh' | |
829 || configuration['compiler'] == 'dart2js') | 826 || configuration['compiler'] == 'dart2js') |
830 && (configuration['runtime'] == 'none')) { | 827 && (configuration['runtime'] == 'none')) { |
831 args.add('--compile-only'); | 828 args.add('--compile-only'); |
832 } | 829 } |
833 | 830 |
834 bool isMultitest = optionsFromFile["isMultitest"]; | 831 bool isMultitest = optionsFromFile["isMultitest"]; |
835 List<String> dartOptions = optionsFromFile["dartOptions"]; | 832 List<String> dartOptions = optionsFromFile["dartOptions"]; |
836 List<List<String>> vmOptionsList = optionsFromFile["vmOptions"]; | 833 List<List<String>> vmOptionsList = optionsFromFile["vmOptions"]; |
837 Expect.isTrue(!isMultitest || dartOptions == null); | 834 Expect.isTrue(!isMultitest || dartOptions == null); |
838 if (dartOptions == null) { | 835 if (dartOptions == null) { |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 static String executableName(Map configuration) { | 1231 static String executableName(Map configuration) { |
1235 String suffix = executableSuffix(configuration['compiler']); | 1232 String suffix = executableSuffix(configuration['compiler']); |
1236 switch (configuration['compiler']) { | 1233 switch (configuration['compiler']) { |
1237 case 'none': | 1234 case 'none': |
1238 return 'dart$suffix'; | 1235 return 'dart$suffix'; |
1239 case 'dartc': | 1236 case 'dartc': |
1240 return 'compiler/bin/dartc$suffix'; | 1237 return 'compiler/bin/dartc$suffix'; |
1241 case 'frog': | 1238 case 'frog': |
1242 case 'dart2js': | 1239 case 'dart2js': |
1243 return 'frog/bin/frog$suffix'; | 1240 return 'frog/bin/frog$suffix'; |
1244 case 'frogsh': | |
1245 return 'frog/bin/frogsh$suffix'; | |
1246 default: | 1241 default: |
1247 throw "Unknown executable for: ${configuration['compiler']}"; | 1242 throw "Unknown executable for: ${configuration['compiler']}"; |
1248 } | 1243 } |
1249 } | 1244 } |
1250 | 1245 |
1251 static String compilerName(Map configuration) { | 1246 static String compilerName(Map configuration) { |
1252 String suffix = executableSuffix(configuration['compiler']); | 1247 String suffix = executableSuffix(configuration['compiler']); |
1253 switch (configuration['compiler']) { | 1248 switch (configuration['compiler']) { |
1254 case 'dartc': | 1249 case 'dartc': |
1255 return 'compiler/bin/dartc$suffix'; | 1250 return 'compiler/bin/dartc$suffix'; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 * $noCrash tests are expected to be flaky but not crash | 1375 * $noCrash tests are expected to be flaky but not crash |
1381 * $pass tests are expected to pass | 1376 * $pass tests are expected to pass |
1382 * $failOk tests are expected to fail that we won't fix | 1377 * $failOk tests are expected to fail that we won't fix |
1383 * $fail tests are expected to fail that we should fix | 1378 * $fail tests are expected to fail that we should fix |
1384 * $crash tests are expected to crash that we should fix | 1379 * $crash tests are expected to crash that we should fix |
1385 * $timeout tests are allowed to timeout | 1380 * $timeout tests are allowed to timeout |
1386 """; | 1381 """; |
1387 print(report); | 1382 print(report); |
1388 } | 1383 } |
1389 } | 1384 } |
OLD | NEW |