Auto merge of #117799 - erickt:fuchsia, r=tmandry

Switch `fuchsia-test-runner.py` to `ffx product`

The subcommand `ffx product-bundle` has been removed, and replaced with the subcommand `ffx product`. This changes `fuchsia-test-runner.py` to use it to download the SDK and product bundle for the latest release of Fuchsia.
This commit is contained in:
bors 2023-11-11 00:03:52 +00:00
commit 6f308b8713
2 changed files with 44 additions and 8 deletions

View File

@ -12,6 +12,7 @@ from dataclasses import dataclass
import fcntl import fcntl
import glob import glob
import hashlib import hashlib
import io
import json import json
import os import os
import platform import platform
@ -276,27 +277,60 @@ class TestEnvironment:
stderr=self.subprocess_output(), stderr=self.subprocess_output(),
) )
# Start emulator # Look up the product bundle transfer manifest.
self.log_info("Starting emulator...") self.log_info("Looking up the product bundle transfer manifest...")
product_bundle = "terminal.qemu-" + self.triple_to_arch(self.target) product_name = "minimal." + self.triple_to_arch(self.target)
fuchsia_version = "14.20230811.2.1"
# FIXME: We should be able to replace this with the machine parsable
# `ffx --machine json product lookup ...` once F15 is released.
out = subprocess.check_output(
[
ffx_path,
"product",
"lookup",
product_name,
fuchsia_version,
"--base-url",
"gs://fuchsia/development/" + fuchsia_version,
],
env=ffx_env,
stderr=self.subprocess_output(),
)
self.log_debug(out)
for line in io.BytesIO(out):
if line.startswith(b"gs://"):
transfer_manifest_url = line.rstrip()
break
else:
raise Exception("Unable to parse transfer manifest")
# Download the product bundle.
product_bundle_dir = os.path.join(self.tmp_dir(), 'product-bundle')
subprocess.check_call( subprocess.check_call(
[ [
ffx_path, ffx_path,
"product-bundle", "product",
"get", "download",
product_bundle, transfer_manifest_url,
product_bundle_dir,
"--force",
], ],
env=ffx_env, env=ffx_env,
stdout=self.subprocess_output(), stdout=self.subprocess_output(),
stderr=self.subprocess_output(), stderr=self.subprocess_output(),
) )
# Start emulator
# FIXME: condition --accel hyper on target arch matching host arch # FIXME: condition --accel hyper on target arch matching host arch
subprocess.check_call( subprocess.check_call(
[ [
ffx_path, ffx_path,
"emu", "emu",
"start", "start",
product_bundle, product_bundle_dir,
"--headless", "--headless",
"--log", "--log",
self.emulator_log_path(), self.emulator_log_path(),

View File

@ -692,10 +692,12 @@ Fuchsia's test runner interacts with the Fuchsia emulator and is located at
test environment with: test environment with:
```sh ```sh
src/ci/docker/scripts/fuchsia-test-runner.py start \ ( \
src/ci/docker/scripts/fuchsia-test-runner.py start \
--rust-build ${RUST_SRC_PATH}/build \ --rust-build ${RUST_SRC_PATH}/build \
--sdk ${SDK_PATH} \ --sdk ${SDK_PATH} \
--target {x86_64-unknown-fuchsia|aarch64-unknown-fuchsia} \ --target {x86_64-unknown-fuchsia|aarch64-unknown-fuchsia} \
)
``` ```
Where `${RUST_SRC_PATH}/build` is the `build-dir` set in `config.toml` and Where `${RUST_SRC_PATH}/build` is the `build-dir` set in `config.toml` and