mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:27:39 +00:00
[vm/tests] Fix vm/dart/disassemble_aot_test.
Bug: https://github.com/dart-lang/sdk/issues/46143 Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try Change-Id: I2fa01046030471266c04b233adbd0016ec67ea82 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201270 Commit-Queue: Tess Strickland <sstrickl@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
parent
57e467b6ee
commit
45b51f9ab6
|
@ -1,8 +1,11 @@
|
|||
// Copyright (c) 2021, 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.
|
||||
|
||||
//
|
||||
// OtherResources=use_dwarf_stack_traces_flag_program.dart
|
||||
//
|
||||
// Tests proper object recognition in disassembler.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
|
@ -12,25 +15,41 @@ import 'package:path/path.dart' as path;
|
|||
import 'use_flag_test_helper.dart';
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
if (Platform.isAndroid) {
|
||||
return; // SDK tree and gen_snapshot not available on the test device.
|
||||
if (!isAOTRuntime) {
|
||||
return; // Running in JIT: AOT binaries not available.
|
||||
}
|
||||
|
||||
final buildDir = path.dirname(Platform.executable);
|
||||
final sdkDir = path.dirname(path.dirname(buildDir));
|
||||
final platformDill = path.join(buildDir, 'vm_platform_strong.dill');
|
||||
final genSnapshot = path.join(buildDir, 'gen_snapshot');
|
||||
if (const bool.fromEnvironment('dart.vm.product')) {
|
||||
return; // No disassembling in PRODUCT mode.
|
||||
}
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
return; // SDK tree and dart_bootstrap not available on the test device.
|
||||
}
|
||||
|
||||
// These are the tools we need to be available to run on a given platform:
|
||||
if (!await testExecutable(genSnapshot)) {
|
||||
throw "Cannot run test as $genSnapshot not available";
|
||||
}
|
||||
if (!await testExecutable(aotRuntime)) {
|
||||
throw "Cannot run test as $aotRuntime not available";
|
||||
}
|
||||
if (!File(platformDill).existsSync()) {
|
||||
throw "Cannot run test as $platformDill does not exist";
|
||||
}
|
||||
|
||||
await withTempDir('disassemble_aot', (String tempDir) async {
|
||||
final cwDir = path.dirname(Platform.script.toFilePath());
|
||||
final script = path.join(cwDir, 'use_dwarf_stack_traces_flag_program.dart');
|
||||
final scriptDill = path.join(tempDir, 'out.dill');
|
||||
|
||||
// Compile script to Kernel IR.
|
||||
await run('pkg/vm/tool/gen_kernel', <String>[
|
||||
await run(genKernel, <String>[
|
||||
'--aot',
|
||||
'--platform=$platformDill',
|
||||
'-o',
|
||||
scriptDill,
|
||||
Platform.script.toString(),
|
||||
script,
|
||||
]);
|
||||
|
||||
// Run the AOT compiler with the disassemble flags set.
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
// Copyright (c) 2021, 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.
|
||||
|
||||
//
|
||||
// OtherResources=use_dwarf_stack_traces_flag_program.dart
|
||||
//
|
||||
// Tests proper object recognition in disassembler.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
|
@ -12,25 +15,41 @@ import 'package:path/path.dart' as path;
|
|||
import 'use_flag_test_helper.dart';
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
if (Platform.isAndroid) {
|
||||
return; // SDK tree and gen_snapshot not available on the test device.
|
||||
if (!isAOTRuntime) {
|
||||
return; // Running in JIT: AOT binaries not available.
|
||||
}
|
||||
|
||||
final buildDir = path.dirname(Platform.executable);
|
||||
final sdkDir = path.dirname(path.dirname(buildDir));
|
||||
final platformDill = path.join(buildDir, 'vm_platform_strong.dill');
|
||||
final genSnapshot = path.join(buildDir, 'gen_snapshot');
|
||||
if (const bool.fromEnvironment('dart.vm.product')) {
|
||||
return; // No disassembling in PRODUCT mode.
|
||||
}
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
return; // SDK tree and dart_bootstrap not available on the test device.
|
||||
}
|
||||
|
||||
// These are the tools we need to be available to run on a given platform:
|
||||
if (!await testExecutable(genSnapshot)) {
|
||||
throw "Cannot run test as $genSnapshot not available";
|
||||
}
|
||||
if (!await testExecutable(aotRuntime)) {
|
||||
throw "Cannot run test as $aotRuntime not available";
|
||||
}
|
||||
if (!File(platformDill).existsSync()) {
|
||||
throw "Cannot run test as $platformDill does not exist";
|
||||
}
|
||||
|
||||
await withTempDir('disassemble_aot', (String tempDir) async {
|
||||
final cwDir = path.dirname(Platform.script.toFilePath());
|
||||
final script = path.join(cwDir, 'use_dwarf_stack_traces_flag_program.dart');
|
||||
final scriptDill = path.join(tempDir, 'out.dill');
|
||||
|
||||
// Compile script to Kernel IR.
|
||||
await run('pkg/vm/tool/gen_kernel', <String>[
|
||||
await run(genKernel, <String>[
|
||||
'--aot',
|
||||
'--platform=$platformDill',
|
||||
'-o',
|
||||
scriptDill,
|
||||
Platform.script.toString(),
|
||||
script,
|
||||
]);
|
||||
|
||||
// Run the AOT compiler with the disassemble flags set.
|
||||
|
|
Loading…
Reference in a new issue