Test-only code

Test-only code should live in the same directory as the code under test. There is one exception to this rule for fake implementations of interfaces and shared test fixtures. When the number of source files containing code related to these has reached a certain threshold, they should be moved to a test subdirectory. For instance, see the //fuchsia/engine/test directory.

Namespacing

Code that is not shared across multiple targets should live in the global namespace. Code that is shared across multiple targets should live in the cr_fuchsia namespace.

Running test suites

Building test suites generate a launcher script to run them on a QEMU instance. These scripts are generated at out/fuchsia/bin. For instance,to run the base_unittests target, launch:

$ out/fuchsia/bin/run_base_unittests

Building and deploying the WebRunner service

When you build web_runner, Chromium will automatically generate scripts for you that will automatically provision a device with Fuchsia and then install web_runner and its dependencies.

To build and run web_runner, follow these steps:

(Optional) Ensure that you have a device ready to boot into Fuchsia.

If you wish to have web_runner manage the OS deployment process, then you should have the device booting into Zedboot.

Build web_runner.

$ autoninja -C out/fuchsia web_runner

Install web_runner.

For devices running Zedboot:

$ out/fuchsia/bin/install_web_runner -d

For devices already booted into Fuchsia:

You will need to add command line flags specifying the device's IP address and the path to the ssh_config used by the device (located at $FUCHSIA_OUT_DIR/ssh-keys/ssh_config):