Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 26229005: Fixed (currently harmless) bug in test_runner and implemented separate dart2js compilation cache (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 } 769 }
770 } 770 }
771 return negative; 771 return negative;
772 } 772 }
773 773
774 List<Command> makeCommands(TestInformation info, var vmOptions, var args) { 774 List<Command> makeCommands(TestInformation info, var vmOptions, var args) {
775 var compiler = configuration['compiler']; 775 var compiler = configuration['compiler'];
776 switch (compiler) { 776 switch (compiler) {
777 case 'dart2js': 777 case 'dart2js':
778 args = new List.from(args); 778 args = new List.from(args);
779 String tempDir = createOutputDirectory(info.filePath, ''); 779 String tempDir = createCompilationOutputDirectory(info.filePath);
780 args.add('--out=$tempDir/out.js'); 780 args.add('--out=$tempDir/out.js');
781 781
782 var command = CommandBuilder.instance.getCompilationCommand( 782 var command = CommandBuilder.instance.getCompilationCommand(
783 compiler, "$tempDir/out.js", !useSdk, 783 compiler, "$tempDir/out.js", !useSdk,
784 dart2JsBootstrapDependencies, compilerPath, args, configurationDir); 784 dart2JsBootstrapDependencies, compilerPath, args, configurationDir);
785 785
786 List<Command> commands = <Command>[command]; 786 List<Command> commands = <Command>[command];
787 if (info.hasCompileError) { 787 if (info.hasCompileError) {
788 // Do not attempt to run the compiled result. A compilation 788 // Do not attempt to run the compiled result. A compilation
789 // error should be reported by the compilation command. 789 // error should be reported by the compilation command.
790 } else if (configuration['runtime'] == 'd8') { 790 } else if (configuration['runtime'] == 'd8') {
791 commands.add(CommandBuilder.instance.getJSCommandlineCommand( 791 commands.add(CommandBuilder.instance.getJSCommandlineCommand(
792 "d8", d8FileName, ['$tempDir/out.js'], configurationDir)); 792 "d8", d8FileName, ['$tempDir/out.js'], configurationDir));
793 } else if (configuration['runtime'] == 'jsshell') { 793 } else if (configuration['runtime'] == 'jsshell') {
794 commands.add(CommandBuilder.instance.getJSCommandlineCommand( 794 commands.add(CommandBuilder.instance.getJSCommandlineCommand(
795 "jsshell", jsShellFileName, ['$tempDir/out.js'], configurationDir)); 795 "jsshell", jsShellFileName, ['$tempDir/out.js'], configurationDir));
796 } 796 }
797 return commands; 797 return commands;
798
799 case 'dart2dart': 798 case 'dart2dart':
800 args = new List.from(args); 799 args = new List.from(args);
801 args.add('--output-type=dart'); 800 args.add('--output-type=dart');
802 String tempDir = createOutputDirectory(info.filePath, ''); 801 String tempDir = createCompilationOutputDirectory(info.filePath);
803 args.add('--out=$tempDir/out.dart'); 802 args.add('--out=$tempDir/out.dart');
804 803
805 List<Command> commands = 804 List<Command> commands =
806 <Command>[CommandBuilder.instance.getCompilationCommand( 805 <Command>[CommandBuilder.instance.getCompilationCommand(
807 compiler, "$tempDir/out.dart", !useSdk, 806 compiler, "$tempDir/out.dart", !useSdk,
808 dart2JsBootstrapDependencies, compilerPath, args, 807 dart2JsBootstrapDependencies, compilerPath, args,
809 configurationDir)]; 808 configurationDir)];
810 if (info.hasCompileError) { 809 if (info.hasCompileError) {
811 // Do not attempt to run the compiled result. A compilation 810 // Do not attempt to run the compiled result. A compilation
812 // error should be reported by the compilation command. 811 // error should be reported by the compilation command.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 for (var vmOptions in getVmOptions(optionsFromFile)) { 953 for (var vmOptions in getVmOptions(optionsFromFile)) {
955 // Create a unique temporary directory for each set of vmOptions. 954 // Create a unique temporary directory for each set of vmOptions.
956 // TODO(dart:429): Replace separate replaceAlls with a RegExp when 955 // TODO(dart:429): Replace separate replaceAlls with a RegExp when
957 // replaceAll(RegExp, String) is implemented. 956 // replaceAll(RegExp, String) is implemented.
958 String optionsName = ''; 957 String optionsName = '';
959 if (getVmOptions(optionsFromFile).length > 1) { 958 if (getVmOptions(optionsFromFile).length > 1) {
960 optionsName = vmOptions.join('-').replaceAll('-','') 959 optionsName = vmOptions.join('-').replaceAll('-','')
961 .replaceAll('=','') 960 .replaceAll('=','')
962 .replaceAll('/',''); 961 .replaceAll('/','');
963 } 962 }
963 final String compilationTempDir =
964 createCompilationOutputDirectory(info.filePath);
964 final String tempDir = createOutputDirectory(info.filePath, optionsName); 965 final String tempDir = createOutputDirectory(info.filePath, optionsName);
965 966
966 String dartWrapperFilename = '$tempDir/test.dart'; 967 String dartWrapperFilename = '$tempDir/test.dart';
967 String compiledDartWrapperFilename = '$tempDir/test.js'; 968 String compiledDartWrapperFilename = '$compilationTempDir/test.js';
968 String precompiledDartWrapperFilename = '$tempDir/test.precompiled.js'; 969 String precompiledDartWrapperFilename =
970 '$compilationTempDir/test.precompiled.js';
969 971
970 String content = null; 972 String content = null;
971 Path dir = filePath.directoryPath; 973 Path dir = filePath.directoryPath;
972 String nameNoExt = filePath.filenameWithoutExtension; 974 String nameNoExt = filePath.filenameWithoutExtension;
973 975
974 Path pngPath = dir.append('$nameNoExt.png'); 976 Path pngPath = dir.append('$nameNoExt.png');
975 Path txtPath = dir.append('$nameNoExt.txt'); 977 Path txtPath = dir.append('$nameNoExt.txt');
976 String customHtmlPath = dir.append('$nameNoExt.html').toNativePath(); 978 String customHtmlPath = dir.append('$nameNoExt.html').toNativePath();
977 File customHtml = new File(customHtmlPath); 979 File customHtml = new File(customHtmlPath);
978 980
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 * These scripts and pages are written to a generated_test directory 1203 * These scripts and pages are written to a generated_test directory
1202 * inside the build directory of the checkout. 1204 * inside the build directory of the checkout.
1203 * 1205 *
1204 * Those tests which are already HTML web applications (web tests), with 1206 * Those tests which are already HTML web applications (web tests), with
1205 * resources including CSS files and HTML files, need to be compiled into 1207 * resources including CSS files and HTML files, need to be compiled into
1206 * a work directory where the relative URLS to the resources work. 1208 * a work directory where the relative URLS to the resources work.
1207 * We use a subdirectory of the build directory that is the same number 1209 * We use a subdirectory of the build directory that is the same number
1208 * of levels down in the checkout as the original path of the web test. 1210 * of levels down in the checkout as the original path of the web test.
1209 */ 1211 */
1210 String createOutputDirectory(Path testPath, String optionsName) { 1212 String createOutputDirectory(Path testPath, String optionsName) {
1213 // Create
1214 // '[build dir]/generated_tests/$compiler-$runtime-$flags/$testUniqueName'.
1215 var checked = configuration['checked'] ? '-checked' : '';
1216 var minified = configuration['minified'] ? '-minified' : '';
1217 var csp = configuration['csp'] ? '-csp' : '';
1218 var dirName = "${configuration['compiler']}-${configuration['runtime']}"
1219 "$checked$minified$csp";
1220 return createGeneratedTestDirectoryHelper(
1221 "tests", dirName, testPath, optionsName);
1222 }
1223
1224 String createCompilationOutputDirectory(Path testPath) {
1225 // Create
1226 // '[build dir]/generated_compilations/$compiler-$flags/$testUniqueName'.
1227 var checked = configuration['checked'] ? '-checked' : '';
1228 var minified = configuration['minified'] ? '-minified' : '';
1229 var dirName = "${configuration['compiler']}$checked$minified";
1230 return createGeneratedTestDirectoryHelper(
1231 "compilations", dirName, testPath, "");
1232 }
1233
1234 String createGeneratedTestDirectoryHelper(
1235 String name, String dirname, Path testPath, String optionsName) {
1211 Path relative = testPath.relativeTo(TestUtils.dartDir()); 1236 Path relative = testPath.relativeTo(TestUtils.dartDir());
1212 relative = relative.directoryPath.append(relative.filenameWithoutExtension); 1237 relative = relative.directoryPath.append(relative.filenameWithoutExtension);
1213 String testUniqueName = relative.toString().replaceAll('/', '_'); 1238 String testUniqueName = relative.toString().replaceAll('/', '_');
1214 if (!optionsName.isEmpty) { 1239 if (!optionsName.isEmpty) {
1215 testUniqueName = '$testUniqueName-$optionsName'; 1240 testUniqueName = '$testUniqueName-$optionsName';
1216 } 1241 }
1217 1242
1218 // Create '[build dir]/generated_tests/$compiler-$runtime/$testUniqueName',
1219 // including any intermediate directories that don't exist.
1220 // If the tests are run in checked or minified mode we add that to the
1221 // '$compile-$runtime' directory name.
1222 var checked = configuration['checked'] ? '-checked' : '';
1223 var minified = configuration['minified'] ? '-minified' : '';
1224 var csp = configuration['csp'] ? '-csp' : '';
1225 var dirName = "${configuration['compiler']}-${configuration['runtime']}"
1226 "$checked$minified$csp";
1227 Path generatedTestPath = new Path(buildDir) 1243 Path generatedTestPath = new Path(buildDir)
1228 .append('generated_tests') 1244 .append('generated_$name')
1229 .append(dirName) 1245 .append(dirname)
1230 .append(testUniqueName); 1246 .append(testUniqueName);
1231 1247
1232 TestUtils.mkdirRecursive(new Path('.'), generatedTestPath); 1248 TestUtils.mkdirRecursive(new Path('.'), generatedTestPath);
1233 return new File(generatedTestPath.toNativePath()).fullPathSync() 1249 return new File(generatedTestPath.toNativePath()).fullPathSync()
1234 .replaceAll('\\', '/'); 1250 .replaceAll('\\', '/');
1235 } 1251 }
1236 1252
1237 String get scriptType { 1253 String get scriptType {
1238 switch (configuration['compiler']) { 1254 switch (configuration['compiler']) {
1239 case 'none': 1255 case 'none':
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 * $pass tests are expected to pass 2039 * $pass tests are expected to pass
2024 * $failOk tests are expected to fail that we won't fix 2040 * $failOk tests are expected to fail that we won't fix
2025 * $fail tests are expected to fail that we should fix 2041 * $fail tests are expected to fail that we should fix
2026 * $crash tests are expected to crash that we should fix 2042 * $crash tests are expected to crash that we should fix
2027 * $timeout tests are allowed to timeout 2043 * $timeout tests are allowed to timeout
2028 * $compileErrorSkip tests are skipped on browsers due to compile-time error 2044 * $compileErrorSkip tests are skipped on browsers due to compile-time error
2029 """; 2045 """;
2030 print(report); 2046 print(report);
2031 } 2047 }
2032 } 2048 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698