The FIDL toolchain is composed of roughly three parts:
fidlc
.fidl
filesThe front-end lives at //zircon/system/host/fidl/, with tests in //zircon/system/utest/fidl/.
The back-end and runtime library locations are based on the target:
TBD: linter, formatter, gidl, difl, regen scripts, etc.
Read the Fuchsia Getting Started guide first.
fx set core.x64 --with //bundles:tests --with //topaz/packages/tests:all --with //sdk:modular_testing
or, to ensure there's no breakage with lots of bindings etc.:
fx set terminal.x64 --with //bundles:kitchen_sink --with //vendor/google/bundles:buildbot
We provide mostly one-liners to run tests for the various parts. When in doubt, refer to the “Test:
” comment in the git commit message; we do our best to describe the commands used to validate our work there.
In zircon/
:
./scripts/gn gen build-zircon --args='variants = ["host_asan"]' ./scripts/ninja -C build-zircon tools ./scripts/ninja -C build-zircon system/utest:host
Tests are now built as:
./build-zircon/host-x64-linux-clang/obj/system/utest/fidl-compiler/fidl-compiler-test.debug ./build-zircon/host-x64-mac-clang/obj/system/utest/fidl-compiler/fidl-compiler-test.debug
./scripts/build-zircon-x64 && \ ./scripts/run-zircon-x64 -c zircon.autorun.boot=/boot/test/sys/fidl-coding-tables-test
Some example tests you can run:
fx run-host-tests fidlgen_cpp_ir_test fx run-host-tests fidlgen_golang_ir_test
To regenerate the goldens:
fx exec garnet/go/src/fidl/compiler/backend/typestest/regen.sh
Some example tests you can run:
fx run-host-tests fidlgen_dart_backend_ir_test
To regenerate the goldens:
fx exec topaz/bin/fidlgen_dart/regen.sh
In zircon/
:
./scripts/build-zircon-x64 && \ ./scripts/run-zircon-x64 -c zircon.autorun.boot=/boot/test/sys/fidl-test
When the test completes, you're running in the QEMU emulator. To exit, use Ctrl-A x
.
You first need to have Fuchsia running in an emulator. Here are the steps:
Tab 1> fx build && fx serve-updates Tab 2> fx run -kN Tab 3> fx run-test fidl_tests
You first need to have Fuchsia running in an emulator. Here are the steps:
Tab 1> fx build && fx serve-updates Tab 2> fx run -kN Tab 3> fx run-test go_fidl_tests
As with normal Go tests, you can pass various flags to control execution, filter test cases, run benchmarks, etc. For instance:
Tab 3> fx run-test go_fidl_tests-- -test.v -test.run 'TestAllSuccessCases/.*xunion.*'
TBD
The Dart FIDL bindings tests are in //topaz/bin/fidl_bindings_test/.
You first need to have Fuchsia running in an emulator. Here are the steps:
Tab 1> fx build && fx serve-updates Tab 2> fx run -kN Tab 3> fx run-test fidl_bindings_test
The language bindings compatibility test is located in //topaz/bin/fidl_compatibility_test, and is launched from a shell script.
To build this test, use:
fx build topaz/bin/fidl_compatibility_test/dart:fidl_compatibility_test_server_dart `` To run this test, you first need to have a Fuchsia instance running in an emulator: ```sh fx run -N
Then, copy the script to the device, and run it:
fx cp `find topaz -name run_fidl_compatibility_test_topaz.sh` /tmp/ fx shell /tmp/run_fidl_compatibility_test_topaz.sh
One common task is to evolve the language, or introduce stricter checks in fidlc
. These changes typically follow a three phase approach:
fidlc
;fidlc
to compile all layers, including vendor/google, make changes as needed;fidlc
changes can finally be merged.All of this assumes that (a) code which wouldn't pass the new checks, or (b) code that has new features, is not introduced concurrently between step 2 and step 3. That typically is the case, however, it is ok to deal with breaking rollers once in a while.
To update all the saved fidlgen
files, run the following command, which automatically searches for and generates the necessary go files:
fx exec third_party/go/regen-fidl
TBD
TBD
We'd actually like all back-ends to be in separate tools!
Down the road, we plan to have a script over all the various tools (fidlc
, fidlfmt
, the various back-ends) to make all things accessible easily, and manage the chaining of these things. For instance, it should be possible to generate Go bindings in one command such as:
fidl gen --library my_library.fidl --binding go --out-dir go/src/my/library
Or format a library in place with:
fidl fmt --library my_library.fidl -i