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 import 'dart:math'; | |
10 part 'pipeline_utils.dart'; | 9 part 'pipeline_utils.dart'; |
11 | 10 |
12 /** | 11 /** |
13 * The configuration passed in to the pipeline runner; this essentially | 12 * The configuration passed in to the pipeline runner; this essentially |
14 * contains all the command line arguments passded to testrunner plus some | 13 * contains all the command line arguments passded to testrunner plus some |
15 * synthesized ones. | 14 * synthesized ones. |
16 */ | 15 */ |
17 Map config; | 16 Map config; |
18 | 17 |
19 /** Paths to the various generated temporary files. */ | 18 /** Paths to the various generated temporary files. */ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Set the root to be the directory containing the test file. | 76 // Set the root to be the directory containing the test file. |
78 serverRoot = getDirectory(config["testfile"]); | 77 serverRoot = getDirectory(config["testfile"]); |
79 } | 78 } |
80 | 79 |
81 if (config["port"] == null) { | 80 if (config["port"] == null) { |
82 // In this case we have to choose a random port and we need | 81 // In this case we have to choose a random port and we need |
83 // to see if the server starts successfully on that port. | 82 // to see if the server starts successfully on that port. |
84 var r = new Random(); | 83 var r = new Random(); |
85 tryStartHTTPServer(r, MAX_SERVER_TRIES); | 84 tryStartHTTPServer(r, MAX_SERVER_TRIES); |
86 } else { | 85 } else { |
87 serverPort = parseInt(config["port"]); | 86 serverPort = int.parse(config["port"]); |
88 // Start the HTTP server. | 87 // Start the HTTP server. |
89 serverId = startProcess(config["dart"], | 88 serverId = startProcess(config["dart"], |
90 [ serverPath, '--port=$serverPort', '--root=$serverRoot']); | 89 [ serverPath, '--port=$serverPort', '--root=$serverRoot']); |
91 } | 90 } |
92 } | 91 } |
93 } | 92 } |
94 wrapStage(); | 93 wrapStage(); |
95 } | 94 } |
96 | 95 |
97 void tryStartHTTPServer(Random r, int remainingAttempts) { | 96 void tryStartHTTPServer(Random r, int remainingAttempts) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 348 |
350 if (!config["keep-files"]) { // Remove the temporary files. | 349 if (!config["keep-files"]) { // Remove the temporary files. |
351 cleanup(tempDartFile); | 350 cleanup(tempDartFile); |
352 cleanup(tempHtmlFile); | 351 cleanup(tempHtmlFile); |
353 cleanup(tempJsFile); | 352 cleanup(tempJsFile); |
354 cleanup(tempChildDartFile); | 353 cleanup(tempChildDartFile); |
355 cleanup(tempChildJsFile); | 354 cleanup(tempChildJsFile); |
356 } | 355 } |
357 completePipeline(exitcode); | 356 completePipeline(exitcode); |
358 } | 357 } |
OLD | NEW |