tree: fd43a93ef9567d6a1beddbee31f54696c985cad0 [path history] [tgz]
  1. cpp/
  2. fidl/
  3. integration_tests/
  4. meta/
  5. rust/

Routing Example

This directory contains an example of capability routing in Component Framework.


If these components are not present in your build, they can be added by appending --with //examples to your fx set command. For example:

$ fx set core.x64 --with //examples --with //examples:tests
$ fx build


Use ffx component create to create the component instances inside a restricted realm for development purposes:

  • C++

    $ ffx component create /core/ffx-laboratory:echo_realm fuchsia-pkg://
  • Rust

    $ ffx component create /core/ffx-laboratory:echo_realm fuchsia-pkg://

Start the client component instance by passing its moniker to ffx component start:

$ ffx component start /core/ffx-laboratory:echo_realm/echo_client

When the above command is run, you can see the following output with fx log:

[echo_client] INFO: Server response: Hello Fuchsia!

After running the example, you can remove the example realm using ffx component destroy:

$ ffx component destroy /core/ffx-laboratory:echo_realm


Integration tests for echo server are available in the echo_integration_test package. Use the ffx test run command to run the tests on a target device:

  • C++

    $ ffx test run fuchsia-pkg://
  • Rust

    $ ffx test run fuchsia-pkg://

You should see the integration tests execute and pass:

Running test 'fuchsia-pkg://'
[RUNNING]	echo_integration_test
[PASSED]	echo_integration_test

1 out of 1 tests passed...