blob: fb278f9c43693c40930fd36c14410791da4ed3c4 [file] [log] [blame] [view]
# Testing the CTS on Fuchsia
The default SDK for developing applications of Fuchsia has build rules written in
[Bazel](https://bazel.build/). To take advantage of that, we have a wrapper Bazel build that invokes
cmake using [rules_foreign_cc](https://github.com/bazelbuild/rules_foreign_cc).
The upstream rules_foreign_cc deletes the temporary build directory (containing all the CMake
output) after every build, which turns incremental rebuilds into full builds and makes them take
just as long. This repo has a patch to rules_foreign_cc to prevent deletion so all the old object files can be reused.
The main bazel repository is in `scripts/fuchsia`, not at the root of the git repo. The root of the
git repo is then included as an external repository under the path `external/src`. This prevents a
conflict between the `external` directory bazel uses to hold external repositories and the
`external` directory this project uses to hold external dependencies (which then appears under
`external/src/external`).
## Running tests on Fuchsia Emulator
All bazel commands must be run under scripts/fuchsia.
Detailed instructions for downloading and starting the fuchsia emulator are at [fuchsia.dev](https://fuchsia.dev/fuchsia-src/get-started/sdk).
Some differences:
1. You must install bazel manually.
2. ffx will be under `bazel-fuchsia/external/fuchsia_sdk/tools/x64/ffx` instead of `tools/ffx`.
Once you've downloaded and started the fuchsia emulator, use this command to run all the tests:
`bazel run --config=fuchsia_x64 //:vulkan-cts-split`
To run a single test, use the command (notice the two `--`s):
`bazel run --config=fuchsia_x64 //:vulkan-cts.component -- -- --deqp-archive-dir=/pkg/data --deqp-log-filename=/artifacts/TestResults.qpa --deqp-case=<casename>`
## Running tests with an existing Fuchsia tree build
Install the tests into the fuchsia build using:
`bazel build --config=fuchsia_x64 --package_repo=$FUCHSIA_OUT_DIR/amber-files //:vulkan-cts-split_fuchsia_package`
Run using:
```
fx test -o fuchsia-pkg://fuchsia.com/vulkan-cts-split#meta/vulkan-cts-split-${SPLIT_INDEX}.cm
```
To run a single test or a matching glob of tests:
```
fx test -o vulkan-cts-no-args -- --deqp-log-images=disable --deqp-log-shader-sources=disable --deqp-log-filename=/artifacts/TestResults.qpa --deqp-archive-dir=/pkg/data --deqp-case=${TEST_QUERY}
```