[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 <bkonyi@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
Alexander Aprelev 2021-08-31 23:05:56 +00:00 committed by commit-bot@chromium.org
parent d660f12460
commit 8d792c35f4

View file

@ -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<void>(foo, null);
print('started system isolate main');
while (true) {}
await Isolate.spawnUri(Platform.script, ['--selftest'], null,
debugName: 'foo');
}
var tests = <VMTest>[
(service.VmService service) async {
var tests = <IsolateTest>[
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 <String>[]]) => runVMTests(
args,
tests,
'mark_main_isolate_as_system_isolate_test.dart',
testeeConcurrent: testMain,
extraArgs: ['--mark-main-isolate-as-system-isolate'],
);
main([args = const <String>[]]) {
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'],
);
}