[gardening] Fix pkg/vm/test/unlinked_ast_to_text_test & ensure it runs on bots

The pkg/vm/test/unlinked_ast_to_text_test test is run on bots like this

  tools/test.py -n unittest-asserts-release-linux \
        pkg/vm/test/unlinked_ast_to_text_test

This uses the dart binary from the just-built dart-sdk instead of normal
out/ReleaseX64/ folder. This led to the test return early without
testing anything.

Running locally `test.py` in other configurations on pkg shows that the
test is actually failing.

We fix the test and also ensure it runs on the only config that CI runs
(namely 'unittest-asserts-release-linux').

TEST=Fixes pkg/vm/test/unlinked_ast_to_text_test

Change-Id: If675e7ae1d9276f321234e0ce90d61724b64a5c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284180
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Martin Kustermann
2023-02-20 11:28:58 +00:00
committed by Commit Queue
parent cb9f1c5805
commit 789971863e
+13 -6
View File
@@ -21,15 +21,22 @@ main() async {
outDir.uri.resolve("dart2js.dart.unlinked dill.txt").toFilePath();
final executable = Platform.executable;
if (!executable.endsWith('out/ReleaseX64/dart')) {
late final String platformDill;
if (executable.endsWith('ReleaseX64/dart')) {
platformDill =
Uri.parse(executable).resolve('vm_platform_strong.dill').toFilePath();
} else if (executable.endsWith('dart-sdk/bin/dart')) {
platformDill = Uri.parse(executable)
.resolve('../lib/_internal/vm_platform_strong.dill')
.toFilePath();
} else {
print(
'Skipping test due to not being run .../ReleaseX64/dart or .../dart-sdk/bin/dart.');
return;
}
final platformDill = Uri.parse(executable).resolve('vm_platform.dill');
try {
final arguments = <String>[
'--no-link-platform',
'--platform=$platformDill',
'--output=$dillFile',
'pkg/compiler/lib/src/dart2js.dart',
@@ -43,8 +50,8 @@ main() async {
// Load the dart2js.dart.dill and write the unlinked version.
final component = loadComponentFromBinary(dillFile);
final IOSink sink = new File(unlinkedDillFile).openWrite();
final printer = new BinaryPrinter(sink,
final sink = File(unlinkedDillFile).openWrite();
final printer = BinaryPrinter(sink,
libraryFilter: (lib) => !lib.importUri.isScheme('dart'));
printer.writeComponentFile(component);
await sink.close();