tree: 450959539c329fd439df4db2d210e470991cb2c9 [path history] [tgz]
  1. BUILD.gn
  2. README.md
  3. arrays.test.fidl
  4. bindings_denylist.test.fidl
  5. bits.test.fidl
  6. bits_constants.test.fidl
  7. byte_and_bytes.test.fidl
  8. constants.test.fidl
  9. consts.test.fidl
  10. doc_comments.test.fidl
  11. empty_struct.test.fidl
  12. encapsulated_structs.test.fidl
  13. enum.test.fidl
  14. error.test.fidl
  15. escaping.test.fidl
  16. foreign_type_in_response_used_through_compose/
  17. handles.test.fidl
  18. handles_in_types.test.fidl
  19. info.gni
  20. inheritance.test.fidl
  21. inheritance_with_recursive_decl.test.fidl
  22. nullable.test.fidl
  23. padding.test.fidl
  24. placement_of_attributes/
  25. protocol_request.test.fidl
  26. protocols.test.fidl
  27. regen.sh
  28. request_flexible_envelope.test.fidl
  29. service.test.fidl
  30. struct.test.fidl
  31. struct_default_value_enum_library_reference/
  32. table.test.fidl
  33. transitive_dependencies/
  34. transitive_dependencies_compose/
  35. type_aliases/
  36. union.test.fidl
  37. union_sandwich.test.fidl
  38. vectors.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"
}

To add a new library with dependencies:

  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. The fidlc goldens are in //tools/fidl/fidlc -- eventually all fidlc source code will move there.

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.