Skip to content

lint: apply tests only to the changed packages #42642

@knz

Description

@knz

We have a bunch of lint tests that operate on the entire repo on every CI run, although they do not need whole-program analysis. They could be specialized to run only on those Go packages that were modified in the current PR, like we already do for the testrace CI target (see the code in build/teamcity-testrace.sh).

For example the following can be specialized:

  • all the grep tests (TestSyncutil, etc)
  • all the fmt tests (TestGofmt, TestCrlfmt)
  • TestVet/shadow
  • the roachlint modules hash, timer

Then there are checks about how functions are used in other contexts, for these we need to check the callers even if only the function itself was modified. However, the checks do not need to cascade: we only need to check the packages that have a modified package as direct import:

  • TestReturnCheck
  • TestErrCheck
  • most of the remaining TestVet checks
  • the roachlint modules unconvert, descriptormarshal

Finally there are some tests that do most of their "useful" work on a whole program analysis, but that can still benefit from a partial analysis on just a sub-module. For example staticcheck falls in this category. For this category, we could have two different CI targets, one that runs nightly on the entire repo and one in CI for just the changed packages.

Given that the bulk of the execution time of make lint is (currently) in the first two categories above, major run time improvements can be reached by working on this issue.

Epic CRDB-10439

Jira issue: CRDB-5338

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-build-systemA-lintersA-testingTesting tools and infrastructureC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)S-3-productivitySevere issues that impede the productivity of CockroachDB developers.T-dev-infX-nostaleMarks an issue/pr that should be ignored by the stale bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions