| 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 library test_helper; | 5 library test_helper; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'package:observatory/service_io.dart'; | 10 import 'package:observatory/service_io.dart'; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 fullArgs.addAll(Platform.executableArguments); | 185 fullArgs.addAll(Platform.executableArguments); |
| 186 fullArgs.add('--observatory-port=0'); | 186 fullArgs.add('--observatory-port=0'); |
| 187 fullArgs.add('--dart-flags=${dartFlags.join(' ')}'); | 187 fullArgs.add('--dart-flags=${dartFlags.join(' ')}'); |
| 188 fullArgs.addAll(args); | 188 fullArgs.addAll(args); |
| 189 | 189 |
| 190 return _spawnCommon(dartExecutable, fullArgs); | 190 return _spawnCommon(dartExecutable, fullArgs); |
| 191 } | 191 } |
| 192 | 192 |
| 193 Future<Process> _spawnCommon(String executable, List<String> arguments) { | 193 Future<Process> _spawnCommon(String executable, List<String> arguments) { |
| 194 print('** Launching $executable ${arguments.join(' ')}'); | 194 var environment = _TESTEE_SPAWN_ENV; |
| 195 return Process.start(executable, arguments, environment: _TESTEE_SPAWN_ENV); | 195 var bashEnvironment = new StringBuffer(); |
| 196 environment.forEach((k, v) => bashEnvironment.write("$k=$v ")); |
| 197 print('** Launching $bashEnvironment$executable ${arguments.join(' ')}'); |
| 198 return Process.start(executable, arguments, environment: environment); |
| 196 } | 199 } |
| 197 | 200 |
| 198 Future<int> launch(bool pause_on_start, | 201 Future<int> launch(bool pause_on_start, |
| 199 bool pause_on_exit, | 202 bool pause_on_exit, |
| 200 bool pause_on_unhandled_exceptions, | 203 bool pause_on_unhandled_exceptions, |
| 201 bool trace_service, | 204 bool trace_service, |
| 202 bool trace_compiler) { | 205 bool trace_compiler) { |
| 203 return _spawnProcess(pause_on_start, | 206 return _spawnProcess(pause_on_start, |
| 204 pause_on_exit, | 207 pause_on_exit, |
| 205 pause_on_unhandled_exceptions, | 208 pause_on_unhandled_exceptions, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 bool pause_on_exit: false, | 323 bool pause_on_exit: false, |
| 321 bool trace_service: false, | 324 bool trace_service: false, |
| 322 bool trace_compiler: false, | 325 bool trace_compiler: false, |
| 323 bool verbose_vm: false, | 326 bool verbose_vm: false, |
| 324 bool pause_on_unhandled_exceptions: false}) { | 327 bool pause_on_unhandled_exceptions: false}) { |
| 325 var process = new _ServiceTesteeLauncher(); | 328 var process = new _ServiceTesteeLauncher(); |
| 326 process.launch(pause_on_start, pause_on_exit, | 329 process.launch(pause_on_start, pause_on_exit, |
| 327 pause_on_unhandled_exceptions, | 330 pause_on_unhandled_exceptions, |
| 328 trace_service, trace_compiler).then((port) async { | 331 trace_service, trace_compiler).then((port) async { |
| 329 if (mainArgs.contains("--gdb")) { | 332 if (mainArgs.contains("--gdb")) { |
| 330 port = 8181; | 333 var pid = process.process.pid; |
| 334 var wait = new Duration(seconds: 10); |
| 335 print("Testee has pid $pid, waiting $wait before continuing"); |
| 331 } | 336 } |
| 332 serviceWebsocketAddress = 'ws://localhost:$port/ws'; | 337 serviceWebsocketAddress = 'ws://localhost:$port/ws'; |
| 333 serviceHttpAddress = 'http://localhost:$port'; | 338 serviceHttpAddress = 'http://localhost:$port'; |
| 334 var name = Platform.script.pathSegments.last; | 339 var name = Platform.script.pathSegments.last; |
| 335 runZoned(() async { | 340 runZoned(() async { |
| 336 var vm = | 341 var vm = |
| 337 new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress)); | 342 new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress)); |
| 338 print('Loading VM...'); | 343 print('Loading VM...'); |
| 339 await vm.load(); | 344 await vm.load(); |
| 340 print('Done loading VM'); | 345 print('Done loading VM'); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 mainArgs: mainArgs, | 484 mainArgs: mainArgs, |
| 480 vmTests: tests, | 485 vmTests: tests, |
| 481 pause_on_start: pause_on_start, | 486 pause_on_start: pause_on_start, |
| 482 pause_on_exit: pause_on_exit, | 487 pause_on_exit: pause_on_exit, |
| 483 trace_service: trace_service, | 488 trace_service: trace_service, |
| 484 trace_compiler: trace_compiler, | 489 trace_compiler: trace_compiler, |
| 485 verbose_vm: verbose_vm, | 490 verbose_vm: verbose_vm, |
| 486 pause_on_unhandled_exceptions: pause_on_unhandled_exceptions); | 491 pause_on_unhandled_exceptions: pause_on_unhandled_exceptions); |
| 487 } | 492 } |
| 488 } | 493 } |
| OLD | NEW |