Generally, we use 'gn gen out/Debug' and 'ninja -C out/Debug chrome' to build the chromium. Sometimes we need some unit tests to be built and run to test those changes. Mostly the unit test targets had already generated by gn gen command. So all we have to do is look for the target name and invoke it from command line.

  1. Look for the ninja build file that containing the unit test source you want to build. For example, the ninja build file containing  'base/files/' is 'obj/base/', which is driven by '' by a line 'build base$:base_unittests: phony ./base_unittests'.
  2. So, run 'ninja -C out/Debug base:base_unittests' to build the base_unittests executable file.
  3. That’s all.

This site uses Akismet to reduce spam. Learn how your comment data is processed.