Skip to content

Commit f7e3c62

Browse files
mkustermannCommit Queue
authored and
Commit Queue
committed
[gardening] Fix vm/dart/run_appended_aot_snapshot_test
The change in [0] broke the test due to some refactorings in `package:dart2native`. As the test isn't run from a Dart SDK but rather from the files in the build folder, it cannot use the methods from `package:dart2native` which now relies on being run from the Dart SDK. [0] https://dart-review.googlesource.com/c/sdk/+/349280 TEST=Fixes vm/dart/run_appended_aot_snapshot_test Change-Id: I74ff86f49a4fb790b407358b6493de003a89c926 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350820 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Tess Strickland <[email protected]>
1 parent 967dfe6 commit f7e3c62

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

runtime/tests/vm/dart/run_appended_aot_snapshot_test.dart

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import 'dart:async';
66
import 'dart:io';
77

8-
import 'package:dart2native/dart2native.dart';
8+
import 'package:dart2native/dart2native.dart' hide platformDill, genSnapshot;
99
import 'package:path/path.dart' as path;
1010
import 'package:expect/expect.dart';
1111

@@ -33,8 +33,8 @@ Future<void> main(List<String> args) async {
3333
.toList();
3434

3535
{
36-
final result = await generateAotKernel(checkedInDartVM, genKernelDart,
37-
platformDill, sourcePath, dillPath, null, [],
36+
final result = await generateAotKernel(
37+
checkedInDartVM, genKernelDart, platformDill, sourcePath, dillPath,
3838
extraGenKernelOptions: extraGenKernelOptions);
3939
Expect.equals(result.stderr, '');
4040
Expect.equals(result.stdout, '');
@@ -43,7 +43,7 @@ Future<void> main(List<String> args) async {
4343

4444
{
4545
final result =
46-
await generateAotSnapshot(genSnapshot, dillPath, aotPath, null, []);
46+
await generateAotSnapshotHelper(genSnapshot, dillPath, aotPath);
4747
Expect.equals(result.stderr, '');
4848
Expect.equals(result.stdout, '');
4949
Expect.equals(result.exitCode, 0);
@@ -88,3 +88,30 @@ Future<void> main(List<String> args) async {
8888
}
8989
});
9090
}
91+
92+
Future generateAotKernel(
93+
String dart,
94+
String genKernel,
95+
String platformDill,
96+
String sourceFile,
97+
String kernelFile, {
98+
List<String> extraGenKernelOptions = const [],
99+
}) async {
100+
return Process.run(dart, [
101+
genKernel,
102+
'--platform',
103+
platformDill,
104+
'--aot',
105+
'-Ddart.vm.product=true',
106+
'-o',
107+
kernelFile,
108+
...extraGenKernelOptions,
109+
sourceFile
110+
]);
111+
}
112+
113+
Future<ProcessResult> generateAotSnapshotHelper(
114+
String genSnapshot, String kernelFile, String snapshotFile) {
115+
return Process.run(genSnapshot,
116+
['--snapshot-kind=app-aot-elf', '--elf=$snapshotFile', kernelFile]);
117+
}

0 commit comments

Comments
 (0)