| 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 } | 698 } |
| 699 | 699 |
| 700 List<Command> makeCommands(TestInformation info, var vmOptions, var args) { | 700 List<Command> makeCommands(TestInformation info, var vmOptions, var args) { |
| 701 switch (configuration['compiler']) { | 701 switch (configuration['compiler']) { |
| 702 case 'dart2js': | 702 case 'dart2js': |
| 703 args = new List.from(args); | 703 args = new List.from(args); |
| 704 String tempDir = createOutputDirectory(info.filePath, ''); | 704 String tempDir = createOutputDirectory(info.filePath, ''); |
| 705 args.add('--out=$tempDir/out.js'); | 705 args.add('--out=$tempDir/out.js'); |
| 706 | 706 |
| 707 List<Command> commands = | 707 List<Command> commands = |
| 708 <Command>[new Dart2JsCommand("$tempDir/out.js", | 708 <Command>[new CompilationCommand("$tempDir/out.js", |
| 709 !useDart2JsFromSdk, | 709 !useDart2JsFromSdk, |
| 710 dart2JsBootstrapDependencies, | 710 dart2JsBootstrapDependencies, |
| 711 compilerPath, | 711 compilerPath, |
| 712 args)]; | 712 args)]; |
| 713 if (info.hasCompileError) { | 713 if (info.hasCompileError) { |
| 714 // Do not attempt to run the compiled result. A compilation | 714 // Do not attempt to run the compiled result. A compilation |
| 715 // error should be reported by the compilation command. | 715 // error should be reported by the compilation command. |
| 716 } else if (configuration['runtime'] == 'd8') { | 716 } else if (configuration['runtime'] == 'd8') { |
| 717 commands.add(new Command(d8FileName, ['$tempDir/out.js'])); | 717 commands.add(new Command(d8FileName, ['$tempDir/out.js'])); |
| 718 } else if (configuration['runtime'] == 'jsshell') { | 718 } else if (configuration['runtime'] == 'jsshell') { |
| 719 commands.add(new Command(jsShellFileName, ['$tempDir/out.js'])); | 719 commands.add(new Command(jsShellFileName, ['$tempDir/out.js'])); |
| 720 } | 720 } |
| 721 return commands; | 721 return commands; |
| 722 | 722 |
| 723 case 'dart2dart': | 723 case 'dart2dart': |
| 724 var compilerArguments = new List.from(args); | 724 args = new List.from(args); |
| 725 compilerArguments.add('--output-type=dart'); | 725 args.add('--output-type=dart'); |
| 726 String tempDir = createOutputDirectory(info.filePath, ''); | 726 String tempDir = createOutputDirectory(info.filePath, ''); |
| 727 compilerArguments.add('--out=$tempDir/out.dart'); | 727 args.add('--out=$tempDir/out.dart'); |
| 728 |
| 728 List<Command> commands = | 729 List<Command> commands = |
| 729 <Command>[new Command(compilerPath, compilerArguments)]; | 730 <Command>[new CompilationCommand("$tempDir/out.dart", |
| 731 !useDart2JsFromSdk, |
| 732 dart2JsBootstrapDependencies, |
| 733 compilerPath, |
| 734 args)]; |
| 730 if (info.hasCompileError) { | 735 if (info.hasCompileError) { |
| 731 // Do not attempt to run the compiled result. A compilation | 736 // Do not attempt to run the compiled result. A compilation |
| 732 // error should be reported by the compilation command. | 737 // error should be reported by the compilation command. |
| 733 } else if (configuration['runtime'] == 'vm') { | 738 } else if (configuration['runtime'] == 'vm') { |
| 734 // TODO(antonm): support checked. | 739 // TODO(antonm): support checked. |
| 735 var vmArguments = new List.from(vmOptions); | 740 var vmArguments = new List.from(vmOptions); |
| 736 vmArguments.addAll([ | 741 vmArguments.addAll([ |
| 737 '--ignore-unrecognized-flags', '$tempDir/out.dart']); | 742 '--ignore-unrecognized-flags', '$tempDir/out.dart']); |
| 738 commands.add(new Command(vmFileName, vmArguments)); | 743 commands.add(new Command(vmFileName, vmArguments)); |
| 739 } else { | 744 } else { |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 args.add(inputFile); | 1016 args.add(inputFile); |
| 1012 break; | 1017 break; |
| 1013 default: | 1018 default: |
| 1014 Expect.fail('unimplemented compiler $compiler'); | 1019 Expect.fail('unimplemented compiler $compiler'); |
| 1015 } | 1020 } |
| 1016 if (executable.endsWith('.dart')) { | 1021 if (executable.endsWith('.dart')) { |
| 1017 // Run the compiler script via the Dart VM. | 1022 // Run the compiler script via the Dart VM. |
| 1018 args.insertRange(0, 1, executable); | 1023 args.insertRange(0, 1, executable); |
| 1019 executable = dartShellFileName; | 1024 executable = dartShellFileName; |
| 1020 } | 1025 } |
| 1021 if (configuration['compiler'] == 'dart2js') { | 1026 if (['dart2js', 'dart2dart'].contains(configuration['compiler'])) { |
| 1022 return new Dart2JsCommand(outputFile, | 1027 return new CompilationCommand(outputFile, |
| 1023 !useDart2JsFromSdk, | 1028 !useDart2JsFromSdk, |
| 1024 dart2JsBootstrapDependencies, | 1029 dart2JsBootstrapDependencies, |
| 1025 compilerPath, | 1030 compilerPath, |
| 1026 args); | 1031 args); |
| 1027 } | 1032 } |
| 1028 return new Command(executable, args); | 1033 return new Command(executable, args); |
| 1029 } | 1034 } |
| 1030 | 1035 |
| 1031 /** | 1036 /** |
| 1032 * Create a directory for the generated test. If a Dart language test | 1037 * Create a directory for the generated test. If a Dart language test |
| 1033 * needs to be run in a browser, the Dart test needs to be embedded in | 1038 * needs to be run in a browser, the Dart test needs to be embedded in |
| 1034 * an HTML page, with a testing framework based on scripting and DOM events. | 1039 * an HTML page, with a testing framework based on scripting and DOM events. |
| 1035 * These scripts and pages are written to a generated_test directory | 1040 * These scripts and pages are written to a generated_test directory |
| 1036 * inside the build directory of the checkout. | 1041 * inside the build directory of the checkout. |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 * $pass tests are expected to pass | 1761 * $pass tests are expected to pass |
| 1757 * $failOk tests are expected to fail that we won't fix | 1762 * $failOk tests are expected to fail that we won't fix |
| 1758 * $fail tests are expected to fail that we should fix | 1763 * $fail tests are expected to fail that we should fix |
| 1759 * $crash tests are expected to crash that we should fix | 1764 * $crash tests are expected to crash that we should fix |
| 1760 * $timeout tests are allowed to timeout | 1765 * $timeout tests are allowed to timeout |
| 1761 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1766 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 1762 """; | 1767 """; |
| 1763 print(report); | 1768 print(report); |
| 1764 } | 1769 } |
| 1765 } | 1770 } |
| OLD | NEW |