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

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

Issue 1684283002: Trace compilation during developer_extension_test. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « runtime/observatory/tests/service/developer_extension_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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';
(...skipping 11 matching lines...) Expand all
22 final List<String> args; 22 final List<String> args;
23 bool killedByTester = false; 23 bool killedByTester = false;
24 24
25 _TestLauncher() : args = ['--enable-vm-service:0', 25 _TestLauncher() : args = ['--enable-vm-service:0',
26 Platform.script.toFilePath(), 26 Platform.script.toFilePath(),
27 _TESTEE_MODE_FLAG] {} 27 _TESTEE_MODE_FLAG] {}
28 28
29 Future<int> launch(bool pause_on_start, 29 Future<int> launch(bool pause_on_start,
30 bool pause_on_exit, 30 bool pause_on_exit,
31 bool pause_on_unhandled_exceptions, 31 bool pause_on_unhandled_exceptions,
32 bool trace_service) { 32 bool trace_service,
33 bool trace_compiler) {
33 assert(pause_on_start != null); 34 assert(pause_on_start != null);
34 assert(pause_on_exit != null); 35 assert(pause_on_exit != null);
35 assert(trace_service != null); 36 assert(trace_service != null);
36 // TODO(turnidge): I have temporarily turned on service tracing for 37 // TODO(turnidge): I have temporarily turned on service tracing for
37 // all tests to help diagnose flaky tests. 38 // all tests to help diagnose flaky tests.
38 trace_service = true; 39 trace_service = true;
39 String dartExecutable = Platform.executable; 40 String dartExecutable = Platform.executable;
40 var fullArgs = []; 41 var fullArgs = [];
41 if (trace_service) { 42 if (trace_service) {
42 fullArgs.add('--trace-service'); 43 fullArgs.add('--trace-service');
43 } 44 }
45 if (trace_compiler) {
46 fullArgs.add('--trace-compiler');
47 }
44 if (pause_on_start) { 48 if (pause_on_start) {
45 fullArgs.add('--pause-isolates-on-start'); 49 fullArgs.add('--pause-isolates-on-start');
46 } 50 }
47 if (pause_on_exit) { 51 if (pause_on_exit) {
48 fullArgs.add('--pause-isolates-on-exit'); 52 fullArgs.add('--pause-isolates-on-exit');
49 } 53 }
50 if (pause_on_unhandled_exceptions) { 54 if (pause_on_unhandled_exceptions) {
51 fullArgs.add('--pause-isolates-on-unhandled-exceptions'); 55 fullArgs.add('--pause-isolates-on-unhandled-exceptions');
52 } 56 }
53 fullArgs.addAll(Platform.executableArguments); 57 fullArgs.addAll(Platform.executableArguments);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 /// return a [Future]. Code for setting up state can run before and/or 116 /// return a [Future]. Code for setting up state can run before and/or
113 /// concurrently with the tests. Uses [mainArgs] to determine whether 117 /// concurrently with the tests. Uses [mainArgs] to determine whether
114 /// to run tests or testee in this invokation of the script. 118 /// to run tests or testee in this invokation of the script.
115 Future runIsolateTests(List<String> mainArgs, 119 Future runIsolateTests(List<String> mainArgs,
116 List<IsolateTest> tests, 120 List<IsolateTest> tests,
117 {testeeBefore(), 121 {testeeBefore(),
118 void testeeConcurrent(), 122 void testeeConcurrent(),
119 bool pause_on_start: false, 123 bool pause_on_start: false,
120 bool pause_on_exit: false, 124 bool pause_on_exit: false,
121 bool trace_service: false, 125 bool trace_service: false,
126 bool trace_compiler: false,
122 bool verbose_vm: false, 127 bool verbose_vm: false,
123 bool pause_on_unhandled_exceptions: false}) async { 128 bool pause_on_unhandled_exceptions: false}) async {
124 assert(!pause_on_start || testeeBefore == null); 129 assert(!pause_on_start || testeeBefore == null);
125 if (mainArgs.contains(_TESTEE_MODE_FLAG)) { 130 if (mainArgs.contains(_TESTEE_MODE_FLAG)) {
126 if (!pause_on_start) { 131 if (!pause_on_start) {
127 if (testeeBefore != null) { 132 if (testeeBefore != null) {
128 var result = testeeBefore(); 133 var result = testeeBefore();
129 if (result is Future) { 134 if (result is Future) {
130 await result; 135 await result;
131 } 136 }
132 } 137 }
133 print(''); // Print blank line to signal that we are ready. 138 print(''); // Print blank line to signal that we are ready.
134 } 139 }
135 if (testeeConcurrent != null) { 140 if (testeeConcurrent != null) {
136 testeeConcurrent(); 141 testeeConcurrent();
137 } 142 }
138 if (!pause_on_exit) { 143 if (!pause_on_exit) {
139 // Wait around for the process to be killed. 144 // Wait around for the process to be killed.
140 stdin.first.then((_) => exit(0)); 145 stdin.first.then((_) => exit(0));
141 } 146 }
142 } else { 147 } else {
143 var process = new _TestLauncher(); 148 var process = new _TestLauncher();
144 process.launch(pause_on_start, pause_on_exit, 149 process.launch(pause_on_start, pause_on_exit,
145 pause_on_unhandled_exceptions, trace_service).then((port) { 150 pause_on_unhandled_exceptions,
151 trace_service, trace_compiler).then((port) {
146 if (mainArgs.contains("--gdb")) { 152 if (mainArgs.contains("--gdb")) {
147 port = 8181; 153 port = 8181;
148 } 154 }
149 String addr = 'ws://localhost:$port/ws'; 155 String addr = 'ws://localhost:$port/ws';
150 serviceHttpAddress = 'http://localhost:$port'; 156 serviceHttpAddress = 'http://localhost:$port';
151 var testIndex = 1; 157 var testIndex = 1;
152 var totalTests = tests.length; 158 var totalTests = tests.length;
153 var name = Platform.script.pathSegments.last; 159 var name = Platform.script.pathSegments.last;
154 runZoned(() { 160 runZoned(() {
155 new WebSocketVM(new WebSocketVMTarget(addr)).load() 161 new WebSocketVM(new WebSocketVMTarget(addr)).load()
(...skipping 27 matching lines...) Expand all
183 /// 189 ///
184 /// TODO(johnmccutchan): Don't use the shared harness for the 190 /// TODO(johnmccutchan): Don't use the shared harness for the
185 /// pause_on_unhandled_exceptions_test. 191 /// pause_on_unhandled_exceptions_test.
186 void runIsolateTestsSynchronous(List<String> mainArgs, 192 void runIsolateTestsSynchronous(List<String> mainArgs,
187 List<IsolateTest> tests, 193 List<IsolateTest> tests,
188 {void testeeBefore(), 194 {void testeeBefore(),
189 void testeeConcurrent(), 195 void testeeConcurrent(),
190 bool pause_on_start: false, 196 bool pause_on_start: false,
191 bool pause_on_exit: false, 197 bool pause_on_exit: false,
192 bool trace_service: false, 198 bool trace_service: false,
199 bool trace_compiler: false,
193 bool verbose_vm: false, 200 bool verbose_vm: false,
194 bool pause_on_unhandled_exceptions: false}) { 201 bool pause_on_unhandled_exceptions: false}) {
195 assert(!pause_on_start || testeeBefore == null); 202 assert(!pause_on_start || testeeBefore == null);
196 if (mainArgs.contains(_TESTEE_MODE_FLAG)) { 203 if (mainArgs.contains(_TESTEE_MODE_FLAG)) {
197 if (!pause_on_start) { 204 if (!pause_on_start) {
198 if (testeeBefore != null) { 205 if (testeeBefore != null) {
199 testeeBefore(); 206 testeeBefore();
200 } 207 }
201 print(''); // Print blank line to signal that we are ready. 208 print(''); // Print blank line to signal that we are ready.
202 } 209 }
203 if (testeeConcurrent != null) { 210 if (testeeConcurrent != null) {
204 testeeConcurrent(); 211 testeeConcurrent();
205 } 212 }
206 if (!pause_on_exit) { 213 if (!pause_on_exit) {
207 // Wait around for the process to be killed. 214 // Wait around for the process to be killed.
208 stdin.first.then((_) => exit(0)); 215 stdin.first.then((_) => exit(0));
209 } 216 }
210 } else { 217 } else {
211 var process = new _TestLauncher(); 218 var process = new _TestLauncher();
212 process.launch(pause_on_start, pause_on_exit, 219 process.launch(pause_on_start, pause_on_exit,
213 pause_on_unhandled_exceptions, trace_service).then((port) { 220 pause_on_unhandled_exceptions,
221 trace_service, trace_compiler).then((port) {
214 if (mainArgs.contains("--gdb")) { 222 if (mainArgs.contains("--gdb")) {
215 port = 8181; 223 port = 8181;
216 } 224 }
217 String addr = 'ws://localhost:$port/ws'; 225 String addr = 'ws://localhost:$port/ws';
218 serviceHttpAddress = 'http://localhost:$port'; 226 serviceHttpAddress = 'http://localhost:$port';
219 var testIndex = 1; 227 var testIndex = 1;
220 var totalTests = tests.length; 228 var totalTests = tests.length;
221 var name = Platform.script.pathSegments.last; 229 var name = Platform.script.pathSegments.last;
222 runZoned(() { 230 runZoned(() {
223 new WebSocketVM(new WebSocketVMTarget(addr)).load() 231 new WebSocketVM(new WebSocketVMTarget(addr)).load()
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 /// return a [Future]. Code for setting up state can run before and/or 401 /// return a [Future]. Code for setting up state can run before and/or
394 /// concurrently with the tests. Uses [mainArgs] to determine whether 402 /// concurrently with the tests. Uses [mainArgs] to determine whether
395 /// to run tests or testee in this invokation of the script. 403 /// to run tests or testee in this invokation of the script.
396 Future runVMTests(List<String> mainArgs, 404 Future runVMTests(List<String> mainArgs,
397 List<VMTest> tests, 405 List<VMTest> tests,
398 {Future testeeBefore(), 406 {Future testeeBefore(),
399 Future testeeConcurrent(), 407 Future testeeConcurrent(),
400 bool pause_on_start: false, 408 bool pause_on_start: false,
401 bool pause_on_exit: false, 409 bool pause_on_exit: false,
402 bool trace_service: false, 410 bool trace_service: false,
411 bool trace_compiler: false,
403 bool verbose_vm: false, 412 bool verbose_vm: false,
404 bool pause_on_unhandled_exceptions: false}) async { 413 bool pause_on_unhandled_exceptions: false}) async {
405 if (mainArgs.contains(_TESTEE_MODE_FLAG)) { 414 if (mainArgs.contains(_TESTEE_MODE_FLAG)) {
406 if (!pause_on_start) { 415 if (!pause_on_start) {
407 if (testeeBefore != null) { 416 if (testeeBefore != null) {
408 await testeeBefore(); 417 await testeeBefore();
409 } 418 }
410 print(''); // Print blank line to signal that we are ready. 419 print(''); // Print blank line to signal that we are ready.
411 } 420 }
412 if (testeeConcurrent != null) { 421 if (testeeConcurrent != null) {
413 await testeeConcurrent(); 422 await testeeConcurrent();
414 } 423 }
415 if (!pause_on_exit) { 424 if (!pause_on_exit) {
416 // Wait around for the process to be killed. 425 // Wait around for the process to be killed.
417 stdin.first.then((_) => exit(0)); 426 stdin.first.then((_) => exit(0));
418 } 427 }
419 } else { 428 } else {
420 var process = new _TestLauncher(); 429 var process = new _TestLauncher();
421 process.launch(pause_on_start, 430 process.launch(pause_on_start,
422 pause_on_exit, 431 pause_on_exit,
423 pause_on_unhandled_exceptions, 432 pause_on_unhandled_exceptions,
424 trace_service).then((port) async { 433 trace_service, trace_compiler).then((port) async {
425 if (mainArgs.contains("--gdb")) { 434 if (mainArgs.contains("--gdb")) {
426 port = 8181; 435 port = 8181;
427 } 436 }
428 String addr = 'ws://localhost:$port/ws'; 437 String addr = 'ws://localhost:$port/ws';
429 serviceHttpAddress = 'http://localhost:$port'; 438 serviceHttpAddress = 'http://localhost:$port';
430 var testIndex = 1; 439 var testIndex = 1;
431 var totalTests = tests.length; 440 var totalTests = tests.length;
432 var name = Platform.script.pathSegments.last; 441 var name = Platform.script.pathSegments.last;
433 runZoned(() { 442 runZoned(() {
434 new WebSocketVM(new WebSocketVMTarget(addr)).load() 443 new WebSocketVM(new WebSocketVMTarget(addr)).load()
435 .then((VM vm) => Future.forEach(tests, (test) { 444 .then((VM vm) => Future.forEach(tests, (test) {
436 vm.verbose = verbose_vm; 445 vm.verbose = verbose_vm;
437 print('Running $name [$testIndex/$totalTests]'); 446 print('Running $name [$testIndex/$totalTests]');
438 testIndex++; 447 testIndex++;
439 return test(vm); 448 return test(vm);
440 })).then((_) => process.requestExit()); 449 })).then((_) => process.requestExit());
441 }, onError: (e, st) { 450 }, onError: (e, st) {
442 process.requestExit(); 451 process.requestExit();
443 if (!_isWebSocketDisconnect(e)) { 452 if (!_isWebSocketDisconnect(e)) {
444 print('Unexpected exception in service tests: $e $st'); 453 print('Unexpected exception in service tests: $e $st');
445 throw e; 454 throw e;
446 } 455 }
447 }); 456 });
448 }); 457 });
449 } 458 }
450 } 459 }
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/developer_extension_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698