tree: c911e9315b9e04181a2119d6954a8c12be9bb4c0 [path history] [tgz]
  1. error_syntax/
  2. foreign_type_in_response_used_through_compose/
  3. imported_const_values/
  4. placement_of_attributes/
  5. struct_default_value_enum_library_reference/
  6. transitive_dependencies/
  7. transitive_dependencies_compose/
  8. type_aliases/
  9. anonymous.test.fidl
  10. arrays.test.fidl
  11. bindings_denylist.test.fidl
  12. bits.test.fidl
  13. bits_constants.test.fidl
  14. BUILD.gn
  15. byte_and_bytes.test.fidl
  16. constants.test.fidl
  17. consts.test.fidl
  18. doc_comments.test.fidl
  19. empty_struct.test.fidl
  20. encapsulated_structs.test.fidl
  21. enum.test.fidl
  22. error.test.fidl
  23. escaping.test.fidl
  24. experimental_maybe_from_type_alias.test.fidl
  25. handles.test.fidl
  26. handles_in_types.test.fidl
  27. info.gni
  28. inheritance.test.fidl
  29. inheritance_with_recursive_decl.test.fidl
  30. nullable.test.fidl
  31. padding.test.fidl
  32. protocol_request.test.fidl
  33. protocols.test.fidl
  34. README.md
  35. request_flexible_envelope.test.fidl
  36. service.test.fidl
  37. stamp.sh
  38. struct.test.fidl
  39. table.test.fidl
  40. union.test.fidl
  41. union_sandwich.test.fidl
  42. vectors.test.fidl
  43. versions.test.fidl
tools/fidl/fidlc/testdata/README.md

FIDL test libraries

This directory contains the FIDL test libraries used for golden files.

Add a new library

To add a new standalone library:

  1. Choose a name, e.g. foo_bar.
  2. Create a FIDL file with the .test.fidl extension, e.g. foo_bar.test.fidl.
  3. Declare the library as fidl.test. followed by name without underscores, e.g. library fidl.test.foobar;.
  4. Add the filename to the standalone_libraries list in BUILD.gn.
  5. Add an entry to fidl_testdata_info in info.gni, providing the name and the target that BUILD.gn generates, e.g.:
{
  name = "foo_bar"
  target = "//tools/fidl/fidlc/testdata:fidl.test.foobar"
}

Add a new library with dependencies

To add a new library with dependencies, you must create a subdirectory containing multiple FIDL files. This should only be done to accommodate dependencies, not to group together similar standalone libraries.

  1. Choose a name, e.g. foo_bar.
  2. Create a subdirectory named name containing two or more FIDL files ending in .test.fidl and a BUILD.gn to build them.
  3. Ensure one of the libraries is named appropriately, e.g. fidl.test.foobar, and that its build target name is the same.
  4. Add an entry to fidl_testdata_info in info.gni, providing the name and the target that BUILD.gn generates, e.g.:
{
  name = "foo_bar"
  target = "//tools/fidl/fidlc/testdata/foo_bar:fidl.test.foobar"
}

Golden tests

FIDL tools in //tools/fidl use the test libraries as input when defining golden tests with //build/testing/golden_test.gni.

To regenerate all goldens, run fx regen-goldens fidl.

To test goldens, run fx test ${TOOL}_golden_tests for the specific tool, e.g. fx test fidlc_golden_tests.