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'], + ); +}