From 8d792c35f48d026125f0e22c2f55018e4e7e969d Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Tue, 31 Aug 2021 23:05:56 +0000 Subject: [PATCH] [vm/enable_isolate_groups] Fix mark_main_isolate_as_system_isolate_test so it works as expected with '--enable-isolate-groups' option. `--mark-main-isolate-as-system-isolate` option affects all isolates in the main isolate group. The test had to be adjusted so it verifies that isolates in new isolate groups remain non-system in presence of this option. This is follow-up to https://dart-review.googlesource.com/c/sdk/+/207203 TEST=mark_main_isolate_as_system_isolate_test Change-Id: I74d94accab2094311a1067ca3853fd4e19d9c67f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212030 Reviewed-by: Ben Konyi Commit-Queue: Alexander Aprelev --- ...k_main_isolate_as_system_isolate_test.dart | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/pkg/vm_service/test/mark_main_isolate_as_system_isolate_test.dart b/pkg/vm_service/test/mark_main_isolate_as_system_isolate_test.dart index c69323d1be8..fb97b827892 100644 --- a/pkg/vm_service/test/mark_main_isolate_as_system_isolate_test.dart +++ b/pkg/vm_service/test/mark_main_isolate_as_system_isolate_test.dart @@ -2,6 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// VMOptions=--enable-isolate-groups +// VMOptions=--no-enable-isolate-groups + +import 'dart:developer'; +import 'dart:io'; import 'dart:isolate'; import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart' as service; @@ -9,31 +14,33 @@ import 'package:vm_service/vm_service.dart' as service; import 'common/service_test_common.dart'; import 'common/test_helper.dart'; -foo(void _) async { - print('non system isolate started'); - while (true) {} -} - testMain() async { - await Isolate.spawn(foo, null); - print('started system isolate main'); - while (true) {} + await Isolate.spawnUri(Platform.script, ['--selftest'], null, + debugName: 'foo'); } -var tests = [ - (service.VmService service) async { +var tests = [ + hasStoppedAtBreakpoint, + (service.VmService service, _) async { final vm = await service.getVM(); expect(vm.isolates!.length, 1); expect(vm.isolates!.first.name, 'foo'); expect(vm.systemIsolates!.length, greaterThanOrEqualTo(1)); expect(vm.systemIsolates!.where((e) => e.name == 'main').isNotEmpty, true); - } + }, + resumeIsolate, ]; -main([args = const []]) => runVMTests( - args, - tests, - 'mark_main_isolate_as_system_isolate_test.dart', - testeeConcurrent: testMain, - extraArgs: ['--mark-main-isolate-as-system-isolate'], - ); +main([args = const []]) { + if (args.length > 0 && args[0] == '--selftest') { + debugger(); + return; + } + return runIsolateTests( + args, + tests, + 'mark_main_isolate_as_system_isolate_test.dart', + testeeConcurrent: testMain, + extraArgs: ['--mark-main-isolate-as-system-isolate'], + ); +}