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

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

Issue 1320693002: Adding debugging output to flaky tests to help diagnose problems on the bots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | runtime/observatory/tests/service/pause_on_start_then_step_test.dart » ('j') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 'package:observatory/service_io.dart'; 6 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'test_helper.dart'; 8 import 'test_helper.dart';
9 import 'dart:async'; 9 import 'dart:async';
10 10
11 void testMain() { 11 void testMain() {
12 print('Hello'); 12 print('Hello');
13 } 13 }
14 14
15 var tests = [ 15 var tests = [
16 16
17 (Isolate isolate) async { 17 (Isolate isolate) async {
18 print('Getting stream...');
18 Completer completer = new Completer(); 19 Completer completer = new Completer();
19 var stream = await isolate.vm.getEventStream(VM.kDebugStream); 20 var stream = await isolate.vm.getEventStream(VM.kDebugStream);
21 print('Subscribing...');
20 var subscription; 22 var subscription;
21 subscription = stream.listen((ServiceEvent event) { 23 subscription = stream.listen((ServiceEvent event) {
22 if (event.kind == ServiceEvent.kPauseStart) { 24 if (event.kind == ServiceEvent.kPauseStart) {
23 print('Received PauseStart'); 25 print('Received $event');
24 subscription.cancel(); 26 subscription.cancel();
25 completer.complete(); 27 completer.complete();
28 } else {
29 print('Ignoring event $event');
26 } 30 }
27 }); 31 });
32 print('Subscribed. Pause event is ${isolate.pauseEvent}');
28 33
29 if (isolate.pauseEvent != null && 34 if (isolate.pauseEvent != null &&
30 isolate.pauseEvent.kind == ServiceEvent.kPauseStart) { 35 isolate.pauseEvent.kind == ServiceEvent.kPauseStart) {
31 // Wait for the isolate to hit PauseStart. 36 // Wait for the isolate to hit PauseStart.
32 subscription.cancel(); 37 subscription.cancel();
38 print('Subscription cancelled.');
33 } else { 39 } else {
40 print('Waiting for pause start event.');
34 await completer.future; 41 await completer.future;
35 } 42 }
43 print('Done waiting for pause event.');
36 44
37 // Grab the timestamp. 45 // Grab the timestamp.
38 var pausetime1 = isolate.pauseEvent.timestamp; 46 var pausetime1 = isolate.pauseEvent.timestamp;
39 expect(pausetime1, isNotNull); 47 expect(pausetime1, isNotNull);
40 // Reload the isolate. 48 // Reload the isolate.
41 await isolate.reload(); 49 await isolate.reload();
42 // Verify that it is the same. 50 // Verify that it is the same.
43 expect(pausetime1.millisecondsSinceEpoch, 51 expect(pausetime1.millisecondsSinceEpoch,
44 equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch)); 52 equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
45 53
(...skipping 23 matching lines...) Expand all
69 equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch)); 77 equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
70 expect(pausetime2.millisecondsSinceEpoch, 78 expect(pausetime2.millisecondsSinceEpoch,
71 greaterThan(pausetime1.millisecondsSinceEpoch)); 79 greaterThan(pausetime1.millisecondsSinceEpoch));
72 }, 80 },
73 81
74 ]; 82 ];
75 83
76 main(args) => runIsolateTests(args, tests, 84 main(args) => runIsolateTests(args, tests,
77 testeeConcurrent: testMain, 85 testeeConcurrent: testMain,
78 pause_on_start: true, pause_on_exit: true); 86 pause_on_start: true, pause_on_exit: true);
OLDNEW
« no previous file with comments | « no previous file | runtime/observatory/tests/service/pause_on_start_then_step_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698