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 part 'pipeline_utils.dart'; | 9 part 'pipeline_utils.dart'; |
| 10 | 10 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 [ '--out=$scriptFile', '$sourceFile' ]). | 244 [ '--out=$scriptFile', '$sourceFile' ]). |
| 245 then(runTestStage); | 245 then(runTestStage); |
| 246 } | 246 } |
| 247 } else { | 247 } else { |
| 248 runTestStage(0); | 248 runTestStage(0); |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 /** Third stage of pipeline - runs the tests. */ | 252 /** Third stage of pipeline - runs the tests. */ |
| 253 runTestStage(_) { | 253 runTestStage(_) { |
| 254 if (config["server"]) { // Start the HTTP server. | 254 if (config["server"]) { |
| 255 serverId = startProcess(config["dart"], | 255 var serverPath = config["testfile"]; |
| 256 [ '${config["runnerDir"]}/http_server_test_runner.dart', | 256 // Replace .dart with _server.dart to get test's server file, if any. |
| 257 '--port=${config["port"]}', | 257 serverPath = '${serverPath.substring(0, serverPath.length-5)}_server.dart'; |
|
Siggi Cherem (dart-lang)
2012/10/10 17:51:32
nit: spaces around '-', I might prefer '.dart'.len
gram
2012/10/17 00:03:28
Done.
| |
| 258 '--root=${config["root"]}']); | 258 var serverFile = new File(serverPath); |
| 259 if (!serverFile.existsSync()) { | |
| 260 // No custom server; run the default server. | |
| 261 serverPath = '${config["runnerDir"]}/http_server_runner.dart'; | |
| 262 } | |
| 263 if (serverPath != null) { | |
| 264 var root = config["root"]; | |
| 265 if (root == null) { | |
| 266 // Set the root to be the directory containing the test file. | |
| 267 root = getDirectory(config["testfile"]); | |
| 268 } | |
| 269 // Start the HTTP server. | |
| 270 serverId = startProcess(config["dart"], | |
| 271 [ serverPath, '--port=${config["port"]}', '--root=$root']); | |
| 272 } | |
| 259 } | 273 } |
| 260 | 274 |
| 261 var cmd, args; | 275 var cmd, args; |
| 262 if (config["runtime"] == 'vm' || config["layout"]) { // Run the tests. | 276 if (config["runtime"] == 'vm' || config["layout"]) { // Run the tests. |
| 263 if (config["checked"]) { | 277 if (config["checked"]) { |
| 264 cmd = config["dart"]; | 278 cmd = config["dart"]; |
| 265 args = [ '--enable_asserts', '--enable_type_checks', tempDartFile ]; | 279 args = [ '--enable_asserts', '--enable_type_checks', tempDartFile ]; |
| 266 } else { | 280 } else { |
| 267 cmd = config["dart"]; | 281 cmd = config["dart"]; |
| 268 args = [ tempDartFile ]; | 282 args = [ tempDartFile ]; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 285 | 299 |
| 286 if (!config["keep-files"]) { // Remove the temporary files. | 300 if (!config["keep-files"]) { // Remove the temporary files. |
| 287 cleanup(tempDartFile); | 301 cleanup(tempDartFile); |
| 288 cleanup(tempHtmlFile); | 302 cleanup(tempHtmlFile); |
| 289 cleanup(tempJsFile); | 303 cleanup(tempJsFile); |
| 290 cleanup(tempChildDartFile); | 304 cleanup(tempChildDartFile); |
| 291 cleanup(tempChildJsFile); | 305 cleanup(tempChildJsFile); |
| 292 } | 306 } |
| 293 completePipeline(exitcode); | 307 completePipeline(exitcode); |
| 294 } | 308 } |
| OLD | NEW |