Index: test/CMakeLists.txt =================================================================== --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -72,6 +72,13 @@ ) endif() +# clangd's benchmark has an optional test. +if(LLVM_BUILD_BENCHMARKS) + list(APPEND CLANG_TOOLS_TEST_DEPS + IndexBenchmark + ) +endif() + set(llvm_utils FileCheck count not ) Index: test/clangd/index-tools.test =================================================================== --- test/clangd/index-tools.test +++ test/clangd/index-tools.test @@ -1,3 +1,3 @@ # RUN: clangd-indexer %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > %t.index -# FIXME: By default, benchmarks are excluded from the list of default targets hence not built. Find a way to depend on benchmarks to run the next command. +# FIXME: This is fragile. Can we express the LLVM_BUILD_BENCHMARKS dep directly? # RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.log --benchmark_min_time=0.01 ; fi