1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-03 00:08:46 +00:00

[test] Run FFI tests on Fuchsia ARM64.

- Compile tests to kernel and use that instead of source for the Fuchsia test package.
 - Skip multitests instead of the running them and approving the failures.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: Idd9bef0f6026c6d882712eb1083e88433bb53b13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333121
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2024-04-30 17:37:45 +00:00 committed by Commit Queue
parent 6cb80c2e0c
commit d42a4b7219
8 changed files with 205 additions and 74 deletions

188
BUILD.gn
View File

@ -169,6 +169,182 @@ group("compressed_observatory_archive") {
if (is_fuchsia) {
import("third_party/fuchsia/gn-sdk/src/component.gni")
import("third_party/fuchsia/gn-sdk/src/package.gni")
import("utils/application_snapshot.gni")
# tests/ffi/**_test.dart except those with compile-time errors
test_sources = [
"tests/ffi/abi_specific_int_incomplete_aot_test.dart",
"tests/ffi/abi_specific_int_incomplete_jit_test.dart",
"tests/ffi/abi_specific_int_test.dart",
"tests/ffi/abi_test.dart",
"tests/ffi/address_of_array_generated_test.dart",
"tests/ffi/address_of_struct_generated_test.dart",
"tests/ffi/address_of_test.dart",
"tests/ffi/address_of_typeddata_generated_test.dart",
"tests/ffi/aliasing_test.dart",
"tests/ffi/allocator_test.dart",
"tests/ffi/async_void_function_callbacks_test.dart",
"tests/ffi/bool_test.dart",
"tests/ffi/c_types_test.dart",
"tests/ffi/callback_unwind_error_test.dart",
"tests/ffi/calloc_test.dart",
"tests/ffi/data_not_asan_test.dart",
"tests/ffi/data_test.dart",
"tests/ffi/deeply_immutable_c_api_finalizer_test.dart",
"tests/ffi/dl_api_exit_enter_isolate_test.dart",
"tests/ffi/dylib_close_test.dart",
"tests/ffi/dylib_isolates_test.dart",
"tests/ffi/dylib_open_test.dart",
"tests/ffi/expando_test.dart",
"tests/ffi/extension_methods_test.dart",
"tests/ffi/external_typed_data_finalizer_test.dart",
"tests/ffi/external_typed_data_test.dart",
"tests/ffi/ffi_callback_unique_test.dart",
"tests/ffi/ffi_induce_a_crash_test.dart",
"tests/ffi/ffi_native_test.dart",
"tests/ffi/finalizer_external_size_accounting_test.dart",
"tests/ffi/function_callbacks_many_test.dart",
"tests/ffi/function_callbacks_structs_by_value_generated_test.dart",
"tests/ffi/function_callbacks_structs_by_value_native_callable_generated_test.dart",
"tests/ffi/function_callbacks_structs_by_value_test.dart",
"tests/ffi/function_callbacks_subtype_test.dart",
"tests/ffi/function_callbacks_test.dart",
"tests/ffi/function_callbacks_varargs_generated_test.dart",
"tests/ffi/function_callbacks_varargs_native_callable_generated_test.dart",
"tests/ffi/function_callbacks_very_many_test.dart",
"tests/ffi/function_struct_by_value_out_of_bounds_test.dart",
"tests/ffi/function_structs_by_value_generated_args_leaf_test.dart",
"tests/ffi/function_structs_by_value_generated_args_native_leaf_test.dart",
"tests/ffi/function_structs_by_value_generated_args_native_test.dart",
"tests/ffi/function_structs_by_value_generated_args_test.dart",
"tests/ffi/function_structs_by_value_generated_ret_arg_leaf_test.dart",
"tests/ffi/function_structs_by_value_generated_ret_arg_native_leaf_test.dart",
"tests/ffi/function_structs_by_value_generated_ret_arg_native_test.dart",
"tests/ffi/function_structs_by_value_generated_ret_arg_test.dart",
"tests/ffi/function_structs_by_value_generated_ret_leaf_test.dart",
"tests/ffi/function_structs_by_value_generated_ret_native_leaf_test.dart",
"tests/ffi/function_structs_by_value_generated_ret_native_test.dart",
"tests/ffi/function_structs_by_value_generated_ret_test.dart",
"tests/ffi/function_structs_test.dart",
"tests/ffi/function_test.dart",
"tests/ffi/function_varargs_generated_leaf_test.dart",
"tests/ffi/function_varargs_generated_native_leaf_test.dart",
"tests/ffi/function_varargs_generated_native_test.dart",
"tests/ffi/function_varargs_generated_test.dart",
"tests/ffi/function_varargs_name_test.dart",
"tests/ffi/function_varargs_test.dart",
"tests/ffi/function_very_many_test.dart",
"tests/ffi/hardfp_test.dart",
"tests/ffi/has_symbol_test.dart",
"tests/ffi/inline_array_multi_dimensional_test.dart",
"tests/ffi/inline_array_test.dart",
"tests/ffi/invoke_callback_after_suspension_test.dart",
"tests/ffi/isolate_local_function_callbacks_test.dart",
"tests/ffi/msan_test.dart",
"tests/ffi/native_assets/asset_absolute_test.dart",
"tests/ffi/native_assets/asset_executable_test.dart",
"tests/ffi/native_assets/asset_library_annotation_test.dart",
"tests/ffi/native_assets/asset_process_test.dart",
"tests/ffi/native_assets/asset_relative_test.dart",
"tests/ffi/native_assets/asset_system_test.dart",
"tests/ffi/native_assets/infer_native_assets_yaml_dart_kernel_snapshot_test.dart",
"tests/ffi/native_assets/infer_native_assets_yaml_isolate_spawnuri_2_test.dart",
"tests/ffi/native_assets/infer_native_assets_yaml_isolate_spawnuri_3_test.dart",
"tests/ffi/native_assets/infer_native_assets_yaml_isolate_spawnuri_test.dart",
"tests/ffi/native_assets/infer_native_assets_yaml_process_run_test.dart",
"tests/ffi/native_assets/process_test.dart",
"tests/ffi/native_callables_async_structs_by_value_generated_test.dart",
"tests/ffi/native_callables_sync_structs_by_value_generated_test.dart",
"tests/ffi/native_effect_test.dart",
"tests/ffi/negative_function_test.dart",
"tests/ffi/pointer_arithmetic_operators_test.dart",
"tests/ffi/regress_37254_test.dart",
"tests/ffi/regress_39044_test.dart",
"tests/ffi/regress_39063_test.dart",
"tests/ffi/regress_39885_test.dart",
"tests/ffi/regress_40537_test.dart",
"tests/ffi/regress_43016_test.dart",
"tests/ffi/regress_43693_test.dart",
"tests/ffi/regress_45189_test.dart",
"tests/ffi/regress_45198_test.dart",
"tests/ffi/regress_45507_test.dart",
"tests/ffi/regress_45988_test.dart",
"tests/ffi/regress_46004_test.dart",
"tests/ffi/regress_46127_test.dart",
"tests/ffi/regress_47594_test.dart",
"tests/ffi/regress_47673_test.dart",
"tests/ffi/regress_49402_test.dart",
"tests/ffi/regress_49684_test.dart",
"tests/ffi/regress_51315_test.dart",
"tests/ffi/regress_51321_test.dart",
"tests/ffi/regress_51504_test.dart",
"tests/ffi/regress_51538_2_test.dart",
"tests/ffi/regress_51538_3_test.dart",
"tests/ffi/regress_51538_test.dart",
"tests/ffi/regress_52298_test.dart",
"tests/ffi/regress_52399_test.dart",
"tests/ffi/regress_b_261224444_test.dart",
"tests/ffi/regress_flutter79441_test.dart",
"tests/ffi/regress_flutter97301_test.dart",
"tests/ffi/regress_jump_to_frame_test.dart",
"tests/ffi/sizeof_test.dart",
"tests/ffi/snapshot_test.dart",
"tests/ffi/stacktrace_regress_37910_test.dart",
"tests/ffi/structs_nested_test.dart",
"tests/ffi/structs_nnbd_workaround_test.dart",
"tests/ffi/structs_packed_test.dart",
"tests/ffi/structs_test.dart",
"tests/ffi/structs_typed_data_test.dart",
"tests/ffi/unaligned_test.dart",
"tests/ffi/variance_function_test.dart",
"tests/ffi/vmspecific_deprecated_funcs_test.dart",
"tests/ffi/vmspecific_dynamic_library_test.dart",
"tests/ffi/vmspecific_enable_ffi_test.dart",
"tests/ffi/vmspecific_ffi_native_handles_test.dart",
"tests/ffi/vmspecific_ffi_native_test.dart",
"tests/ffi/vmspecific_function_callbacks_exit_test.dart",
"tests/ffi/vmspecific_function_callbacks_test.dart",
"tests/ffi/vmspecific_function_gc_test.dart",
"tests/ffi/vmspecific_function_test.dart",
"tests/ffi/vmspecific_handle_dynamically_linked_test.dart",
"tests/ffi/vmspecific_handle_test.dart",
"tests/ffi/vmspecific_highmem_32bit_test.dart",
"tests/ffi/vmspecific_leaf_call_test.dart",
"tests/ffi/vmspecific_native_finalizer_2_test.dart",
"tests/ffi/vmspecific_native_finalizer_deeply_immutable_test.dart",
"tests/ffi/vmspecific_native_finalizer_isolate_groups_test.dart",
"tests/ffi/vmspecific_native_finalizer_isolates_test.dart",
"tests/ffi/vmspecific_native_finalizer_test.dart",
"tests/ffi/vmspecific_object_gc_test.dart",
"tests/ffi/vmspecific_pointer_load_il_test.dart",
"tests/ffi/vmspecific_regress_37100_test.dart",
"tests/ffi/vmspecific_regress_37511_callbacks_test.dart",
"tests/ffi/vmspecific_regress_37511_test.dart",
"tests/ffi/vmspecific_regress_37780_test.dart",
"tests/ffi/vmspecific_regress_51794_test.dart",
"tests/ffi/vmspecific_send_port_id_test.dart",
]
test_deps = []
test_resources = []
foreach(test_source, test_sources) {
label = string_replace(test_source, "/", "_")
application_snapshot(label) {
dart_snapshot_kind = "kernel"
main_dart = test_source
training_args = [] # Not used
output = "$target_gen_dir/$test_source.dill"
}
test_deps += [ ":$label" ]
test_resources += [
{
path = rebase_path("$target_gen_dir/$test_source.dill")
dest = "data/$test_source"
},
]
}
test_binaries = [
"dart",
@ -193,14 +369,6 @@ if (is_fuchsia) {
".dart_tool/package_config.json",
"tools/addlatexhash.dart",
]
resource_dirs = [
"pkg/async_helper",
"pkg/expect",
"pkg/meta",
"tests/ffi",
"third_party/pkg/native/pkgs/ffi",
"third_party/pkg/path",
]
resources = []
foreach(file, library_files) {
resources += [
@ -218,8 +386,8 @@ if (is_fuchsia) {
},
]
}
resources +=
exec_script("tools/fuchsia/find_resources.py", resource_dirs, "json")
deps = test_deps
resources += test_resources
}
}

2
DEPS
View File

@ -857,7 +857,7 @@ hooks = [
'python3',
'sdk/build/fuchsia/with_envs.py',
'sdk/third_party/fuchsia/test_scripts/update_product_bundles.py',
'terminal.x64',
'terminal.x64,terminal.qemu-arm64',
],
'condition': 'download_fuchsia_deps'
},

View File

@ -11,7 +11,6 @@ import 'command.dart';
// Runs tests on a fuchsia emulator with chromium maintained test-scripts and
// CFv2 targets.
class FuchsiaEmulator {
static const String ffx = "./third_party/fuchsia/sdk/linux/tools/x64/ffx";
static const String testScriptRoot =
"./third_party/fuchsia/test_scripts/test/";
static const String withEnv = "./build/fuchsia/with_envs.py";
@ -42,6 +41,8 @@ class FuchsiaEmulator {
emuProc = await _run("start_emulator.py", [
"--disable-graphics",
"--target-id-only",
"--product",
arch == "arm64" ? "terminal.qemu-arm64" : "terminal.x64",
"--device-spec",
"virtual_device_large"
]);

View File

@ -349,6 +349,9 @@ class DartVmRuntimeConfiguration extends RuntimeConfiguration {
if (_configuration.useQemu) {
multiplier *= 2;
}
if (system == System.fuchsia && arch == Architecture.arm64) {
multiplier *= 4; // Full system QEMU.
}
// Configurations where `kernel-service` doesn't run from AppJIT snapshot
// will make tests run very slow due to the `kernel-service` code slowly
@ -543,7 +546,6 @@ class DartkFuchsiaEmulatorRuntimeConfiguration
command.arguments
.insert(command.arguments.length - 1, '--disable-dart-dev');
command.environmentOverrides.addAll(environmentOverrides);
print("+ About to run command $command to test against fuchsia vm");
return [command];
}
}

View File

@ -1,6 +1,6 @@
.text
#if defined(__linux__) || defined(__FreeBSD__) /* HOST_OS_LINUX */
#if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__)
.globl ClobberAndCall
.type ClobberAndCall, @function
.align 4

View File

@ -51,7 +51,19 @@ regress_47594_test: Skip # DartDev is not available on Android.
vmspecific_native_finalizer_isolate_groups_test: Skip # SpawnUri not available on Android tester.
[ $system == fuchsia ]
async_void_function_callbacks_test/*: Skip # Test harness doesn't support multitest with Fuchsia
ffi_induce_a_crash_test/*: Skip # Test harness doesn't support multitest with Fuchsia
function_callbacks_many_test/*: Skip # Test harness doesn't support multitest with Fuchsia
function_callbacks_structs_by_value_generated_test/*: Skip # Test harness doesn't support multitest with Fuchsia
function_callbacks_structs_by_value_native_callable_generated_test/*: Skip # Test harness doesn't support multitest with Fuchsia
function_callbacks_subtype_test/*: Skip # Test harness doesn't support multitest with Fuchsia
native_assets/*: Skip # Source not available in the emulator
static_checks/*: SkipByDesign # Expecting compile time failures in multi tests doesn't work on the Fuchsia test runner.
unaligned_test/*: Skip # Test harness doesn't support multitest with Fuchsia
vmspecific_enable_ffi_test/*: Skip # Test harness doesn't support multitest with Fuchsia
vmspecific_function_callbacks_exit_test/*: Skip # Test harness doesn't support multitest with Fuchsia
vmspecific_highmem_32bit_test/*: Skip # Test harness doesn't support multitest with Fuchsia
vmspecific_leaf_call_test/*: Skip # Test harness doesn't support multitest with Fuchsia
vmspecific_pointer_load_il_test: SkipByDesign # Not bloating the Fuchsia test package with package:vm/testing/il_matchers.dart
[ $system == windows ]

View File

@ -1591,6 +1591,14 @@
"--os=fuchsia",
"runtime"
]
},
{
"name": "vm tests",
"arguments": [
"-nvm-${system}-${mode}-${arch}",
"-j1",
"ffi"
]
}
]
},

View File

@ -1,60 +0,0 @@
#!/usr/bin/env python3
#
# Copyright (c) 2020, 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.
#
# Finds files in the given directories and their subdirectories, and prints them
# in the json format expected by GN fuchsia_component's resources arg:
# [
# {
# "path": "path/to/file.dart",
# "dest": "data/path/to/file.dart"
# },
# ...
# ]
import sys
import os
from os.path import join, abspath, relpath
DART_DIR = abspath(join(__file__, '..', '..', '..'))
def listFiles(path):
allFiles = []
for dirpath, dirs, files in os.walk(join(DART_DIR, path)):
allFiles += [
relpath(abspath(join(dirpath, p)), DART_DIR) for p in files
]
return allFiles
def printOutput(files):
print('[')
print(',\n'.join([
' {\n "path": "%s",\n "dest": "data/%s"\n }' % (f, f)
for f in files
]))
print(']')
def main():
if len(sys.argv) < 2:
print('Expected at least 1 arg, the paths to search.')
return 1
allFiles = []
for directory in sys.argv[1:]:
files = listFiles(directory)
if len(files) == 0:
print('Did not find any files in the directory: ' + directory)
return 2
allFiles += files
printOutput(sorted(allFiles))
return 0
if __name__ == '__main__':
sys.exit(main())