Files
sdk/pkg/front_end/test/web_parser_git_test.dart
T
Paul Berry d810c7d0c0 [front_end] Bump language version to 3.9 and reformat.
This commit was generated by the following steps:

- Manually change the SDK constraint in `pkg/front_end/pubspec.yaml`

- Run `gclient sync`

- Run `find pkg/front_end/benchmarks pkg/front_end/lib
  pkg/front_end/presubmit_helper.dart
  pkg/front_end/presubmit_helper_spawn.dart pkg/front_end/test
  pkg/front_end/tool -iname '*.dart' | xargs
  tools/sdks/dart-sdk/bin/dart format`

- Manually fix remaining long lines and add dead code ignore comments.

- Fix coverage by running `dart --enable-asserts
  pkg/front_end/test/coverage_suite.dart --tasks=5
  --add-and-remove-comments`

- Fix `pkg/front_end/test/coverage_merger/assert_message_auto_ignored`
  by running `dart pkg/front_end/test/unit_test_suites.dart -p
  pkg/front_end/test/coverage_merger/assert_message_auto_ignored
  -DupdateExpectations=true`

The diff is large because the version bump causes the formatter to
switch into "tall mode".

Change-Id: I6a6a696410da8b168060acfe0e4d6e91e294c4f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447628
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-08-29 07:31:41 -07:00

76 lines
2.1 KiB
Dart

// Copyright (c) 2022, 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:ffi';
import 'dart:io';
import "utils/io_utils.dart";
void main(List<String> args) {
Uri dart = repoDir.resolve(
"tools/sdks/dart-sdk/bin/dart${Platform.isWindows ? ".exe" : ""}",
);
if (!new File.fromUri(dart).existsSync()) {
throw "Couldn't find $dart executable.";
}
Uri d8 = repoDir.resolve(_d8executable);
if (!new File.fromUri(d8).existsSync()) {
throw "Couldn't find $d8 executable.";
}
Uri fileHelper = repoDir.resolve(
"pkg/front_end/test/web_parser_git_test_helper.dart",
);
if (!new File.fromUri(fileHelper).existsSync()) {
throw "Couldn't find $fileHelper file.";
}
Directory tempDir = Directory.systemTemp.createTempSync("web_parser_test");
try {
Uri outFile = tempDir.uri.resolve("out.js");
ProcessResult dartRun = Process.runSync(dart.toFilePath(), [
"compile",
"js",
"--output",
outFile.toFilePath(),
"--enable-asserts",
fileHelper.toFilePath(),
]);
if (dartRun.exitCode != 0) {
throw "---\n"
"Dart run returned ${dartRun.exitCode}.\n"
"stdout: ${dartRun.stdout}\n\n"
"stderr: ${dartRun.stderr}"
"---";
}
ProcessResult d8Run = Process.runSync(d8.toFilePath(), [
outFile.toFilePath(),
]);
if (d8Run.exitCode != 0) {
throw "---\n"
"D8 run returned ${d8Run.exitCode}.\n"
"stdout: ${d8Run.stdout}\n\n"
"stderr: ${d8Run.stderr}\n"
"---";
}
} finally {
tempDir.deleteSync(recursive: true);
}
}
final Uri repoDir = computeRepoDirUri();
String get _d8executable {
final arch = Abi.current().toString().split('_')[1];
if (Platform.isWindows) {
return 'third_party/d8/windows/$arch/d8.exe';
} else if (Platform.isLinux) {
return 'third_party/d8/linux/$arch/d8';
} else if (Platform.isMacOS) {
return 'third_party/d8/macos/$arch/d8';
}
throw UnsupportedError('Unsupported platform.');
}