diff --git a/BUILD.gn b/BUILD.gn index 22078180b94..04d9661d31c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -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 } } diff --git a/DEPS b/DEPS index 47572c6526d..4834f79cb78 100644 --- a/DEPS +++ b/DEPS @@ -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' }, diff --git a/pkg/test_runner/lib/src/fuchsia.dart b/pkg/test_runner/lib/src/fuchsia.dart index dd42e521e51..13ffa965fc2 100644 --- a/pkg/test_runner/lib/src/fuchsia.dart +++ b/pkg/test_runner/lib/src/fuchsia.dart @@ -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" ]); diff --git a/pkg/test_runner/lib/src/runtime_configuration.dart b/pkg/test_runner/lib/src/runtime_configuration.dart index e49416bf858..cdf944af01a 100644 --- a/pkg/test_runner/lib/src/runtime_configuration.dart +++ b/pkg/test_runner/lib/src/runtime_configuration.dart @@ -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]; } } diff --git a/runtime/bin/ffi_test/clobber_arm64.S b/runtime/bin/ffi_test/clobber_arm64.S index 7985a7017ef..fb6dc5801d3 100644 --- a/runtime/bin/ffi_test/clobber_arm64.S +++ b/runtime/bin/ffi_test/clobber_arm64.S @@ -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 diff --git a/tests/ffi/ffi.status b/tests/ffi/ffi.status index d2fb5f6f76c..4d3cb185cf3 100644 --- a/tests/ffi/ffi.status +++ b/tests/ffi/ffi.status @@ -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 ] diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json index 49378703458..e0d4393a518 100644 --- a/tools/bots/test_matrix.json +++ b/tools/bots/test_matrix.json @@ -1591,6 +1591,14 @@ "--os=fuchsia", "runtime" ] + }, + { + "name": "vm tests", + "arguments": [ + "-nvm-${system}-${mode}-${arch}", + "-j1", + "ffi" + ] } ] }, diff --git a/tools/fuchsia/find_resources.py b/tools/fuchsia/find_resources.py deleted file mode 100755 index f8b051895b3..00000000000 --- a/tools/fuchsia/find_resources.py +++ /dev/null @@ -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())