Skip to content

Commit

Permalink
Break tree_operations test into shards.
Browse files Browse the repository at this point in the history
This test puts a lot of burden on the compiler and compilation
alone takes about 120 seconds or so. Break it up into shards in
which only parts of the tests are ifdef'ed in in each shard.
Now each shard takes around 20-25 seconds, less likely to dominate
the critical compilation path.

Also, exclude some very slow to clang-tidy tests from run in
clang-tidy.
  • Loading branch information
hzeller committed Jul 29, 2023
1 parent a1cd07b commit 67b2338
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .github/bin/run-clang-tidy-cached.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ void ClangTidyProcessFiles(const fs::path &content_dir, const std::string &cmd,
int main(int argc, char *argv[]) {
const std::string kProjectPrefix = "verible_";
const std::string kSearchDir = ".";
const std::string kFileExcludeRe = "vscode/|external_libs/|.github/";
const std::string kFileExcludeRe = "vscode/|external_libs/|.github/"
"|tree_operations_test" // very slow
"|symbol_table_test";

const std::string kTidySymlink = kProjectPrefix + "clang-tidy.out";
const fs::path cache_dir = GetCacheDir() / "clang-tidy";
Expand Down
35 changes: 24 additions & 11 deletions common/util/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -542,17 +542,30 @@ cc_test(
],
)

cc_test(
name = "tree-operations_test",
srcs = ["tree_operations_test.cc"],
deps = [
":spacer",
":tree-operations",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_googletest//:gtest_main",
],
)
[
(
cc_test(
name = "tree-operations_" + shard + "_test",
srcs = ["tree_operations_test.cc"],
defines = ["COMPILATION_SHARD=" + shard],
deps = [
":spacer",
":tree-operations",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_googletest//:gtest_main",
],
),
)
for shard in [
"1",
"2",
"3",
"4",
"5",
"6",
]
]

cc_test(
name = "expandable-tree-view_test",
Expand Down
Loading

0 comments on commit 67b2338

Please sign in to comment.