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

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

Issue 2671603004: Remove a major source of flaky service test failures. (Closed)
Patch Set: 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
« no previous file with comments | « runtime/observatory/tests/service/service.status ('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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 List<String> extraArgs, 274 List<String> extraArgs,
275 List<VMTest> vmTests, 275 List<VMTest> vmTests,
276 List<IsolateTest> isolateTests, 276 List<IsolateTest> isolateTests,
277 bool pause_on_start: false, 277 bool pause_on_start: false,
278 bool pause_on_exit: false, 278 bool pause_on_exit: false,
279 bool verbose_vm: false, 279 bool verbose_vm: false,
280 bool pause_on_unhandled_exceptions: false, 280 bool pause_on_unhandled_exceptions: false,
281 bool testeeControlsServer: false, 281 bool testeeControlsServer: false,
282 bool useAuthToken: false}) { 282 bool useAuthToken: false}) {
283 var process = new _ServiceTesteeLauncher(); 283 var process = new _ServiceTesteeLauncher();
284 bool testsDone = false;
284 process.launch(pause_on_start, pause_on_exit, 285 process.launch(pause_on_start, pause_on_exit,
285 pause_on_unhandled_exceptions, 286 pause_on_unhandled_exceptions,
286 testeeControlsServer, 287 testeeControlsServer,
287 useAuthToken, extraArgs).then((Uri serverAddress) async { 288 useAuthToken, extraArgs).then((Uri serverAddress) async {
288 if (mainArgs.contains("--gdb")) { 289 if (mainArgs.contains("--gdb")) {
289 var pid = process.process.pid; 290 var pid = process.process.pid;
290 var wait = new Duration(seconds: 10); 291 var wait = new Duration(seconds: 10);
291 print("Testee has pid $pid, waiting $wait before continuing"); 292 print("Testee has pid $pid, waiting $wait before continuing");
292 sleep(wait); 293 sleep(wait);
293 } 294 }
(...skipping 24 matching lines...) Expand all
318 var testIndex = 1; 319 var testIndex = 1;
319 var totalTests = isolateTests.length; 320 var totalTests = isolateTests.length;
320 for (var test in isolateTests) { 321 for (var test in isolateTests) {
321 vm.verbose = verbose_vm; 322 vm.verbose = verbose_vm;
322 print('Running $name [$testIndex/$totalTests]'); 323 print('Running $name [$testIndex/$totalTests]');
323 testIndex++; 324 testIndex++;
324 await test(isolate); 325 await test(isolate);
325 } 326 }
326 } 327 }
327 328
329 print('All service tests completed successfully.');
330 testsDone = true;
328 await process.requestExit(); 331 await process.requestExit();
329 }, onError: (error, stackTrace) { 332 }, onError: (error, stackTrace) {
330 process.requestExit(); 333 if (testsDone) {
331 print('Unexpected exception in service tests: $error\n$stackTrace'); 334 print('Ignoring late exception during process exit:\n'
332 throw error; 335 '$error\n#stackTrace');
336 } else {
337 process.requestExit();
338 print('Unexpected exception in service tests: $error\n$stackTrace');
339 throw error;
340 }
333 }); 341 });
334 }); 342 });
335 } 343 }
336 } 344 }
337 345
338 /// Runs [tests] in sequence, each of which should take an [Isolate] and 346 /// Runs [tests] in sequence, each of which should take an [Isolate] and
339 /// return a [Future]. Code for setting up state can run before and/or 347 /// return a [Future]. Code for setting up state can run before and/or
340 /// concurrently with the tests. Uses [mainArgs] to determine whether 348 /// concurrently with the tests. Uses [mainArgs] to determine whether
341 /// to run tests or testee in this invokation of the script. 349 /// to run tests or testee in this invokation of the script.
342 Future runIsolateTests(List<String> mainArgs, 350 Future runIsolateTests(List<String> mainArgs,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 new _ServiceTesterRunner().run( 437 new _ServiceTesterRunner().run(
430 mainArgs: mainArgs, 438 mainArgs: mainArgs,
431 extraArgs: extraArgs, 439 extraArgs: extraArgs,
432 vmTests: tests, 440 vmTests: tests,
433 pause_on_start: pause_on_start, 441 pause_on_start: pause_on_start,
434 pause_on_exit: pause_on_exit, 442 pause_on_exit: pause_on_exit,
435 verbose_vm: verbose_vm, 443 verbose_vm: verbose_vm,
436 pause_on_unhandled_exceptions: pause_on_unhandled_exceptions); 444 pause_on_unhandled_exceptions: pause_on_unhandled_exceptions);
437 } 445 }
438 } 446 }
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/service.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698