This is an archive of the discontinued LLVM Phabricator instance.

[ClangTidy] Separate tests for infrastructure and checkers
ClosedPublic

Authored by gribozavr on Oct 10 2019, 8:58 AM.

Details

Summary

This change moves tests for checkers and infrastructure into separate
directories, making it easier to find infrastructure tests. Tests for
checkers are already easy to find because they are named after the
checker. Tests for infrastructure were difficult to find because they
were outnumbered by tests for checkers. Now they are in a separate
directory.

Diff Detail

Event Timeline

gribozavr created this revision.Oct 10 2019, 8:58 AM
Herald added a project: Restricted Project. · View Herald Transcript

That's a lot of moved files.
How about *only* moving the infrastructure tests?

Why does the number of moves matter? Git preserves history across moves.

Description says:

making it easier to find infrastructure tests
Tests for infrastructure were difficult to find because they were outnumbered by tests for checkers.

So presumably there far fewer infra tests as compared to checker tests,
and the issue is specifically with infra tests.
Why not improve that *specifically*?

It would look weird if we have a ton of tests for checkers in a directory, and then a subdirectory for infra tests.

Why are we trying to optimize the number of renamed files? I already did the renaming, so we are not saving any work. I think we should optimize for long-term readability of the codebase.

alexfh accepted this revision.Oct 11 2019, 4:46 AM

I agree that the test/clang-tidy directory has become hard to navigate. Splitting tests for checks and for infrastructure seems reasonable to me. I personally don't care about specific directory names and file moves/renames are also not a concern, since git is rather good at handling those. I personally strongly prefer long-term improvements over desire to minimize churn.

My only concern is that the add_new_check.py script is updated to put new tests to the right place - totally fine for a follow up though.

One more thing is that having all checker tests in one directory is still not particularly nice, but the alternatives I thought of are not clearly superior:
0. test/clang-tidy/modernize-blah-blah.cpp - current state

  1. test/clang-tidy/checkers/modernize-blah-blah.cpp - this patch
  2. test/clang-tidy/checkers/modernize/blah-blah.cpp - test names don't have the check name substring, which makes them slightly harder to find with eyes
  3. test/clang-tidy/checkers/modernize/modernize-blah-blah.cpp - a bit tautological, even longer full file names

I'm fine with any of 1-3, since there's no clear winner among the three options.

This revision is now accepted and ready to land.Oct 11 2019, 4:46 AM
This revision was automatically updated to reflect the committed changes.