commit | 263610fd28bec118fefd404aa96f263ee4624c8b | [log] [tgz] |
---|---|---|
author | Renato Mangini Dias <mangini@google.com> | Thu Apr 28 20:58:46 2022 +0000 |
committer | Renato Mangini Dias <mangini@google.com> | Thu Apr 28 20:58:46 2022 +0000 |
tree | a9a9342c498b1ba3f4df954dbad000c2c676811e | |
parent | 279ea3a9e06a978eb47249e6b3f97966fcb51396 [diff] |
Update smoke test Remove the requirement to set ffx repository server mode to ffx, as this is the default now. Change-Id: I642253b5bbd734ea0d889e0f1413d3900ea0b95b Reviewed-on: https://fuchsia-review.googlesource.com/c/sdk-samples/getting-started/+/673563 Reviewed-by: Chris Holguin <cholguin@google.com>
This repository contains instructions and source code to build, package and run Fuchsia samples using only the Fuchsia SDK. To update the dependencies of this repository, follow the instructions in update_dependencies.md.
Install a Bazel version no older than the one defined in the .bazelversion file, by following the instructions at https://bazel.build/install. In some Linux distributions, sudo apt-get install bazel
should be enough.
Make sure this repository has the required submodules:
git submodule update --recursive --init
Ensure that there are Fuchsia SSH keys in your host machine. You will need them for running the Fuchsia emulator.
[[ -f "${HOME}/.ssh/fuchsia_ed25519" ]] || ssh-keygen -P "" -t ed25519 -f "${HOME}/.ssh/fuchsia_ed25519" -C "${USER}@$(hostname -f) Shared SSH Key for Fuchsia" [[ -f "${HOME}/.ssh/fuchsia_authorized_keys" ]] || ssh-keygen -y -f "${HOME}/.ssh/fuchsia_ed25519" > "${HOME}/.ssh/fuchsia_authorized_keys"
Now the repository is ready to build the samples.
Build the samples:
bazel build --config=fuchsia_x64 src:samples_repository
This command will build all the samples and make them available as packages on a local Fuchsia repository.
Fetch an emulator image and start an emulator
tools/ffx product-bundle get workstation.qemu-x64 tools/ffx emu start --net tap workstation.qemu-x64 --headless
Note: Use --net user when running on MacOS
The product bundle comes with on-demand packages in a separate repository. Use the following command to register it with the emulator:
tools/ffx target repository register -r workstation.qemu-x64 --alias fuchsia.com
Register the package repositories
tools/ffx repository add-from-pm -r fuchsiasamples.com bazel-bin/src/fuchsiasamples.com.repo tools/ffx target repository register -r fuchsiasamples.com
(optional) watch the device log in a separate window
tools/ffx log
Run a hello world component
tools/ffx component run fuchsia-pkg://fuchsiasamples.com/hello_world#meta/hello_world.cm --recreate
Watch in the log that the message “Hello, World!” is printed. Modify the Hello world message in src/hello_world/hello_world.cc, repeat steps 1 and 3, and see that the log shows the new message.
Run the echo sample
tools/ffx component run fuchsia-pkg://fuchsiasamples.com/echo-example#meta/echo.cm --recreate
Watch the message “Hello, Alice, Bob, Spot!” in the log. Modify the FAVORITE_ANIMAL environment variable in src/echo/meta/echo.cml, repeat steps 1 and 3 and see that the log shows the new message.
Run unit tests for the hello world sample
tools/ffx test run fuchsia-pkg://fuchsiasamples.com/hello_test#meta/hello_gtest.cm
Run the routing sample
tools/ffx component create /core/ffx-laboratory:echo_realm fuchsia-pkg://fuchsiasamples.com/components_routing_example#meta/echo_realm.cm tools/ffx component start /core/ffx-laboratory:echo_realm/echo_client
Watch the message “Server response: Hello Fuchsia!” in the log:
tools/ffx log --filter echo_client
Run integration tests for the routing sample
tools/ffx test run fuchsia-pkg://fuchsiasamples.com/echo_integration_test#meta/echo_integration_test.cm