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

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

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: Created 3 years, 9 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 // VMOptions=--error_on_bad_type --error_on_bad_override 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 import 'dart:developer'; 6 import 'dart:developer';
7 import 'package:observatory/service_io.dart'; 7 import 'package:observatory/service_io.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import 'service_test_common.dart'; 9 import 'service_test_common.dart';
10 import 'test_helper.dart'; 10 import 'test_helper.dart';
(...skipping 14 matching lines...) Expand all
25 try { 25 try {
26 for (int i = 0; i < x; i++) { 26 for (int i = 0; i < x; i++) {
27 sum += x; 27 sum += x;
28 } 28 }
29 } catch (e) { 29 } catch (e) {
30 print("caught $e"); 30 print("caught $e");
31 } 31 }
32 if (global >= 100) { 32 if (global >= 100) {
33 debugger(); 33 debugger();
34 } 34 }
35 global = global + 1; // Line A 35 global = global + 1; // Line A
36 return sum; 36 return sum;
37 } 37 }
38 38
39 @alwaysInline 39 @alwaysInline
40 b2(x) => b3(x); // Line B 40 b2(x) => b3(x); // Line B
41 41
42 @alwaysInline 42 @alwaysInline
43 b1(x) => b2(x); // Line C 43 b1(x) => b2(x); // Line C
44 44
45 test() { 45 test() {
46 while (true) { 46 while (true) {
47 b1(10000); // Line D 47 b1(10000); // Line D
48 } 48 }
49 } 49 }
50 50
51 var tests = [ 51 var tests = [
52 hasStoppedAtBreakpoint, 52 hasStoppedAtBreakpoint,
53 stoppedAtLine(LINE_A), 53 stoppedAtLine(LINE_A),
54
55 (Isolate isolate) async { 54 (Isolate isolate) async {
56 // We are not able to rewind frame 0. 55 // We are not able to rewind frame 0.
57 bool caughtException; 56 bool caughtException;
58 try { 57 try {
59 await isolate.rewind(0); 58 await isolate.rewind(0);
60 expect(false, isTrue, reason:'Unreachable'); 59 expect(false, isTrue, reason: 'Unreachable');
61 } on ServerRpcException catch(e) { 60 } on ServerRpcException catch (e) {
62 caughtException = true; 61 caughtException = true;
63 expect(e.code, equals(ServerRpcException.kCannotResume)); 62 expect(e.code, equals(ServerRpcException.kCannotResume));
64 expect(e.message, 'Frame must be in bounds [1..9]: saw 0'); 63 expect(e.message, 'Frame must be in bounds [1..9]: saw 0');
65 } 64 }
66 expect(caughtException, isTrue); 65 expect(caughtException, isTrue);
67 }, 66 },
68
69 (Isolate isolate) async { 67 (Isolate isolate) async {
70 // We are not able to rewind frame 10. 68 // We are not able to rewind frame 10.
71 bool caughtException; 69 bool caughtException;
72 try { 70 try {
73 await isolate.rewind(10); 71 await isolate.rewind(10);
74 expect(false, isTrue, reason:'Unreachable'); 72 expect(false, isTrue, reason: 'Unreachable');
75 } on ServerRpcException catch(e) { 73 } on ServerRpcException catch (e) {
76 caughtException = true; 74 caughtException = true;
77 expect(e.code, equals(ServerRpcException.kCannotResume)); 75 expect(e.code, equals(ServerRpcException.kCannotResume));
78 expect(e.message, 'Frame must be in bounds [1..9]: saw 10'); 76 expect(e.message, 'Frame must be in bounds [1..9]: saw 10');
79 } 77 }
80 expect(caughtException, isTrue); 78 expect(caughtException, isTrue);
81 }, 79 },
82
83 (Isolate isolate) async { 80 (Isolate isolate) async {
84 // We are at our breakpoint with global=100. 81 // We are at our breakpoint with global=100.
85 var result = await isolate.rootLibrary.evaluate('global'); 82 var result = await isolate.rootLibrary.evaluate('global');
86 print('global is $result'); 83 print('global is $result');
87 expect(result.type, equals('Instance')); 84 expect(result.type, equals('Instance'));
88 expect(result.valueAsString, equals('100')); 85 expect(result.valueAsString, equals('100'));
89 86
90 // Rewind the top stack frame. 87 // Rewind the top stack frame.
91 result = await isolate.rewind(1); 88 result = await isolate.rewind(1);
92 expect(result['type'], equals('Success')); 89 expect(result['type'], equals('Success'));
93 }, 90 },
94
95 hasStoppedAtBreakpoint, 91 hasStoppedAtBreakpoint,
96 stoppedAtLine(LINE_B), 92 stoppedAtLine(LINE_B),
97
98 (Isolate isolate) async { 93 (Isolate isolate) async {
99 var result = await isolate.resume(); 94 var result = await isolate.resume();
100 expect(result['type'], equals('Success')); 95 expect(result['type'], equals('Success'));
101 }, 96 },
102
103 hasStoppedAtBreakpoint, 97 hasStoppedAtBreakpoint,
104 stoppedAtLine(LINE_A), 98 stoppedAtLine(LINE_A),
105
106 (Isolate isolate) async { 99 (Isolate isolate) async {
107 // global still is equal to 100. We did not execute "global++". 100 // global still is equal to 100. We did not execute "global++".
108 var result = await isolate.rootLibrary.evaluate('global'); 101 var result = await isolate.rootLibrary.evaluate('global');
109 print('global is $result'); 102 print('global is $result');
110 expect(result.type, equals('Instance')); 103 expect(result.type, equals('Instance'));
111 expect(result.valueAsString, equals('100')); 104 expect(result.valueAsString, equals('100'));
112 105
113 // Resume again, for fun. 106 // Resume again, for fun.
114 result = await isolate.resume(); 107 result = await isolate.resume();
115 expect(result['type'], equals('Success')); 108 expect(result['type'], equals('Success'));
116 }, 109 },
117
118 hasStoppedAtBreakpoint, 110 hasStoppedAtBreakpoint,
119 stoppedAtLine(LINE_A), 111 stoppedAtLine(LINE_A),
120
121 (Isolate isolate) async { 112 (Isolate isolate) async {
122 // global is now 101. 113 // global is now 101.
123 var result = await isolate.rootLibrary.evaluate('global'); 114 var result = await isolate.rootLibrary.evaluate('global');
124 print('global is $result'); 115 print('global is $result');
125 expect(result.type, equals('Instance')); 116 expect(result.type, equals('Instance'));
126 expect(result.valueAsString, equals('101')); 117 expect(result.valueAsString, equals('101'));
127 118
128 // Rewind up to 'test'/ 119 // Rewind up to 'test'/
129 result = await isolate.rewind(3); 120 result = await isolate.rewind(3);
130 expect(result['type'], equals('Success')); 121 expect(result['type'], equals('Success'));
131 }, 122 },
132
133 hasStoppedAtBreakpoint, 123 hasStoppedAtBreakpoint,
134 stoppedAtLine(LINE_D), 124 stoppedAtLine(LINE_D),
135
136 (Isolate isolate) async { 125 (Isolate isolate) async {
137 // Reset global to 0 and start again. 126 // Reset global to 0 and start again.
138 var result = await isolate.rootLibrary.evaluate('global=0'); 127 var result = await isolate.rootLibrary.evaluate('global=0');
139 print('set global to $result'); 128 print('set global to $result');
140 expect(result.type, equals('Instance')); 129 expect(result.type, equals('Instance'));
141 expect(result.valueAsString, equals('0')); 130 expect(result.valueAsString, equals('0'));
142 131
143 result = await isolate.resume(); 132 result = await isolate.resume();
144 expect(result['type'], equals('Success')); 133 expect(result['type'], equals('Success'));
145 }, 134 },
146
147 hasStoppedAtBreakpoint, 135 hasStoppedAtBreakpoint,
148 stoppedAtLine(LINE_A), 136 stoppedAtLine(LINE_A),
149
150 (Isolate isolate) async { 137 (Isolate isolate) async {
151 // We are at our breakpoint with global=100. 138 // We are at our breakpoint with global=100.
152 var result = await isolate.rootLibrary.evaluate('global'); 139 var result = await isolate.rootLibrary.evaluate('global');
153 print('global is $result'); 140 print('global is $result');
154 expect(result.type, equals('Instance')); 141 expect(result.type, equals('Instance'));
155 expect(result.valueAsString, equals('100')); 142 expect(result.valueAsString, equals('100'));
156 143
157 // Rewind the top 2 stack frames. 144 // Rewind the top 2 stack frames.
158 result = await isolate.rewind(2); 145 result = await isolate.rewind(2);
159 expect(result['type'], equals('Success')); 146 expect(result['type'], equals('Success'));
160 }, 147 },
161
162 hasStoppedAtBreakpoint, 148 hasStoppedAtBreakpoint,
163 stoppedAtLine(LINE_C), 149 stoppedAtLine(LINE_C),
164 ]; 150 ];
165 151
166 152 main(args) => runIsolateTests(args, tests, testeeConcurrent: test, extraArgs: [
167 main(args) => runIsolateTests(args, tests, testeeConcurrent: test, 153 '--trace-rewind',
168 extraArgs: 154 '--no-prune-dead-locals',
169 ['--trace-rewind', 155 '--enable-inlining-annotations',
170 '--no-prune-dead-locals', 156 '--no-background-compilation',
171 '--enable-inlining-annotations', 157 '--optimization-counter-threshold=10'
172 '--no-background-compilation', 158 ]);
173 '--optimization-counter-threshold=10']);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698