Google is committed to advancing racial equity for Black communities. See how.

fx regen-goldens

regenerates golden files in the source tree

Usage: fx regen-goldens PATTERN ... [--list] [--reset] [FX_TEST_FLAGS]

Regenerates golden files for tools that match the given substring patterns.
If no patterns are provided, regenerates for all tools.

  --list   List matching tools and their golden directories, and exit.
  --reset  Delete existing goldens first. (See "Troubleshooting" below.)

  All other flags are forwarded to fx test. A useful one is -o/--output to
  show test output, which prints the filenames being regenerated.

Examples:

  fx regen-goldens           # regen all goldens
  fx regen-goldens fidlgen_  # regen fidlgen_* goldens
  fx regen-goldens fidlc -o  # regen fidlc goldens, with verbose output

Troubleshooting:

  Try passing the --reset flag if you encounter one of these situations:

  GN error, when goldens.txt is missing:
    ERROR at //build/testing/golden_test.gni:86:28: Could not read file.
      goldens_list = read_file("${invoker.goldens_dir}/goldens.txt", ...)

  Ninja error, when goldens.txt contains nonexistent files:
    ninja: error: '.../foo.golden', needed by 'host_x64/gen/.../foo.golden',
    missing and no known rule to make it

  Formatting error, when goldens have invalid syntax (e.g. from a merge conflict):
    ACTION //..._reformat_goldens(//build/toolchain:host_x64)
    /usr/bin/env /bin/sh -c \'.../rustfmt\'\ ...
    error: expected identifier, found `<<`

regen-goldens source code