diff --git a/BUILD.gn b/BUILD.gn index 83260f17805..166e8c37410 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -225,7 +225,7 @@ if (is_fuchsia) { } dart_fuchsia_test_component("fuchsia_test_component") { - manifest = "build/fuchsia/fuchsia_test_component.cmx" + manifest = "build/fuchsia/fuchsia_test_component.cml" resource_dirs = [ "pkg/async_helper", "pkg/expect", @@ -253,7 +253,7 @@ if (is_fuchsia) { } dart_fuchsia_test_component("fuchsia_ffi_test_component") { - manifest = "build/fuchsia/fuchsia_ffi_test_component.cmx" + manifest = "build/fuchsia/fuchsia_ffi_test_component.cml" data_deps = [ "runtime/bin:ffi_test_dynamic_library", "runtime/bin:ffi_test_functions", @@ -274,28 +274,4 @@ if (is_fuchsia) { package_name = "dart_ffi_test" deps = [ ":fuchsia_ffi_test_component" ] } - - # TODO(38752): Remove "cfv2" once everything is migrated to CFv2. - dart_fuchsia_test_component("fuchsia_ffi_test_component_cfv2") { - manifest = "build/fuchsia/fuchsia_ffi_test_component.cml" - data_deps = [ - "runtime/bin:ffi_test_dynamic_library", - "runtime/bin:ffi_test_functions", - ] - library_files = [ - "libffi_test_dynamic_library.so", - "libffi_test_functions.so", - ] - resource_dirs = [ - "pkg/expect", - "pkg/meta", - "tests/ffi", - "third_party/pkg/ffi", - ] - } - - dart_fuchsia_test_package("fuchsia_ffi_test_package_cfv2") { - package_name = "dart_ffi_test_cfv2" - deps = [ ":fuchsia_ffi_test_component_cfv2" ] - } } diff --git a/DEPS b/DEPS index a0ed25648cb..7d854382a73 100644 --- a/DEPS +++ b/DEPS @@ -87,7 +87,7 @@ vars = { "reclient_version": "git_revision:81e819b39d4743462857cc55430d898b9fcca1af", # Update from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/gn - "fuchsia_sdk_version": "version:12.20230407.0.1", + "fuchsia_sdk_version": "version:15.20231018.3.4", "download_fuchsia_deps": False, # Ninja, runs the build based on files generated by GN. @@ -670,7 +670,7 @@ Var("dart_root") + "/third_party/pkg/tar": "packages": [ { "package": "chromium/fuchsia/test-scripts/fuchsia", - "version": "version:2@30ecdcc6666ac09845a2e2d4fe7d8d5714230fba", + "version": "version:2@56179f1724e9bf82ce7abf5577884e5d217b52e9", } ], "condition": diff --git a/build/fuchsia/fuchsia_ffi_test_component.cmx b/build/fuchsia/fuchsia_ffi_test_component.cmx deleted file mode 100644 index 7727c9c5fac..00000000000 --- a/build/fuchsia/fuchsia_ffi_test_component.cmx +++ /dev/null @@ -1,27 +0,0 @@ -{ - "program": { - "binary": "exe.stripped/dart" - }, - "sandbox": { - "features": [ - "config-data", - "isolated-cache-storage", - "isolated-persistent-storage", - "isolated-temp", - "root-ssl-certificates" - ], - "services": [ - "fuchsia.deprecatedtimezone.Timezone", - "fuchsia.device.NameProvider", - "fuchsia.feedback.CrashReporter", - "fuchsia.intl.PropertyProvider", - "fuchsia.kernel.VmexResource", - "fuchsia.logger.LogSink", - "fuchsia.net.name.Lookup", - "fuchsia.posix.socket.Provider", - "fuchsia.sysmem.Allocator", - "fuchsia.timezone.Timezone", - "fuchsia.tracing.provider.Registry" - ] - } -} diff --git a/build/fuchsia/fuchsia_test_component.cml b/build/fuchsia/fuchsia_test_component.cml new file mode 100644 index 00000000000..6e9d08a4d15 --- /dev/null +++ b/build/fuchsia/fuchsia_test_component.cml @@ -0,0 +1,54 @@ +{ + program: { + binary: "exe.stripped/dart", + runner: "elf_test_runner", + }, + capabilities: [ + { protocol: "fuchsia.test.Suite" }, + ], + expose: [ + { + protocol: "fuchsia.test.Suite", + from: "self", + }, + ], + use: [ + { + directory: "config-data", + rights: [ "r*" ], + path: "/config/data", + }, + { + storage: "cache", + path: "/cache", + }, + { + storage: "data", + path: "/data", + }, + { + storage: "tmp", + path: "/tmp", + }, + { + directory: "root-ssl-certificates", + rights: [ "r*" ], + path: "/config/ssl", + }, + { + protocol: [ + "fuchsia.deprecatedtimezone.Timezone", + "fuchsia.device.NameProvider", + "fuchsia.feedback.CrashReporter", + "fuchsia.intl.PropertyProvider", + "fuchsia.kernel.VmexResource", + "fuchsia.logger.LogSink", + "fuchsia.net.name.Lookup", + "fuchsia.posix.socket.Provider", + "fuchsia.sysmem.Allocator", + "fuchsia.timezone.Timezone", + "fuchsia.tracing.provider.Registry", + ], + }, + ] +} diff --git a/build/fuchsia/fuchsia_test_component.cmx b/build/fuchsia/fuchsia_test_component.cmx deleted file mode 100644 index 7727c9c5fac..00000000000 --- a/build/fuchsia/fuchsia_test_component.cmx +++ /dev/null @@ -1,27 +0,0 @@ -{ - "program": { - "binary": "exe.stripped/dart" - }, - "sandbox": { - "features": [ - "config-data", - "isolated-cache-storage", - "isolated-persistent-storage", - "isolated-temp", - "root-ssl-certificates" - ], - "services": [ - "fuchsia.deprecatedtimezone.Timezone", - "fuchsia.device.NameProvider", - "fuchsia.feedback.CrashReporter", - "fuchsia.intl.PropertyProvider", - "fuchsia.kernel.VmexResource", - "fuchsia.logger.LogSink", - "fuchsia.net.name.Lookup", - "fuchsia.posix.socket.Provider", - "fuchsia.sysmem.Allocator", - "fuchsia.timezone.Timezone", - "fuchsia.tracing.provider.Registry" - ] - } -} diff --git a/pkg/test_runner/lib/src/fuchsia.dart b/pkg/test_runner/lib/src/fuchsia.dart index 288848c4631..f08bfd13572 100644 --- a/pkg/test_runner/lib/src/fuchsia.dart +++ b/pkg/test_runner/lib/src/fuchsia.dart @@ -3,10 +3,8 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:async'; -import 'dart:io'; import 'command.dart'; -import 'fuchsia_cfv1.dart'; import 'fuchsia_cfv2.dart'; // Sets up and executes commands against a Fuchsia environment. @@ -23,10 +21,7 @@ abstract class FuchsiaEmulator { static final FuchsiaEmulator _instance = _create(); static FuchsiaEmulator _create() { - if (Platform.environment.containsKey('FUCHSIA_CFV2')) { - return FuchsiaEmulatorCFv2(); - } - return FuchsiaEmulatorCFv1(); + return FuchsiaEmulatorCFv2(); } static FuchsiaEmulator instance() { diff --git a/pkg/test_runner/lib/src/fuchsia_cfv1.dart b/pkg/test_runner/lib/src/fuchsia_cfv1.dart deleted file mode 100644 index a120e44ecaa..00000000000 --- a/pkg/test_runner/lib/src/fuchsia_cfv1.dart +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2023, 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. - -import 'dart:async'; -import 'dart:io'; - -import 'command.dart'; -import 'fuchsia.dart'; -import 'repository.dart'; - -// Runs tests on a fuchsia emulator with legacy tools and CFv1 targets. -class FuchsiaEmulatorCFv1 extends FuchsiaEmulator { - static const String fsshTool = - "./third_party/fuchsia/sdk/linux/tools/x64/fssh"; - static const String ffx = "./third_party/fuchsia/sdk/linux/tools/x64/ffx"; - static const String pm = "./third_party/fuchsia/sdk/linux/tools/x64/pm"; - - @override - Future publishPackage(String buildDir, String mode, String arch) async { - stop(); - - // Setup package server. - var packageRepositoryPath = "dart-test-package-repository-$mode-$arch"; - var packageRepositoryName = "dart-test-package-repository-$mode-$arch-name"; - var f = Directory(packageRepositoryPath); - if (f.existsSync()) f.deleteSync(recursive: true); - _run(pm, ["newrepo", "-repo", packageRepositoryPath]); - _run(pm, [ - "publish", - "-a", - "-repo", - packageRepositoryPath, - "-f", - "$buildDir/gen/dart_ffi_test_$mode/dart_ffi_test_$mode.far" - ]); - _run(ffx, [ - "repository", - "add-from-pm", - packageRepositoryPath, - "-r", - packageRepositoryName - ]); - _run(ffx, ["repository", "server", "start"]); - - // Setup emulator. - var emulatorName = "dart-fuchsia-$mode-$arch"; - _run(ffx, ["product-bundle", "get", "terminal.qemu-$arch"]); - _run(ffx, [ - "emu", - "start", - "terminal.qemu-$arch", - "--name", - emulatorName, - "--headless" - ]); - _run(ffx, [ - "-t", - emulatorName, - "target", - "repository", - "register", - "-r", - packageRepositoryName, - "--alias", - "fuchsia.com" - ]); - } - - @override - void stop() { - _run(ffx, ["emu", "stop", "--all"]); - _run(ffx, ["repository", "server", "stop"]); - } - - @override - VMCommand getTestCommand( - String buildDir, String mode, String arch, List arguments) { - arguments = arguments - .map((arg) => arg.replaceAll(Repository.uri.toFilePath(), '/pkg/data/')) - .toList(); - return VMCommand(fsshTool, [ - "-device-name", - "dart-fuchsia-$mode-$arch", - "run", - "fuchsia-pkg://fuchsia.com/dart_ffi_test_$mode#meta/fuchsia_ffi_test_component.cmx", - ...arguments - ], {}); - } - - static String _run(String exec, List args) { - var line = "$exec ${args.join(' ')}"; - print("+ $line"); - var result = Process.runSync(exec, args); - print(result.stdout); - print(result.stderr); - if (result.exitCode != 0) { - throw "$line failed"; - } - return (result.stdout as String).trim(); - } -} diff --git a/pkg/test_runner/lib/src/fuchsia_cfv2.dart b/pkg/test_runner/lib/src/fuchsia_cfv2.dart index 5766416f09d..75608727424 100644 --- a/pkg/test_runner/lib/src/fuchsia_cfv2.dart +++ b/pkg/test_runner/lib/src/fuchsia_cfv2.dart @@ -11,7 +11,7 @@ import 'fuchsia.dart'; // Runs tests on a fuchsia emulator with chromium maintained test-scripts and // CFv2 targets. -// TODO(#38752): Need implementation. +// TODO(#38752): Merge back to fuchsia.dart. class FuchsiaEmulatorCFv2 extends FuchsiaEmulator { static const String ffx = "./third_party/fuchsia/sdk/linux/tools/x64/ffx"; static const String testScriptRoot = @@ -94,6 +94,10 @@ class FuchsiaEmulatorCFv2 extends FuchsiaEmulator { _tempDirectoryOf("out"), "--test-name", "fuchsia-pkg://fuchsia.com/${_testPackageName(mode)}#meta/$cmName", + "--test-realm", + // VmexResource not available in default hermetic realm + // TODO(38752): Setup a Dart test realm. + "/core/testing:system-tests", "--logs-dir", _tempDirectoryOf("logs"), "--package-deps", @@ -104,7 +108,7 @@ class FuchsiaEmulatorCFv2 extends FuchsiaEmulator { } static String _testPackageName(String mode) { - return "dart_ffi_test_cfv2_$mode"; + return "dart_ffi_test_$mode"; } static String _testPackagePath(String buildDir, String mode) { diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json index 1a8775ed92c..e9f41380b0d 100644 --- a/tools/bots/test_matrix.json +++ b/tools/bots/test_matrix.json @@ -1690,8 +1690,7 @@ "runtime", "create_sdk", "fuchsia_test_package", - "fuchsia_ffi_test_package", - "fuchsia_ffi_test_package_cfv2" + "fuchsia_ffi_test_package" ] }, {