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

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

Issue 11586012: Call DumpRenderTree directly from test.dart instead of using the drt-trampoline.py indirection (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 * executed: a compilation step and an execution step, both with the 787 * executed: a compilation step and an execution step, both with the
788 * appropriate executable and arguments. The [expectations] object can be 788 * appropriate executable and arguments. The [expectations] object can be
789 * either a Set<String> if the test is a regular test, or a Map<String 789 * either a Set<String> if the test is a regular test, or a Map<String
790 * subTestName, Set<String>> if we are running a browser multi-test (one 790 * subTestName, Set<String>> if we are running a browser multi-test (one
791 * compilation and many browser runs). 791 * compilation and many browser runs).
792 */ 792 */
793 void enqueueBrowserTest(TestInformation info, 793 void enqueueBrowserTest(TestInformation info,
794 String testName, 794 String testName,
795 Object expectations, 795 Object expectations,
796 bool isWrappingRequired) { 796 bool isWrappingRequired) {
797 // TODO(kustermann/ricow): This method should be refactored.
797 Map optionsFromFile = info.optionsFromFile; 798 Map optionsFromFile = info.optionsFromFile;
798 Path filePath = info.filePath; 799 Path filePath = info.filePath;
799 String filename = filePath.toString(); 800 String filename = filePath.toString();
800 bool isWebTest = optionsFromFile['containsDomImport']; 801 bool isWebTest = optionsFromFile['containsDomImport'];
801 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; 802 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition'];
802 if (isWrappingRequired 803 if (isWrappingRequired
803 && !isLibraryDefinition && optionsFromFile['containsSourceOrImport']) { 804 && !isLibraryDefinition && optionsFromFile['containsSourceOrImport']) {
804 print('Warning for $filename: Browser tests require #library ' 805 print('Warning for $filename: Browser tests require #library '
805 'in any file that uses #import, #source, or #resource'); 806 'in any file that uses #import, #source, or #resource');
806 } 807 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 compiler, tempDir, vmOptions, optionsFromFile)); 913 compiler, tempDir, vmOptions, optionsFromFile));
913 } 914 }
914 } 915 }
915 916
916 // Variables for browser multi-tests. 917 // Variables for browser multi-tests.
917 List<String> subtestNames = info.optionsFromFile['subtestNames']; 918 List<String> subtestNames = info.optionsFromFile['subtestNames'];
918 TestCase multitestParentTest; 919 TestCase multitestParentTest;
919 int subtestIndex = 0; 920 int subtestIndex = 0;
920 // Construct the command that executes the browser test 921 // Construct the command that executes the browser test
921 do { 922 do {
923 List<Command> commandSet = new List<Command>.from(commands);
924 if (subtestIndex != 0) {
925 // NOTE: The first time we enter this loop, all the compilation
926 // commands will be executed. On subsequent loop iterations, we
927 // don't need to do any compilations. Thus we set "commandSet = []".
928 commandSet = [];
929 }
930
922 List<String> args = <String>[]; 931 List<String> args = <String>[];
923 String fullHtmlPath = htmlPath.startsWith('http:') ? htmlPath : 932 String fullHtmlPath = htmlPath.startsWith('http:') ? htmlPath :
924 (htmlPath.startsWith('/') ? 933 (htmlPath.startsWith('/') ?
925 'file://$htmlPath' : 934 'file://$htmlPath' :
926 'file:///$htmlPath'); 935 'file:///$htmlPath');
927 if (info.optionsFromFile['isMultiHtmlTest'] 936 if (info.optionsFromFile['isMultiHtmlTest']
928 && subtestNames.length > 0) { 937 && subtestNames.length > 0) {
929 fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}'; 938 fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}';
930 } 939 }
940
931 if (TestUtils.usesWebDriver(runtime)) { 941 if (TestUtils.usesWebDriver(runtime)) {
932 args = [ 942 args = [
933 dartDir.append('tools/testing/run_selenium.py').toNativePath(), 943 dartDir.append('tools/testing/run_selenium.py').toNativePath(),
934 '--browser=$runtime', 944 '--browser=$runtime',
935 '--timeout=${configuration["timeout"] - 2}', 945 '--timeout=${configuration["timeout"] - 2}',
936 '--out="$fullHtmlPath"']; 946 '--out="$fullHtmlPath"'];
937 if (runtime == 'dartium') { 947 if (runtime == 'dartium') {
938 args.add('--executable=$dartiumFilename'); 948 args.add('--executable=$dartiumFilename');
939 } 949 }
950 if (subtestIndex != 0) {
951 args.add('--force-refresh');
952 }
953 commandSet.add(new Command('python', args));
940 } else { 954 } else {
941 args = [ 955 Expect.isTrue(runtime == "drt");
942 dartDir.append('tools/testing/drt-trampoline.py').toNativePath(), 956
943 dumpRenderTreeFilename, 957 var dartFlags = [];
944 '--no-timeout' 958 var dumpRenderTreeOptions = [];
945 ]; 959 var packageRootUri;
946 if (compiler == 'none') { 960
947 String packageRoot = 961 dumpRenderTreeOptions.add('--no-timeout');
948 packageRootArgument(optionsFromFile['packageRoot']); 962
949 if (packageRoot != null) { 963 if (compiler == 'none' || compiler == 'dart2dart') {
950 args.add(packageRoot); 964 dartFlags.add('--ignore-unrecognized-flags');
951 }
952 }
953 if (runtime == 'drt' &&
954 (compiler == 'none' || compiler == 'dart2dart')) {
955 var dartFlags = ['--ignore-unrecognized-flags'];
956 if (configuration["checked"]) { 965 if (configuration["checked"]) {
957 dartFlags.add('--enable_asserts'); 966 dartFlags.add('--enable_asserts');
958 dartFlags.add("--enable_type_checks"); 967 dartFlags.add("--enable_type_checks");
959 } 968 }
960 dartFlags.addAll(vmOptions); 969 dartFlags.addAll(vmOptions);
961 args.add('--dart-flags=${Strings.join(dartFlags, " ")}');
962 } 970 }
963 args.add(fullHtmlPath); 971 if (compiler == 'none') {
972 var packageRoot = packageRoot(optionsFromFile['packageRoot']);
973 if (packageRoot != null) {
974 var absolutePath = TestUtils.absolutePath(new Path(packageRoot));
975 packageRootUri = new Uri.fromComponents(
976 scheme: 'file',
977 path: absolutePath.toString());
978 }
979 }
980
964 if (expectedOutput != null) { 981 if (expectedOutput != null) {
965 args.add('--out-expectation=${expectedOutput.toNativePath()}'); 982 if (expectedOutput.toNativePath().endsWith('.png')) {
983 // pixel tests are specified by running DRT "foo.html'-p"
984 dumpRenderTreeOptions.add('--notree');
985 fullHtmlPath = "${fullHtmlPath}'-p";
986 }
966 } 987 }
988 commandSet.add(new DumpRenderTreeCommand(dumpRenderTreeFilename,
989 fullHtmlPath,
990 dumpRenderTreeOptions,
991 dartFlags,
992 packageRootUri,
993 expectedOutput));
967 } 994 }
968 List<Command> commandSet = new List<Command>.from(commands);
969 if (subtestIndex != 0) {
970 commandSet = [];
971 if(TestUtils.usesWebDriver(runtime)) args.add('--force-refresh');
972 }
973 commandSet.add(new Command('python', args));
974 995
975 // Create BrowserTestCase and queue it. 996 // Create BrowserTestCase and queue it.
976 String testDisplayName = '$suiteName/$testName'; 997 String testDisplayName = '$suiteName/$testName';
977 var testCase; 998 var testCase;
978 if (info.optionsFromFile['isMultiHtmlTest']) { 999 if (info.optionsFromFile['isMultiHtmlTest']) {
979 testDisplayName = '$testDisplayName/${subtestNames[subtestIndex]}'; 1000 testDisplayName = '$testDisplayName/${subtestNames[subtestIndex]}';
980 testCase = new BrowserTestCase(testDisplayName, 1001 testCase = new BrowserTestCase(testDisplayName,
981 commandSet, configuration, completeHandler, 1002 commandSet, configuration, completeHandler,
982 expectations['$testName/${subtestNames[subtestIndex]}'], 1003 expectations['$testName/${subtestNames[subtestIndex]}'],
983 info, info.hasCompileError || info.hasRuntimeError, 1004 info, info.hasCompileError || info.hasRuntimeError,
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 executable_name = '../$executable_name'; 1178 executable_name = '../$executable_name';
1158 Expect.isTrue(new File(executable_name).existsSync()); 1179 Expect.isTrue(new File(executable_name).existsSync());
1159 dartOptions[0] = executable_name; 1180 dartOptions[0] = executable_name;
1160 } 1181 }
1161 args.addAll(dartOptions); 1182 args.addAll(dartOptions);
1162 } 1183 }
1163 1184
1164 return args; 1185 return args;
1165 } 1186 }
1166 1187
1167 String packageRootArgument(String packageRootFromFile) { 1188 String packageRoot(String packageRootFromFile) {
1168 if (packageRootFromFile == "none") return null; 1189 if (packageRootFromFile == "none") {
1190 return null;
1191 }
1169 String packageRoot = packageRootFromFile; 1192 String packageRoot = packageRootFromFile;
1170 if (packageRootFromFile == null) { 1193 if (packageRootFromFile == null) {
1171 packageRoot = "$buildDir/packages/"; 1194 packageRoot = "$buildDir/packages/";
1172 } 1195 }
1196 return packageRoot;
1197 }
1198
1199 String packageRootArgument(String packageRootFromFile) {
1200 var packageRoot = packageRoot(packageRootFromFile);
1201 if (packageRoot == null) {
1202 return null;
1203 }
1173 return "--package-root=$packageRoot"; 1204 return "--package-root=$packageRoot";
1174 } 1205 }
1175 1206
1176 /** 1207 /**
1177 * Special options for individual tests are currently specified in various 1208 * Special options for individual tests are currently specified in various
1178 * ways: with comments directly in test files, by using certain imports, or by 1209 * ways: with comments directly in test files, by using certain imports, or by
1179 * creating additional files in the test directories. 1210 * creating additional files in the test directories.
1180 * 1211 *
1181 * Here is a list of options that are used by 'test.dart' today: 1212 * Here is a list of options that are used by 'test.dart' today:
1182 * - Flags can be passed to the vm or dartium process that runs the test by 1213 * - Flags can be passed to the vm or dartium process that runs the test by
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 * $pass tests are expected to pass 1792 * $pass tests are expected to pass
1762 * $failOk tests are expected to fail that we won't fix 1793 * $failOk tests are expected to fail that we won't fix
1763 * $fail tests are expected to fail that we should fix 1794 * $fail tests are expected to fail that we should fix
1764 * $crash tests are expected to crash that we should fix 1795 * $crash tests are expected to crash that we should fix
1765 * $timeout tests are allowed to timeout 1796 * $timeout tests are allowed to timeout
1766 * $compileErrorSkip tests are skipped on browsers due to compile-time error 1797 * $compileErrorSkip tests are skipped on browsers due to compile-time error
1767 """; 1798 """;
1768 print(report); 1799 print(report);
1769 } 1800 }
1770 } 1801 }
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