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

Unified Diff: runtime/observatory/tests/service/pause_idle_isolate_test.dart

Issue 1344993002: Refactor isolate interrupts to use OOB messages instead of interrupt bits. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code review 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/lib/src/elements/debugger.dart ('k') | runtime/vm/code_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/pause_idle_isolate_test.dart
diff --git a/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart b/runtime/observatory/tests/service/pause_idle_isolate_test.dart
similarity index 56%
copy from runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
copy to runtime/observatory/tests/service/pause_idle_isolate_test.dart
index 93444d0a03b0e1e7ee386763c553185477cd1704..af0cc49220ffb2afa66df64d02f5c5113c244800 100644
--- a/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
+++ b/runtime/observatory/tests/service/pause_idle_isolate_test.dart
@@ -7,76 +7,68 @@ import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
import 'dart:async';
+import 'dart:io';
+import 'dart:isolate';
+
+var receivePort;
void testMain() {
- print('Hello');
+ receivePort = new ReceivePort();
}
var tests = [
(Isolate isolate) async {
- print('Getting stream...');
Completer completer = new Completer();
var stream = await isolate.vm.getEventStream(VM.kDebugStream);
- print('Subscribing...');
var subscription;
subscription = stream.listen((ServiceEvent event) {
if (event.kind == ServiceEvent.kPauseStart) {
print('Received $event');
subscription.cancel();
completer.complete();
- } else {
- print('Ignoring event $event');
}
});
- print('Subscribed. Pause event is ${isolate.pauseEvent}');
if (isolate.pauseEvent != null &&
isolate.pauseEvent.kind == ServiceEvent.kPauseStart) {
// Wait for the isolate to hit PauseStart.
subscription.cancel();
- print('Subscription cancelled.');
} else {
- print('Waiting for pause start event.');
await completer.future;
}
print('Done waiting for pause event.');
- // Grab the timestamp.
- var pausetime1 = isolate.pauseEvent.timestamp;
- expect(pausetime1, isNotNull);
- // Reload the isolate.
- await isolate.reload();
- // Verify that it is the same.
- expect(pausetime1.millisecondsSinceEpoch,
- equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
-
+ // Wait for the isolate to pause due to interruption.
completer = new Completer();
stream = await isolate.vm.getEventStream(VM.kDebugStream);
+ bool receivedInterrupt = false;
subscription = stream.listen((ServiceEvent event) {
- if (event.kind == ServiceEvent.kPauseExit) {
- print('Received PauseExit');
+ print('Received $event');
+ if (event.kind == ServiceEvent.kPauseInterrupted) {
+ receivedInterrupt = true;
subscription.cancel();
completer.complete();
}
});
- print('Resuming...');
- isolate.resume();
+ await isolate.resume();
- // Wait for the isolate to hit PauseExit.
- await completer.future;
+ // Wait for the isolate to become idle. We detect this by querying
+ // the stack until it becomes empty.
+ var frameCount;
+ do {
+ var stack = await isolate.getStack();
+ frameCount = stack['frames'].length;
+ print('frames: $frameCount');
+ sleep(const Duration(milliseconds:10));
+ } while (frameCount > 0);
- // Grab the timestamp.
- var pausetime2 = isolate.pauseEvent.timestamp;
- expect(pausetime2, isNotNull);
- // Reload the isolate.
- await isolate.reload();
- // Verify that it is the same.
- expect(pausetime2.millisecondsSinceEpoch,
- equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
- expect(pausetime2.millisecondsSinceEpoch,
- greaterThan(pausetime1.millisecondsSinceEpoch));
+ // Make sure that the isolate receives an interrupt even when it is
+ // idle. (https://github.com/dart-lang/sdk/issues/24349)
+ await isolate.pause();
+ await completer.future;
+ expect(receivedInterrupt, isTrue);
},
];
@@ -84,6 +76,5 @@ var tests = [
main(args) => runIsolateTests(args, tests,
testeeConcurrent: testMain,
pause_on_start: true,
- pause_on_exit: true,
trace_service: true,
verbose_vm: true);
« no previous file with comments | « runtime/observatory/lib/src/elements/debugger.dart ('k') | runtime/vm/code_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698