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

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

Issue 2680303002: Kernel debugging; service tests (Closed)
Patch Set: New failing test 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/service/test_helper.dart
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart
index 58162431f0d13324955ed65fed1273f799f9e5c1..b7a98b8c71134112c53dca4858584af4f6a4f85a 100644
--- a/runtime/observatory/tests/service/test_helper.dart
+++ b/runtime/observatory/tests/service/test_helper.dart
@@ -315,7 +315,7 @@ class _ServiceTesterRunner {
// Run isolate tests.
if (isolateTests != null) {
- var isolate = await vm.isolates.first.load();
+ var isolate = await getIsolate(vm);
var testIndex = 1;
var totalTests = isolateTests.length;
for (var test in isolateTests) {
@@ -341,6 +341,52 @@ class _ServiceTesterRunner {
});
});
}
+
+
+
+ // This is a copy-in of https://codereview.chromium.org/2670303003/
+ // --- hopefully either that will be accepted, or we'll find some other solution
+ Future<Isolate> getIsolate(WebSocketVM vm) async {
+ if (vm.isolates.isNotEmpty) {
+ var isolate = await vm.isolates.first.load();
+ if (isolate is Isolate) {
+ return isolate;
+ }
+ }
+
+ Completer completer = new Completer();
+ vm.getEventStream(VM.kIsolateStream).then((stream) {
+ var subscription;
+ subscription = stream.listen((ServiceEvent event) async {
+ if (completer == null) {
+ subscription.cancel();
+ return;
+ }
+ if (event.kind == ServiceEvent.kIsolateRunnable) {
+ if (vm.isolates.isNotEmpty) {
+ vm.isolates.first.load().then((result) {
+ if (result is Isolate) {
+ subscription.cancel();
+ completer.complete(result);
+ completer = null;
+ }
+ });
+ }
+ }
+ });
+ });
+
+ // The isolate may have started before we subscribed.
+ if (vm.isolates.isNotEmpty) {
+ vm.isolates.first.reload().then((result) async {
+ if (completer != null && result is Isolate) {
+ completer.complete(result);
+ completer = null;
+ }
+ });
+ }
+ return await completer.future;
+ }
}
/// Runs [tests] in sequence, each of which should take an [Isolate] and
@@ -444,3 +490,8 @@ Future runVMTests(List<String> mainArgs,
pause_on_unhandled_exceptions: pause_on_unhandled_exceptions);
}
}
+
+/// Whether we're running from kernel.
+bool isKernel(Isolate isolate) {
+ return isolate.name.contains(r".dill$");
+}

Powered by Google App Engine
This is Rietveld 408576698