Skip to content

Commit 6f308b8

Browse files
committed
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.
2 parents edf0b1d + d7fd2de commit 6f308b8

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

Diff for: src/ci/docker/scripts/fuchsia-test-runner.py

+41-7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import fcntl
1313
import glob
1414
import hashlib
15+
import io
1516
import json
1617
import os
1718
import platform
@@ -276,27 +277,60 @@ def start(self):
276277
stderr=self.subprocess_output(),
277278
)
278279

279-
# Start emulator
280-
self.log_info("Starting emulator...")
281-
product_bundle = "terminal.qemu-" + self.triple_to_arch(self.target)
280+
# Look up the product bundle transfer manifest.
281+
self.log_info("Looking up the product bundle transfer manifest...")
282+
product_name = "minimal." + self.triple_to_arch(self.target)
283+
fuchsia_version = "14.20230811.2.1"
284+
285+
# FIXME: We should be able to replace this with the machine parsable
286+
# `ffx --machine json product lookup ...` once F15 is released.
287+
out = subprocess.check_output(
288+
[
289+
ffx_path,
290+
"product",
291+
"lookup",
292+
product_name,
293+
fuchsia_version,
294+
"--base-url",
295+
"gs://fuchsia/development/" + fuchsia_version,
296+
],
297+
env=ffx_env,
298+
stderr=self.subprocess_output(),
299+
)
300+
301+
self.log_debug(out)
302+
303+
for line in io.BytesIO(out):
304+
if line.startswith(b"gs://"):
305+
transfer_manifest_url = line.rstrip()
306+
break
307+
else:
308+
raise Exception("Unable to parse transfer manifest")
309+
310+
# Download the product bundle.
311+
product_bundle_dir = os.path.join(self.tmp_dir(), 'product-bundle')
282312
subprocess.check_call(
283313
[
284314
ffx_path,
285-
"product-bundle",
286-
"get",
287-
product_bundle,
315+
"product",
316+
"download",
317+
transfer_manifest_url,
318+
product_bundle_dir,
319+
"--force",
288320
],
289321
env=ffx_env,
290322
stdout=self.subprocess_output(),
291323
stderr=self.subprocess_output(),
292324
)
325+
326+
# Start emulator
293327
# FIXME: condition --accel hyper on target arch matching host arch
294328
subprocess.check_call(
295329
[
296330
ffx_path,
297331
"emu",
298332
"start",
299-
product_bundle,
333+
product_bundle_dir,
300334
"--headless",
301335
"--log",
302336
self.emulator_log_path(),

Diff for: src/doc/rustc/src/platform-support/fuchsia.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,12 @@ Fuchsia's test runner interacts with the Fuchsia emulator and is located at
692692
test environment with:
693693

694694
```sh
695-
src/ci/docker/scripts/fuchsia-test-runner.py start \
695+
( \
696+
src/ci/docker/scripts/fuchsia-test-runner.py start \
696697
--rust-build ${RUST_SRC_PATH}/build \
697698
--sdk ${SDK_PATH} \
698699
--target {x86_64-unknown-fuchsia|aarch64-unknown-fuchsia} \
700+
)
699701
```
700702

701703
Where `${RUST_SRC_PATH}/build` is the `build-dir` set in `config.toml` and

0 commit comments

Comments
 (0)