GTest: Unit tests layout

Hello everyone,

Are there any reasons the unittests in LLVM repo are split into independent executables, e.g. ADTTests, AnalysisTests, etc.

Are there any performance or easy-to-use reasons for this?

I plan to migrate to GTest from a project where we have all unittests in a single executable.

  • Paweł

The advantage of the existing structure is that each test has a minimal set of dependencies. This mostly matters for SupportTests, ADTTests, and IRTests. It’s nice to be able to add functionality to those headers and unit test them without triggering rebuilds of every Transform and Analysis file that uses them. Also, they generally link faster than the llc and opt binaries, which is nice.

The tests that depend on Transforms could probably be merged without sacrificing much incremental build performance.

The obvious downside of fine-grained testing executables is that it increases the total build directory size and total work to link and run all tests. =(