Chromium Code Reviews| 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 /** The default pipeline code for running a test file. */ | 5 /** The default pipeline code for running a test file. */ |
| 6 #library('pipeline'); | 6 library pipeline; |
| 7 #import('dart:isolate'); | 7 import 'dart:isolate'; |
| 8 #import('dart:io'); | 8 import 'dart:io'; |
| 9 #source('pipeline_utils.dart'); | 9 part 'pipeline_utils.dart'; |
|
Siggi Cherem (dart-lang)
2012/10/05 00:39:53
not sure if it works yet, but if it does, please a
gram
2012/10/05 21:27:41
If works in vm and Dartium but not dart2js.
| |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * The configuration passed in to the pipeline runner; this essentially | 12 * The configuration passed in to the pipeline runner; this essentially |
| 13 * contains all the command line arguments passded to testrunner plus some | 13 * contains all the command line arguments passded to testrunner plus some |
| 14 * synthesized ones. | 14 * synthesized ones. |
| 15 */ | 15 */ |
| 16 Map config; | 16 Map config; |
| 17 | 17 |
| 18 /** Paths to the various generated temporary files. */ | 18 /** Paths to the various generated temporary files. */ |
| 19 String tempDartFile = null; | 19 String tempDartFile = null; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 createTempName(tmpDir, testFile, '-child.js'); | 71 createTempName(tmpDir, testFile, '-child.js'); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Create the test controller Dart wrapper. | 76 // Create the test controller Dart wrapper. |
| 77 var directives, extras; | 77 var directives, extras; |
| 78 | 78 |
| 79 if (config["layout"]) { | 79 if (config["layout"]) { |
| 80 directives = ''' | 80 directives = ''' |
| 81 #import('dart:uri'); | 81 import 'dart:uri'; |
| 82 #import('dart:io'); | 82 import 'dart:io'; |
| 83 #import('dart:math'); | 83 import 'dart:math'; |
| 84 #source('${config["runnerDir"]}/layout_test_controller.dart'); | 84 part '${config["runnerDir"]}/layout_test_controller.dart'; |
| 85 '''; | 85 '''; |
| 86 extras = ''' | 86 extras = ''' |
| 87 sourceDir = '${config["expectedDirectory"]}'; | 87 sourceDir = '${config["expectedDirectory"]}'; |
| 88 baseUrl = 'file://$tempHtmlFile'; | 88 baseUrl = 'file://$tempHtmlFile'; |
| 89 tprint = (msg) => print('###\$msg'); | 89 tprint = (msg) => print('###\$msg'); |
| 90 notifyDone = (e) => exit(e); | 90 notifyDone = (e) => exit(e); |
| 91 '''; | 91 '''; |
| 92 } else if (config["runtime"] == "vm") { | 92 } else if (config["runtime"] == "vm") { |
| 93 directives = ''' | 93 directives = ''' |
| 94 #import('dart:io'); | 94 import 'dart:io'; |
| 95 #import('dart:isolate'); | 95 import 'dart:isolate'; |
| 96 #import('${config["unittest"]}', prefix:'unittest'); | 96 import '${config["unittest"]}' as unittest; |
| 97 #import('${config["testfile"]}', prefix: 'test'); | 97 import '${config["testfile"]}' as test; |
| 98 #source('${config["runnerDir"]}/standard_test_runner.dart'); | 98 part '${config["runnerDir"]}/standard_test_runner.dart'; |
| 99 '''; | 99 '''; |
| 100 extras = ''' | 100 extras = ''' |
| 101 includeFilters = ${config["include"]}; | 101 includeFilters = ${config["include"]}; |
| 102 excludeFilters = ${config["exclude"]}; | 102 excludeFilters = ${config["exclude"]}; |
| 103 tprint = (msg) => print('###\$msg'); | 103 tprint = (msg) => print('###\$msg'); |
| 104 notifyDone = (e) {}; | 104 notifyDone = (e) {}; |
| 105 '''; | 105 '''; |
| 106 } else { | 106 } else { |
| 107 directives = ''' | 107 directives = ''' |
| 108 #import('dart:html'); | 108 import 'dart:html'; |
| 109 #import('dart:isolate'); | 109 import 'dart:isolate'; |
| 110 #import('${config["unittest"]}', prefix:'unittest'); | 110 import '${config["unittest"]}' as unittest; |
| 111 #import('${config["testfile"]}', prefix: 'test'); | 111 import '${config["testfile"]}' as test; |
| 112 #source('${config["runnerDir"]}/standard_test_runner.dart'); | 112 part '${config["runnerDir"]}/standard_test_runner.dart'; |
| 113 '''; | 113 '''; |
| 114 extras = ''' | 114 extras = ''' |
| 115 includeFilters = ${config["include"]}; | 115 includeFilters = ${config["include"]}; |
| 116 excludeFilters = ${config["exclude"]}; | 116 excludeFilters = ${config["exclude"]}; |
| 117 tprint = (msg) => query('#console').addText('###\$msg\\n'); | 117 tprint = (msg) => query('#console').addText('###\$msg\\n'); |
| 118 notifyDone = (e) => window.postMessage('done', '*'); | 118 notifyDone = (e) => window.postMessage('done', '*'); |
| 119 '''; | 119 '''; |
| 120 } | 120 } |
| 121 | 121 |
| 122 var action = 'process(test.main, unittest.runTests)'; | 122 var action = 'process(test.main, unittest.runTests)'; |
| 123 if (config["layout-text"]) { | 123 if (config["layout-text"]) { |
| 124 action = 'runTextLayoutTests()'; | 124 action = 'runTextLayoutTests()'; |
| 125 } else if (config["layout-pixel"]) { | 125 } else if (config["layout-pixel"]) { |
| 126 action = 'runPixelLayoutTests()'; | 126 action = 'runPixelLayoutTests()'; |
| 127 } else if (config["list-tests"]) { | 127 } else if (config["list-tests"]) { |
| 128 action = 'process(test.main, listTests)'; | 128 action = 'process(test.main, listTests)'; |
| 129 } else if (config["list-groups"]) { | 129 } else if (config["list-groups"]) { |
| 130 action = 'process(test.main, listGroups)'; | 130 action = 'process(test.main, listGroups)'; |
| 131 } else if (config["isolate"]) { | 131 } else if (config["isolate"]) { |
| 132 action = 'process(test.main, runIsolateTests)'; | 132 action = 'process(test.main, runIsolateTests)'; |
| 133 } | 133 } |
| 134 | 134 |
| 135 logMessage('Creating $tempDartFile'); | 135 logMessage('Creating $tempDartFile'); |
| 136 writeFile(tempDartFile, ''' | 136 writeFile(tempDartFile, ''' |
| 137 #library('test_controller'); | 137 library test_controller; |
| 138 $directives | 138 $directives |
| 139 | 139 |
| 140 main() { | 140 main() { |
| 141 immediate = ${config["immediate"]}; | 141 immediate = ${config["immediate"]}; |
| 142 includeTime = ${config["time"]}; | 142 includeTime = ${config["time"]}; |
| 143 passFormat = '${config["pass-format"]}'; | 143 passFormat = '${config["pass-format"]}'; |
| 144 failFormat = '${config["fail-format"]}'; | 144 failFormat = '${config["fail-format"]}'; |
| 145 errorFormat = '${config["error-format"]}'; | 145 errorFormat = '${config["error-format"]}'; |
| 146 listFormat = '${config["list-format"]}'; | 146 listFormat = '${config["list-format"]}'; |
| 147 regenerate = ${config["regenerate"]}; | 147 regenerate = ${config["regenerate"]}; |
| 148 summarize = ${config["summary"]}; | 148 summarize = ${config["summary"]}; |
| 149 testfile = '$testFile'; | 149 testfile = '$testFile'; |
| 150 drt = '${config["drt"]}'; | 150 drt = '${config["drt"]}'; |
| 151 $extras | 151 $extras |
| 152 $action; | 152 $action; |
| 153 } | 153 } |
| 154 '''); | 154 '''); |
| 155 | 155 |
| 156 // Create the child wrapper for layout tests. | 156 // Create the child wrapper for layout tests. |
| 157 if (config["layout"]) { | 157 if (config["layout"]) { |
| 158 logMessage('Creating $tempChildDartFile'); | 158 logMessage('Creating $tempChildDartFile'); |
| 159 writeFile(tempChildDartFile, ''' | 159 writeFile(tempChildDartFile, ''' |
| 160 #library('layout_test'); | 160 library layout_test; |
| 161 #import('dart:math'); | 161 import 'dart:math'; |
| 162 #import('dart:isolate'); | 162 import 'dart:isolate'; |
| 163 #import('dart:html'); | 163 import 'dart:html'; |
| 164 #import('dart:uri'); | 164 import 'dart:uri'; |
| 165 #import('${config["unittest"]}', prefix:'unittest'); | 165 import '${config["unittest"]}' as 'unittest' ; |
| 166 #import('$testFile', prefix: 'test'); | 166 import '$testFile', prefix: 'test' ; |
| 167 #source('${config["runnerDir"]}/layout_test_runner.dart'); | 167 part '${config["runnerDir"]}/layout_test_runner.dart'; |
| 168 | 168 |
| 169 main() { | 169 main() { |
| 170 includeFilters = ${config["include"]}; | 170 includeFilters = ${config["include"]}; |
| 171 excludeFilters = ${config["exclude"]}; | 171 excludeFilters = ${config["exclude"]}; |
| 172 runTests(test.main); | 172 runTests(test.main); |
| 173 } | 173 } |
| 174 '''); | 174 '''); |
| 175 } | 175 } |
| 176 | 176 |
| 177 | 177 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 | 285 |
| 286 if (!config["keep_files"]) { // Remove the temporary files. | 286 if (!config["keep_files"]) { // Remove the temporary files. |
| 287 cleanup(tempDartFile); | 287 cleanup(tempDartFile); |
| 288 cleanup(tempHtmlFile); | 288 cleanup(tempHtmlFile); |
| 289 cleanup(tempJsFile); | 289 cleanup(tempJsFile); |
| 290 cleanup(tempChildDartFile); | 290 cleanup(tempChildDartFile); |
| 291 cleanup(tempChildJsFile); | 291 cleanup(tempChildJsFile); |
| 292 } | 292 } |
| 293 completePipeline(exitcode); | 293 completePipeline(exitcode); |
| 294 } | 294 } |
| OLD | NEW |