| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import "dart:io"; | 5 import "dart:io"; |
| 6 import "dart:isolate"; | 6 import "dart:isolate"; |
| 7 import "dart:async"; | 7 import "dart:async"; |
| 8 import "../../../tools/testing/dart/expectation.dart"; | 8 import "../../../tools/testing/dart/expectation.dart"; |
| 9 import "../../../tools/testing/dart/options.dart"; |
| 9 import "../../../tools/testing/dart/status_file.dart"; | 10 import "../../../tools/testing/dart/status_file.dart"; |
| 10 import "../../../tools/testing/dart/test_runner.dart"; | 11 import "../../../tools/testing/dart/test_runner.dart"; |
| 11 import "../../../tools/testing/dart/test_suite.dart"; | 12 import "../../../tools/testing/dart/test_suite.dart"; |
| 12 import "../../../tools/testing/dart/test_progress.dart" as progress; | 13 import "../../../tools/testing/dart/test_progress.dart" as progress; |
| 13 import "../../../tools/testing/dart/test_options.dart"; | |
| 14 import "process_test_util.dart"; | 14 import "process_test_util.dart"; |
| 15 | 15 |
| 16 final DEFAULT_TIMEOUT = 20; | 16 final DEFAULT_TIMEOUT = 20; |
| 17 final LONG_TIMEOUT = 30; | 17 final LONG_TIMEOUT = 30; |
| 18 | 18 |
| 19 List<String> packageOptions() { | 19 List<String> packageOptions() { |
| 20 if (Platform.packageRoot != null) { | 20 if (Platform.packageRoot != null) { |
| 21 return <String>['--package-root=${Platform.packageRoot}']; | 21 return <String>['--package-root=${Platform.packageRoot}']; |
| 22 } else if (Platform.packageConfig != null) { | 22 } else if (Platform.packageConfig != null) { |
| 23 return <String>['--packages=${Platform.packageConfig}']; | 23 return <String>['--packages=${Platform.packageConfig}']; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 'custom_crash', getProcessTestFileName(), ["0", "0", "1", "1"], {}); | 106 'custom_crash', getProcessTestFileName(), ["0", "0", "1", "1"], {}); |
| 107 // The crash test sometimes times out. Run it with a large timeout | 107 // The crash test sometimes times out. Run it with a large timeout |
| 108 // to help diagnose the delay. | 108 // to help diagnose the delay. |
| 109 // The test loads a new executable, which may sometimes take a long time. | 109 // The test loads a new executable, which may sometimes take a long time. |
| 110 // It involves a wait on the VM event loop, and possible system | 110 // It involves a wait on the VM event loop, and possible system |
| 111 // delays. | 111 // delays. |
| 112 return _makeTestCase(name, LONG_TIMEOUT, crashCommand, expectations); | 112 return _makeTestCase(name, LONG_TIMEOUT, crashCommand, expectations); |
| 113 } | 113 } |
| 114 | 114 |
| 115 _makeTestCase(name, timeout, command, expectations) { | 115 _makeTestCase(name, timeout, command, expectations) { |
| 116 var configuration = | 116 var configuration = new OptionsParser().parse(['--timeout', '$timeout'])[0]; |
| 117 new TestOptionsParser().parse(['--timeout', '$timeout'])[0]; | |
| 118 return new TestCase(name, [command], configuration, | 117 return new TestCase(name, [command], configuration, |
| 119 new Set<Expectation>.from(expectations)); | 118 new Set<Expectation>.from(expectations)); |
| 120 } | 119 } |
| 121 } | 120 } |
| 122 | 121 |
| 123 void testProcessQueue() { | 122 void testProcessQueue() { |
| 124 var maxProcesses = 2; | 123 var maxProcesses = 2; |
| 125 var maxBrowserProcesses = maxProcesses; | 124 var maxBrowserProcesses = maxProcesses; |
| 126 var config = new TestOptionsParser().parse(['--nobatch'])[0]; | 125 var config = new OptionsParser().parse(['--noBatch'])[0]; |
| 127 new ProcessQueue( | 126 new ProcessQueue( |
| 128 config, | 127 config, |
| 129 maxProcesses, | 128 maxProcesses, |
| 130 maxBrowserProcesses, | 129 maxBrowserProcesses, |
| 131 new DateTime.now(), | 130 new DateTime.now(), |
| 132 [new CustomTestSuite(config)], | 131 [new CustomTestSuite(config)], |
| 133 [new EventListener()], | 132 [new EventListener()], |
| 134 TestController.finished); | 133 TestController.finished); |
| 135 } | 134 } |
| 136 | 135 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 158 break; | 157 break; |
| 159 case 'timeout': | 158 case 'timeout': |
| 160 // This process should be killed by the test after DEFAULT_TIMEOUT | 159 // This process should be killed by the test after DEFAULT_TIMEOUT |
| 161 new Timer(new Duration(hours: 42), () {}); | 160 new Timer(new Duration(hours: 42), () {}); |
| 162 break; | 161 break; |
| 163 default: | 162 default: |
| 164 throw "Unknown option ${arguments[0]} passed to test_runner_test"; | 163 throw "Unknown option ${arguments[0]} passed to test_runner_test"; |
| 165 } | 164 } |
| 166 } | 165 } |
| 167 } | 166 } |
| OLD | NEW |