Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: runtime/observatory/tests/service/test_helper.dart

Issue 2690683002: Improvements to causal async stack traces (Closed)
Patch Set: asiva review and rmacnak added on test cases Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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';
11 import 'package:stack_trace/stack_trace.dart';
12 import 'service_test_common.dart'; 11 import 'service_test_common.dart';
13 12
14 /// Will be set to the http address of the VM's service protocol before 13 /// Will be set to the http address of the VM's service protocol before
15 /// any tests are invoked. 14 /// any tests are invoked.
16 String serviceHttpAddress; 15 String serviceHttpAddress;
17 String serviceWebsocketAddress; 16 String serviceWebsocketAddress;
18 17
19 const String _TESTEE_ENV_KEY = 'SERVICE_TEST_TESTEE'; 18 const String _TESTEE_ENV_KEY = 'SERVICE_TEST_TESTEE';
20 const Map<String, String> _TESTEE_SPAWN_ENV = const { 19 const Map<String, String> _TESTEE_SPAWN_ENV = const {
21 _TESTEE_ENV_KEY: 'true' 20 _TESTEE_ENV_KEY: 'true'
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 testeeControlsServer, 286 testeeControlsServer,
288 useAuthToken, extraArgs).then((Uri serverAddress) async { 287 useAuthToken, extraArgs).then((Uri serverAddress) async {
289 if (mainArgs.contains("--gdb")) { 288 if (mainArgs.contains("--gdb")) {
290 var pid = process.process.pid; 289 var pid = process.process.pid;
291 var wait = new Duration(seconds: 10); 290 var wait = new Duration(seconds: 10);
292 print("Testee has pid $pid, waiting $wait before continuing"); 291 print("Testee has pid $pid, waiting $wait before continuing");
293 sleep(wait); 292 sleep(wait);
294 } 293 }
295 setupAddresses(serverAddress); 294 setupAddresses(serverAddress);
296 var name = Platform.script.pathSegments.last; 295 var name = Platform.script.pathSegments.last;
297 Chain.capture(() async { 296 try {
298 var vm = 297 var vm =
299 new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress)); 298 new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress));
300 print('Loading VM...'); 299 print('Loading VM...');
301 await vm.load(); 300 await vm.load();
302 print('Done loading VM'); 301 print('Done loading VM');
303 302
304 // Run vm tests. 303 // Run vm tests.
305 if (vmTests != null) { 304 if (vmTests != null) {
306 var testIndex = 1; 305 var testIndex = 1;
307 var totalTests = vmTests.length; 306 var totalTests = vmTests.length;
(...skipping 14 matching lines...) Expand all
322 vm.verbose = verbose_vm; 321 vm.verbose = verbose_vm;
323 print('Running $name [$testIndex/$totalTests]'); 322 print('Running $name [$testIndex/$totalTests]');
324 testIndex++; 323 testIndex++;
325 await test(isolate); 324 await test(isolate);
326 } 325 }
327 } 326 }
328 327
329 print('All service tests completed successfully.'); 328 print('All service tests completed successfully.');
330 testsDone = true; 329 testsDone = true;
331 await process.requestExit(); 330 await process.requestExit();
332 }, onError: (error, stackTrace) { 331 } catch (error, stackTrace) {
333 if (testsDone) { 332 if (testsDone) {
334 print('Ignoring late exception during process exit:\n' 333 print('Ignoring late exception during process exit:\n'
335 '$error\n#stackTrace'); 334 '$error\n#stackTrace');
336 } else { 335 } else {
337 process.requestExit(); 336 process.requestExit();
338 print('Unexpected exception in service tests: $error\n$stackTrace'); 337 print('Unexpected exception in service tests: $error\n$stackTrace');
339 throw error; 338 rethrow;
340 } 339 }
341 }); 340 }
342 }); 341 });
343 } 342 }
344 343
345 344
346 345
347 Future<Isolate> getFirstIsolate(WebSocketVM vm) async { 346 Future<Isolate> getFirstIsolate(WebSocketVM vm) async {
348 if (vm.isolates.isNotEmpty) { 347 if (vm.isolates.isNotEmpty) {
349 var isolate = await vm.isolates.first.load(); 348 var isolate = await vm.isolates.first.load();
350 if (isolate is Isolate) { 349 if (isolate is Isolate) {
351 return isolate; 350 return isolate;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 new _ServiceTesterRunner().run( 480 new _ServiceTesterRunner().run(
482 mainArgs: mainArgs, 481 mainArgs: mainArgs,
483 extraArgs: extraArgs, 482 extraArgs: extraArgs,
484 vmTests: tests, 483 vmTests: tests,
485 pause_on_start: pause_on_start, 484 pause_on_start: pause_on_start,
486 pause_on_exit: pause_on_exit, 485 pause_on_exit: pause_on_exit,
487 verbose_vm: verbose_vm, 486 verbose_vm: verbose_vm,
488 pause_on_unhandled_exceptions: pause_on_unhandled_exceptions); 487 pause_on_unhandled_exceptions: pause_on_unhandled_exceptions);
489 } 488 }
490 } 489 }
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/causal_async_star_stack_contents_test.dart ('k') | runtime/vm/debugger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698