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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 String precompiledDartWrapperFilename = '$tempDir/test.precompiled.js'; | 968 String precompiledDartWrapperFilename = '$tempDir/test.precompiled.js'; |
969 | 969 |
970 String content = null; | 970 String content = null; |
971 Path dir = filePath.directoryPath; | 971 Path dir = filePath.directoryPath; |
972 String nameNoExt = filePath.filenameWithoutExtension; | 972 String nameNoExt = filePath.filenameWithoutExtension; |
973 | 973 |
974 Path pngPath = dir.append('$nameNoExt.png'); | 974 Path pngPath = dir.append('$nameNoExt.png'); |
975 Path txtPath = dir.append('$nameNoExt.txt'); | 975 Path txtPath = dir.append('$nameNoExt.txt'); |
976 String customHtmlPath = dir.append('$nameNoExt.html').toNativePath(); | 976 String customHtmlPath = dir.append('$nameNoExt.html').toNativePath(); |
977 File customHtml = new File(customHtmlPath); | 977 File customHtml = new File(customHtmlPath); |
978 Path expectedOutput = null; | |
979 | 978 |
980 // Construct the command(s) that compile all the inputs needed by the | 979 // Construct the command(s) that compile all the inputs needed by the |
981 // browser test. For running Dart in DRT, this will be noop commands. | 980 // browser test. For running Dart in DRT, this will be noop commands. |
982 List<Command> commands = []; | 981 List<Command> commands = []; |
983 | 982 |
984 // Use existing HTML document if available. | 983 // Use existing HTML document if available. |
985 String htmlPath; | 984 String htmlPath; |
986 if (customHtml.existsSync()) { | 985 if (customHtml.existsSync()) { |
987 // If necessary, run the Polymer deploy steps. | 986 // If necessary, run the Polymer deploy steps. |
988 // TODO(jmesserly): this should be generalized for any tests that | 987 // TODO(jmesserly): this should be generalized for any tests that |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 | 1034 |
1036 String scriptPath = dartWrapperFilename; | 1035 String scriptPath = dartWrapperFilename; |
1037 if (compiler != 'none') { | 1036 if (compiler != 'none') { |
1038 scriptPath = compiledDartWrapperFilename; | 1037 scriptPath = compiledDartWrapperFilename; |
1039 if (configuration['csp']) { | 1038 if (configuration['csp']) { |
1040 scriptPath = precompiledDartWrapperFilename; | 1039 scriptPath = precompiledDartWrapperFilename; |
1041 } | 1040 } |
1042 } | 1041 } |
1043 scriptPath = _createUrlPathFromFile(new Path(scriptPath)); | 1042 scriptPath = _createUrlPathFromFile(new Path(scriptPath)); |
1044 | 1043 |
1045 if (new File(pngPath.toNativePath()).existsSync()) { | 1044 content = |
1046 expectedOutput = pngPath; | 1045 getHtmlContents(filename, scriptType, new Path("$scriptPath")); |
1047 content = getHtmlLayoutContents(scriptType, new Path("$scriptPath")); | |
1048 } else if (new File(txtPath.toNativePath()).existsSync()) { | |
1049 expectedOutput = txtPath; | |
1050 content = getHtmlLayoutContents(scriptType, new Path("$scriptPath")); | |
1051 } else { | |
1052 content = getHtmlContents(filename, scriptType, | |
1053 new Path("$scriptPath")); | |
1054 } | |
1055 htmlTest.writeStringSync(content); | 1046 htmlTest.writeStringSync(content); |
1056 htmlTest.closeSync(); | 1047 htmlTest.closeSync(); |
1057 } | 1048 } |
1058 | 1049 |
1059 if (compiler != 'none') { | 1050 if (compiler != 'none') { |
1060 commands.add(_compileCommand( | 1051 commands.add(_compileCommand( |
1061 dartWrapperFilename, compiledDartWrapperFilename, | 1052 dartWrapperFilename, compiledDartWrapperFilename, |
1062 compiler, tempDir, vmOptions, optionsFromFile)); | 1053 compiler, tempDir, vmOptions, optionsFromFile)); |
1063 } | 1054 } |
1064 | 1055 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 | 1124 |
1134 if (compiler == 'none' || compiler == 'dart2dart') { | 1125 if (compiler == 'none' || compiler == 'dart2dart') { |
1135 dartFlags.add('--ignore-unrecognized-flags'); | 1126 dartFlags.add('--ignore-unrecognized-flags'); |
1136 if (configuration["checked"]) { | 1127 if (configuration["checked"]) { |
1137 dartFlags.add('--enable_asserts'); | 1128 dartFlags.add('--enable_asserts'); |
1138 dartFlags.add("--enable_type_checks"); | 1129 dartFlags.add("--enable_type_checks"); |
1139 } | 1130 } |
1140 dartFlags.addAll(vmOptions); | 1131 dartFlags.addAll(vmOptions); |
1141 } | 1132 } |
1142 | 1133 |
1143 if (expectedOutput != null) { | |
1144 if (expectedOutput.toNativePath().endsWith('.png')) { | |
1145 // pixel tests are specified by running DRT "foo.html'-p" | |
1146 contentShellOptions.add('--notree'); | |
1147 fullHtmlPath = "${fullHtmlPath}'-p"; | |
1148 } | |
1149 } | |
1150 commandSet.add(CommandBuilder.instance.getContentShellCommand( | 1134 commandSet.add(CommandBuilder.instance.getContentShellCommand( |
1151 contentShellFilename, fullHtmlPath, contentShellOptions, | 1135 contentShellFilename, fullHtmlPath, contentShellOptions, |
1152 dartFlags, expectedOutput, configurationDir)); | 1136 dartFlags, configurationDir)); |
1153 } | 1137 } |
1154 | 1138 |
1155 // Create BrowserTestCase and queue it. | 1139 // Create BrowserTestCase and queue it. |
1156 String testDisplayName = '$suiteName/$testName'; | 1140 String testDisplayName = '$suiteName/$testName'; |
1157 var testCase; | 1141 var testCase; |
1158 if (info.optionsFromFile['isMultiHtmlTest']) { | 1142 if (info.optionsFromFile['isMultiHtmlTest']) { |
1159 testDisplayName = '$testDisplayName/${subtestNames[subtestIndex]}'; | 1143 testDisplayName = '$testDisplayName/${subtestNames[subtestIndex]}'; |
1160 testCase = new BrowserTestCase(testDisplayName, | 1144 testCase = new BrowserTestCase(testDisplayName, |
1161 commandSet, configuration, | 1145 commandSet, configuration, |
1162 expectations['$testName/${subtestNames[subtestIndex]}'], | 1146 expectations['$testName/${subtestNames[subtestIndex]}'], |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 * $pass tests are expected to pass | 2023 * $pass tests are expected to pass |
2040 * $failOk tests are expected to fail that we won't fix | 2024 * $failOk tests are expected to fail that we won't fix |
2041 * $fail tests are expected to fail that we should fix | 2025 * $fail tests are expected to fail that we should fix |
2042 * $crash tests are expected to crash that we should fix | 2026 * $crash tests are expected to crash that we should fix |
2043 * $timeout tests are allowed to timeout | 2027 * $timeout tests are allowed to timeout |
2044 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 2028 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
2045 """; | 2029 """; |
2046 print(report); | 2030 print(report); |
2047 } | 2031 } |
2048 } | 2032 } |
OLD | NEW |