[Fuchsia] Import test scripts from chromium and use it to download image
The with_envs.py works with the test script by providing the required environment variables. This change in theory does nothing since the `product download` is in 12.20230413.0.1, but `run` is removed before that, https://fxrev.dev/831319. So the DEPS cannot really download the images. The issue will be addressed in a coming change. Bug: #38752 Change-Id: Ib5f3d1d619921651208fa442201ba607a99e54d5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319867 Reviewed-by: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Thomas <athom@google.com> Commit-Queue: Zijie He <zijiehe@google.com>
This commit is contained in:
@@ -15,3 +15,12 @@ secondary_source = "//build/secondary/"
|
||||
|
||||
# Override the default script executable to always be python3.
|
||||
script_executable = "python3"
|
||||
|
||||
default_args = {
|
||||
# fuchsia::io::InotifyWatchMask has been deprecated in 12 and removed in 13
|
||||
# right before the current version (12.20230418.0.1) we are using.
|
||||
# https://fxrev.dev/836377.
|
||||
# So explicitly marking fuchsia_target_api_level to 11 to workaround it
|
||||
# temporarily.
|
||||
fuchsia_target_api_level = 11
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ vars = {
|
||||
"gn_version": "git_revision:e3978de3e8dafb50a2b11efa784e08699a43faf8",
|
||||
|
||||
# Update from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/gn
|
||||
"fuchsia_sdk_version": "version:12.20230314.2.1",
|
||||
"fuchsia_sdk_version": "version:12.20230407.0.1",
|
||||
"download_fuchsia_deps": False,
|
||||
|
||||
# Ninja, runs the build based on files generated by GN.
|
||||
"ninja_tag": "version:2@1.11.1.chromium.7",
|
||||
@@ -595,6 +596,7 @@ deps = {
|
||||
"dep_type": "cipd",
|
||||
},
|
||||
|
||||
# TODO(38752): Confirm if mac sdk is necessary in dart.
|
||||
Var("dart_root") + "/third_party/fuchsia/sdk/mac": {
|
||||
"packages": [
|
||||
{
|
||||
@@ -602,9 +604,12 @@ deps = {
|
||||
"version": Var("fuchsia_sdk_version"),
|
||||
}
|
||||
],
|
||||
"condition": 'host_os == "mac" and host_cpu == "x64"',
|
||||
"condition":
|
||||
'download_fuchsia_deps and host_os == "mac" and host_cpu == "x64"',
|
||||
"dep_type": "cipd",
|
||||
},
|
||||
|
||||
# TODO(38752): Migrate to core sdk, gn sdk is deprecating.
|
||||
Var("dart_root") + "/third_party/fuchsia/sdk/linux": {
|
||||
"packages": [
|
||||
{
|
||||
@@ -612,7 +617,20 @@ deps = {
|
||||
"version": Var("fuchsia_sdk_version"),
|
||||
}
|
||||
],
|
||||
"condition": 'host_os == "linux" and host_cpu == "x64"',
|
||||
"condition":
|
||||
'download_fuchsia_deps and host_os == "linux" and host_cpu == "x64"',
|
||||
"dep_type": "cipd",
|
||||
},
|
||||
|
||||
Var("dart_root") + "/third_party/fuchsia/test_scripts": {
|
||||
"packages": [
|
||||
{
|
||||
"package": "chromium/fuchsia/test-scripts/fuchsia",
|
||||
"version": "version:2@0d97902a72c9bc224f64630177cf95cd632604a2",
|
||||
}
|
||||
],
|
||||
"condition":
|
||||
'download_fuchsia_deps and host_os == "linux" and host_cpu == "x64"',
|
||||
"dep_type": "cipd",
|
||||
},
|
||||
|
||||
@@ -762,4 +780,15 @@ hooks = [
|
||||
Var('emsdk_ver')],
|
||||
'condition': 'download_emscripten'
|
||||
},
|
||||
{
|
||||
'name': 'Download Fuchsia system images',
|
||||
'pattern': '.',
|
||||
'action': [
|
||||
'python3',
|
||||
'sdk/build/fuchsia/with_envs.py',
|
||||
'sdk/third_party/fuchsia/test_scripts/update_product_bundles.py',
|
||||
'terminal.qemu-x64',
|
||||
],
|
||||
'condition': 'download_fuchsia_deps'
|
||||
},
|
||||
]
|
||||
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
# 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 os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def Main():
|
||||
"""
|
||||
Execute the test-scripts with required environment variables. It acts like
|
||||
/usr/bin/env, but provides some extra functionality to dynamically set up
|
||||
the environment variables.
|
||||
"""
|
||||
os.environ['SRC_ROOT'] = os.path.abspath(
|
||||
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
|
||||
os.environ['FUCHSIA_IMAGES_ROOT'] = os.path.join(os.environ['SRC_ROOT'],
|
||||
'third_party', 'fuchsia',
|
||||
'images')
|
||||
sdk_dir = ''
|
||||
if platform.system() == 'Linux':
|
||||
sdk_dir = 'linux'
|
||||
elif platform.system() == 'Darwin':
|
||||
sdk_dir = 'mac'
|
||||
else:
|
||||
assert False, 'Unsupported OS'
|
||||
os.environ['FUCHSIA_SDK_ROOT'] = os.path.join(os.environ['SRC_ROOT'],
|
||||
'third_party', 'fuchsia',
|
||||
'sdk', sdk_dir)
|
||||
# TODO(zijiehe): Remove this experimental config after upgrading sdk to a
|
||||
# version later than https://fxrev.dev/841540.
|
||||
subprocess.call([
|
||||
os.path.join(os.environ['FUCHSIA_SDK_ROOT'], 'tools', 'x64', 'ffx'),
|
||||
'config', 'set', 'product.experimental', 'true'
|
||||
])
|
||||
subprocess.call(sys.argv[1:])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(Main())
|
||||
@@ -49,9 +49,11 @@ class FuchsiaEmulator {
|
||||
"terminal.qemu-$arch",
|
||||
"--name",
|
||||
emulatorName,
|
||||
"--headless",
|
||||
"--headless"
|
||||
]);
|
||||
_run(ffx, [
|
||||
"-t",
|
||||
emulatorName,
|
||||
"target",
|
||||
"repository",
|
||||
"register",
|
||||
@@ -64,11 +66,14 @@ class FuchsiaEmulator {
|
||||
|
||||
static void stop() {}
|
||||
|
||||
static List<String> getTestArgs(String mode, List<String> arguments) {
|
||||
static List<String> getTestArgs(
|
||||
String mode, String arch, List<String> arguments) {
|
||||
arguments = arguments
|
||||
.map((arg) => arg.replaceAll(Repository.uri.toFilePath(), '/pkg/data/'))
|
||||
.toList();
|
||||
return [
|
||||
"-device-name",
|
||||
"dart-fuchsia-$mode-$arch",
|
||||
"run",
|
||||
"fuchsia-pkg://fuchsia.com/dart_ffi_test_$mode#meta/fuchsia_ffi_test_component.cmx",
|
||||
...arguments
|
||||
|
||||
@@ -480,8 +480,8 @@ class DartkFuchsiaEmulatorRuntimeConfiguration
|
||||
if (isCrashExpected) {
|
||||
arguments.insert(0, '--suppress-core-dump');
|
||||
}
|
||||
var runtimeArgs =
|
||||
FuchsiaEmulator.getTestArgs(_configuration.mode.name, arguments);
|
||||
var runtimeArgs = FuchsiaEmulator.getTestArgs(
|
||||
_configuration.mode.name, _configuration.architecture.name, arguments);
|
||||
runtimeArgs.insert(runtimeArgs.length - 1, '--disable-dart-dev');
|
||||
return [
|
||||
VMCommand(FuchsiaEmulator.fsshTool, runtimeArgs, environmentOverrides)
|
||||
|
||||
Reference in New Issue
Block a user