711e50389f
Doesn't change anything in `front_end/*testcases/primary_constructors/`. (Would have skipped any other file with `test` in its path and an explicit language version marker, but there weren't any outside of those `front_end` directories). Almost no files used as test input were affected, and none testing the actual syntax changed. The `.../nnbd/required_2.dart` test case was split into a legacy version retaining the `var`/`final` with a language marker, and a new version without the `var`/`final` cases. The `pkg/analyzer/` tests, and any other tests that have source code in strings, are not migrated by this CL. Tested: No change to behavior. One test split into legacy and new. Change-Id: I7f5aa4cc98001a9adecacd106c0b3be14f96be1c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480542 Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Nate Bosch <nbosch@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Lasse Nielsen <lrn@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
89 lines
2.5 KiB
Dart
89 lines
2.5 KiB
Dart
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
|
|
// 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.
|
|
|
|
import 'dart:async';
|
|
import 'dart:io';
|
|
|
|
import '../test/coverage_helper.dart';
|
|
import '../test/vm_service_helper.dart';
|
|
|
|
Uri? coverageUri;
|
|
|
|
Future<void> main(List<String> args) async {
|
|
String? coverage = Platform.environment["CFE_COVERAGE"];
|
|
if (coverage != null) {
|
|
coverageUri = Uri.base.resolveUri(Uri.file(coverage));
|
|
} else {
|
|
throw "Set coverage path via 'CFE_COVERAGE' environment!";
|
|
}
|
|
|
|
MyLaunchingVMServiceHelper launchingHelper = new MyLaunchingVMServiceHelper(
|
|
args,
|
|
);
|
|
await launchingHelper.start([
|
|
"--pause_isolates_on_exit",
|
|
"--disable-dart-dev",
|
|
...args,
|
|
], pauseIsolateOnStart: false);
|
|
await launchingHelper.exitCompleter.future;
|
|
}
|
|
|
|
class MyLaunchingVMServiceHelper extends LaunchingVMServiceHelper {
|
|
final List<String> args;
|
|
final Completer<int> exitCompleter = new Completer<int>();
|
|
|
|
MyLaunchingVMServiceHelper(this.args);
|
|
|
|
@override
|
|
void processExited(int code) {
|
|
exitCode = code;
|
|
exitCompleter.complete(code);
|
|
}
|
|
|
|
@override
|
|
Future<void> run() async {
|
|
// TODO(jensj): Get coverage for the isolate paused at exit, then resume
|
|
// that one, continue until there's no more isolates left.
|
|
// E.g. for pkg/front_end/tool/coverage_runner.dart.
|
|
await waitUntilSomeIsolatePausedAtExit();
|
|
|
|
Coverage? coverage = await collectCoverageWithHelper(
|
|
helper: this,
|
|
getKernelServiceCoverageToo: true,
|
|
displayName: args.join(" "),
|
|
);
|
|
if (coverage != null) {
|
|
File f = new File.fromUri(
|
|
coverageUri!.resolve(
|
|
"coverage_run_"
|
|
"${DateTime.now().microsecondsSinceEpoch}_"
|
|
"${process.pid}.coverage",
|
|
),
|
|
);
|
|
coverage.writeToFile(f);
|
|
}
|
|
|
|
await resumeAllIsolates();
|
|
try {
|
|
while (true) {
|
|
VM vm = await serviceClient.getVM();
|
|
List<IsolateRef> isolates = vm.isolates!;
|
|
if (isolates.isEmpty) break;
|
|
for (IsolateRef isolate in isolates) {
|
|
try {
|
|
if (await isPaused(isolate.id!) == true) {
|
|
await serviceClient.resume(isolate.id!);
|
|
}
|
|
} catch (e) {
|
|
// It might exit at some point so we can't expect to get
|
|
// a good result.
|
|
}
|
|
}
|
|
}
|
|
} catch (e) {
|
|
// Assume this is a good thing.
|
|
}
|
|
}
|
|
}
|