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

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

Issue 25514002: Implement testing support for "--compiler=none --runtime=dartium" (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_options.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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 multitestName: optionsFromFile['isMultitest'] ? info.multitestKey : ""); 705 multitestName: optionsFromFile['isMultitest'] ? info.multitestKey : "");
706 706
707 Set<Expectation> expectations = testExpectations.expectations(testName); 707 Set<Expectation> expectations = testExpectations.expectations(testName);
708 if (configuration['compiler'] != 'none' && info.hasCompileError) { 708 if (configuration['compiler'] != 'none' && info.hasCompileError) {
709 // If a compile-time error is expected, and we're testing a 709 // If a compile-time error is expected, and we're testing a
710 // compiler, we never need to attempt to run the program (in a 710 // compiler, we never need to attempt to run the program (in a
711 // browser or otherwise). 711 // browser or otherwise).
712 enqueueStandardTest(info, testName, expectations); 712 enqueueStandardTest(info, testName, expectations);
713 } else if (TestUtils.isBrowserRuntime(configuration['runtime'])) { 713 } else if (TestUtils.isBrowserRuntime(configuration['runtime'])) {
714 bool isWrappingRequired = configuration['compiler'] != 'dart2js'; 714 bool isWrappingRequired = configuration['compiler'] != 'dart2js';
715
715 if (info.optionsFromFile['isMultiHtmlTest']) { 716 if (info.optionsFromFile['isMultiHtmlTest']) {
716 // A browser multi-test has multiple expectations for one test file. 717 // A browser multi-test has multiple expectations for one test file.
717 // Find all the different sub-test expecations for one entire test file. 718 // Find all the different sub-test expecations for one entire test file.
718 List<String> subtestNames = info.optionsFromFile['subtestNames']; 719 List<String> subtestNames = info.optionsFromFile['subtestNames'];
719 Map<String, Set<Expectation>> multiHtmlTestExpectations = {}; 720 Map<String, Set<Expectation>> multiHtmlTestExpectations = {};
720 for (String name in subtestNames) { 721 for (String name in subtestNames) {
721 String fullTestName = '$testName/$name'; 722 String fullTestName = '$testName/$name';
722 multiHtmlTestExpectations[fullTestName] = 723 multiHtmlTestExpectations[fullTestName] =
723 testExpectations.expectations(fullTestName); 724 testExpectations.expectations(fullTestName);
724 } 725 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 911
911 var local_ip = configuration['local_ip']; 912 var local_ip = configuration['local_ip'];
912 var url= 'http://$local_ip:$serverPort$pathComponent' 913 var url= 'http://$local_ip:$serverPort$pathComponent'
913 '?crossOriginPort=$crossOriginPort'; 914 '?crossOriginPort=$crossOriginPort';
914 if (info.optionsFromFile['isMultiHtmlTest'] && subtestNames.length > 0) { 915 if (info.optionsFromFile['isMultiHtmlTest'] && subtestNames.length > 0) {
915 url= '${url}&group=${subtestNames[subtestIndex]}'; 916 url= '${url}&group=${subtestNames[subtestIndex]}';
916 } 917 }
917 return url; 918 return url;
918 } 919 }
919 920
920 void _createWrapperFile(String dartWrapperFilename, dartLibraryFilename) { 921 void _createWrapperFile(String dartWrapperFilename,
922 Path dartLibraryFilename,
923 {bool useUnittestWrapper: false}) {
921 File file = new File(dartWrapperFilename); 924 File file = new File(dartWrapperFilename);
922 RandomAccessFile dartWrapper = file.openSync(mode: FileMode.WRITE); 925 RandomAccessFile dartWrapper = file.openSync(mode: FileMode.WRITE);
923 926
924 var usePackageImport = dartLibraryFilename.segments().contains("pkg"); 927 var usePackageImport = dartLibraryFilename.segments().contains("pkg");
925 var libraryPathComponent = _createUrlPathFromFile(dartLibraryFilename); 928 var libraryPathComponent = _createUrlPathFromFile(dartLibraryFilename);
926 dartWrapper.writeStringSync(dartTestWrapper(usePackageImport, 929 var generatedSource;
927 libraryPathComponent)); 930 if (useUnittestWrapper) {
931 // FIXME(kustermann): This is broken, we can't do unittest-based wrapping
932 // of tests (e.g. async operations are not wrapped in expectAsync()).
933 generatedSource = dartUnittestWrapper(usePackageImport,
934 libraryPathComponent);
935 } else {
936 generatedSource = dartTestWrapper(libraryPathComponent);
937 }
938
939 dartWrapper.writeStringSync(generatedSource);
928 dartWrapper.closeSync(); 940 dartWrapper.closeSync();
929 } 941 }
930 942
931 /** 943 /**
932 * The [StandardTestSuite] has support for tests that 944 * The [StandardTestSuite] has support for tests that
933 * compile a test from Dart to JavaScript, and then run the resulting 945 * compile a test from Dart to JavaScript, and then run the resulting
934 * JavaScript. This function creates a working directory to hold the 946 * JavaScript. This function creates a working directory to hold the
935 * JavaScript version of the test, and copies the appropriate framework 947 * JavaScript version of the test, and copies the appropriate framework
936 * files to that directory. It creates a [BrowserTestCase], which has 948 * files to that directory. It creates a [BrowserTestCase], which has
937 * two sequential steps to be run by the [ProcessQueue] when the test is 949 * two sequential steps to be run by the [ProcessQueue] when the test is
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 File customHtml = new File(customHtmlPath); 992 File customHtml = new File(customHtmlPath);
981 Path expectedOutput = null; 993 Path expectedOutput = null;
982 994
983 // Construct the command(s) that compile all the inputs needed by the 995 // Construct the command(s) that compile all the inputs needed by the
984 // browser test. For running Dart in DRT, this will be noop commands. 996 // browser test. For running Dart in DRT, this will be noop commands.
985 List<Command> commands = []; 997 List<Command> commands = [];
986 998
987 // Use existing HTML document if available. 999 // Use existing HTML document if available.
988 String htmlPath; 1000 String htmlPath;
989 if (customHtml.existsSync()) { 1001 if (customHtml.existsSync()) {
990
991 // If necessary, run the Polymer deploy steps. 1002 // If necessary, run the Polymer deploy steps.
992 // TODO(jmesserly): this should be generalized for any tests that 1003 // TODO(jmesserly): this should be generalized for any tests that
993 // require Pub deploy, not just polymer. 1004 // require Pub deploy, not just polymer.
994 if (customHtml.readAsStringSync().contains('polymer/boot.js')) { 1005 if (customHtml.readAsStringSync().contains('polymer/boot.js')) {
995 if (compiler != 'none') { 1006 if (compiler != 'none') {
996 commands.add(_polymerDeployCommand( 1007 commands.add(_polymerDeployCommand(
997 customHtmlPath, tempDir, optionsFromFile)); 1008 customHtmlPath, tempDir, optionsFromFile));
998 1009
999 htmlPath = '$tempDir/test/$nameNoExt.html'; 1010 htmlPath = '$tempDir/test/$nameNoExt.html';
1000 dartWrapperFilename = '${htmlPath}_bootstrap.dart'; 1011 dartWrapperFilename = '${htmlPath}_bootstrap.dart';
(...skipping 20 matching lines...) Expand all
1021 } 1032 }
1022 htmlContents = htmlContents.replaceAll('%TEST_SCRIPTS%', 1033 htmlContents = htmlContents.replaceAll('%TEST_SCRIPTS%',
1023 '<script src="$jsFile"></script>'); 1034 '<script src="$jsFile"></script>');
1024 } 1035 }
1025 new File(htmlPath).writeAsStringSync(htmlContents); 1036 new File(htmlPath).writeAsStringSync(htmlContents);
1026 } 1037 }
1027 } else { 1038 } else {
1028 htmlPath = '$tempDir/test.html'; 1039 htmlPath = '$tempDir/test.html';
1029 if (isWrappingRequired && !isWebTest) { 1040 if (isWrappingRequired && !isWebTest) {
1030 // test.dart will import the dart test. 1041 // test.dart will import the dart test.
1031 _createWrapperFile(dartWrapperFilename, filePath); 1042 if (configuration['use_browser_controller'] &&
1043 configuration['runtime'] == 'dartium') {
1044 _createWrapperFile(dartWrapperFilename, filePath);
1045 } else {
1046 _createWrapperFile(
ricow1 2013/10/02 18:17:47 is this basically drt now?
kustermann 2013/10/03 11:06:02 Yes it is -- or rather content_shell. I'll remove
1047 dartWrapperFilename, filePath, useUnittestWrapper: true);
1048 }
1032 } else { 1049 } else {
1033 dartWrapperFilename = filename; 1050 dartWrapperFilename = filename;
1034 } 1051 }
1035 1052
1036 // Create the HTML file for the test. 1053 // Create the HTML file for the test.
1037 RandomAccessFile htmlTest = 1054 RandomAccessFile htmlTest =
1038 new File(htmlPath).openSync(mode: FileMode.WRITE); 1055 new File(htmlPath).openSync(mode: FileMode.WRITE);
1039 1056
1040 String scriptPath = dartWrapperFilename; 1057 String scriptPath = dartWrapperFilename;
1041 if (compiler != 'none') { 1058 if (compiler != 'none') {
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 * $pass tests are expected to pass 2070 * $pass tests are expected to pass
2054 * $failOk tests are expected to fail that we won't fix 2071 * $failOk tests are expected to fail that we won't fix
2055 * $fail tests are expected to fail that we should fix 2072 * $fail tests are expected to fail that we should fix
2056 * $crash tests are expected to crash that we should fix 2073 * $crash tests are expected to crash that we should fix
2057 * $timeout tests are allowed to timeout 2074 * $timeout tests are allowed to timeout
2058 * $compileErrorSkip tests are skipped on browsers due to compile-time error 2075 * $compileErrorSkip tests are skipped on browsers due to compile-time error
2059 """; 2076 """;
2060 print(report); 2077 print(report);
2061 } 2078 }
2062 } 2079 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698