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

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

Issue 2786503003: Fix a couple of bugs with async stack traces (Closed)
Patch Set: update dartk service test status Created 3 years, 8 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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:async'; 5 import 'dart:async';
6 import 'test_helper.dart'; 6 import 'test_helper.dart';
7 import 'service_test_common.dart'; 7 import 'service_test_common.dart';
8 import 'package:observatory/service_io.dart'; 8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
11 const int LINE_A = 28, LINE_B = 33; 11 const int LINE_A = 19, LINE_B = 38;
12 12
13 class VMServiceClient { 13 var _lock;
14 VMServiceClient(this.x); 14 var _lockEnabled = true;
15 close() => new Future.microtask(() => print("close")); 15
16 var x; 16 String flutterRoot = "abc";
17
18 foo(a, b, c, d) {
19 return new A(); // LINE_A
17 } 20 }
18 21
19 collect() async { 22 class A {
20 var uri = "abc"; 23 Future lock() => new Future.microtask(() => print("lock"));
21 var vmService; 24 String path = "path";
22 await new Future.microtask(() async {
23 try {
24 vmService = new VMServiceClient(uri);
25 await new Future.microtask(() => throw new TimeoutException("here"));
26 } on dynamic {
27 vmService.close();
28 rethrow; // LINE_A
29 }
30 });
31 } 25 }
32 26
33 test_code() async { 27 class FileSystemException {}
34 // LINE_B 28
35 try { 29 Future<Null> test_code() async {
36 await collect(); 30 if (!_lockEnabled) return null;
37 } on TimeoutException { 31 assert(_lock == null);
38 print("ok"); 32 _lock = foo(flutterRoot, 'bin', 'cache', 'lockfile');
33 bool locked = false;
34 bool printed = false;
35 while (!locked) {
36 try {
37 await _lock.lock();
38 locked = true; // LINE_B
39 } on FileSystemException {
40 if (!printed) {
41 printTrace('Print path: ${_lock.path}');
42 printStatus('Just another line...');
43 printed = true;
44 }
45 await new Future<Null>.delayed(const Duration(milliseconds: 50));
46 }
39 } 47 }
40 } 48 }
41 49
42 Future<Isolate> stepThroughProgram(Isolate isolate) async { 50 Future<Isolate> stepThroughProgram(Isolate isolate) async {
43 Completer completer = new Completer(); 51 Completer completer = new Completer();
44 int pauseEventsSeen = 0; 52 int pauseEventsSeen = 0;
45 53
46 await subscribeToStream(isolate.vm, VM.kDebugStream, 54 await subscribeToStream(isolate.vm, VM.kDebugStream,
47 (ServiceEvent event) async { 55 (ServiceEvent event) async {
48 if (event.kind == ServiceEvent.kPauseBreakpoint) { 56 if (event.kind == ServiceEvent.kPauseBreakpoint) {
49 // We are paused: Step further. 57 // We are paused: Step further.
50 pauseEventsSeen++; 58 pauseEventsSeen++;
51 isolate.stepInto(); 59 isolate.stepInto();
52 } else if (event.kind == ServiceEvent.kPauseExit) { 60 } else if (event.kind == ServiceEvent.kPauseExit) {
53 // We are at the exit: The test is done. 61 // We are at the exit: The test is done.
54 expect(pauseEventsSeen > 20, true, 62 expect(pauseEventsSeen > 20, true,
55 reason: "Saw only $pauseEventsSeen pause events."); 63 reason: "Saw only $pauseEventsSeen pause events.");
56 await cancelStreamSubscription(VM.kDebugStream); 64 await cancelStreamSubscription(VM.kDebugStream);
57 completer.complete(); 65 completer.complete();
58 } 66 }
59 }); 67 });
60 isolate.resume(); 68 isolate.resume();
61 return completer.future; 69 return completer.future;
62 } 70 }
63 71
64 var tests = [ 72 var tests = [
65 hasPausedAtStart, 73 hasPausedAtStart,
66 markDartColonLibrariesDebuggable, 74 markDartColonLibrariesDebuggable,
75 setBreakpointAtLine(LINE_A),
76 resumeIsolate,
77 hasStoppedAtBreakpoint,
67 setBreakpointAtLine(LINE_B), 78 setBreakpointAtLine(LINE_B),
68 resumeIsolate, 79 resumeIsolate,
69 hasStoppedAtBreakpoint, 80 hasStoppedAtBreakpoint,
70 setBreakpointAtLine(LINE_A), 81 stepInto,
82 stepInto,
83 stepInto,
71 resumeIsolate, 84 resumeIsolate,
72 hasStoppedAtBreakpoint,
73 stepOut,
74 stoppedAtLine(LINE_B),
75 resumeIsolate
76 ]; 85 ];
77 86
78 main(args) => runIsolateTestsSynchronous(args, tests, 87 main(args) => runIsolateTestsSynchronous(args, tests,
79 testeeConcurrent: test_code, pause_on_start: true, pause_on_exit: false); 88 testeeConcurrent: test_code, pause_on_start: true, pause_on_exit: false);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/regress_28443_test.dart ('k') | runtime/observatory/tests/service/service.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698