tree: 0b84cf84f96a29c6ae366d530bd80ca02a8ae49b [path history] [tgz]
  1. bindings_denylist/
  2. error_syntax/
  3. foreign_type_in_response_used_through_compose/
  4. imported_const_values/
  5. placement_of_attributes/
  6. protocol_layouts/
  7. protocol_payloads/
  8. struct_default_value_enum_library_reference/
  9. transitive_dependencies/
  10. transitive_dependencies_compose/
  11. type_aliases/
  12. anonymous.test.fidl
  13. arrays.test.fidl
  14. bits.test.fidl
  15. bits_constants.test.fidl
  16. BUILD.gn
  17. byte_and_bytes.test.fidl
  18. constants.test.fidl
  19. consts.test.fidl
  20. doc_comments.test.fidl
  21. driver_handle.test.fidl
  22. driver_one_way.test.fidl
  23. driver_two_way.test.fidl
  24. empty_struct.test.fidl
  25. encapsulated_structs.test.fidl
  26. enum.test.fidl
  27. error.test.fidl
  28. escaping.test.fidl
  29. experimental_maybe_from_type_alias.test.fidl
  30. handles.test.fidl
  31. handles_in_types.test.fidl
  32. info.gni
  33. inheritance.test.fidl
  34. inheritance_with_recursive_decl.test.fidl
  35. nullable.test.fidl
  36. padding.test.fidl
  37. protocol_request.test.fidl
  38. protocols.test.fidl
  39. README.md
  40. request_flexible_envelope.test.fidl
  41. service.test.fidl
  42. struct.test.fidl
  43. table.test.fidl
  44. union.test.fidl
  45. union_sandwich.test.fidl
  46. unknown_interactions.test.fidl
  47. vectors.test.fidl
  48. 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 test. followed by name without underscores, e.g. library 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: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. 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: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.