24 lines · plain
1# Use a copy of inputs, as we'll mutate it (as will the background index).2# RUN: rm -rf %/t3# RUN: cp -r %/S/Inputs/background-index %/t4# Need to embed the correct temp path in the actual JSON-RPC requests.5# RUN: sed -e "s|DIRECTORY|%/t|" %/t/definition.jsonrpc.tmpl > %/t/definition.jsonrpc.16# RUN: sed -e "s|DIRECTORY|%/t|" %/t/compile_commands.json.tmpl > %/t/compile_commands.json7# On Windows, we need the URI in didOpen to look like "uri":"file:///C:/..."8# (with the extra slash in the front), so we add it here.9# RUN: sed -E -e 's|"file://([A-Z]):/|"file:///\1:/|g' %/t/definition.jsonrpc.1 > %/t/definition.jsonrpc10 11# We're editing bar.cpp, which includes foo.h.12# foo() is declared in foo.h and defined in foo.cpp.13# The background index should allow us to go-to-definition on foo().14# We should also see indexing progress notifications.15# RUN: clangd -background-index -lit-test < %/t/definition.jsonrpc | FileCheck %/t/definition.jsonrpc --check-prefixes=CHECK,BUILD16 17# Test that the index is writing files in the expected location.18# RUN: ls %/t/.cache/clangd/index/foo.cpp.*.idx19# RUN: ls %/t/sub_dir/.cache/clangd/index/foo.h.*.idx20 21# Test the index is read from disk: delete code and restart clangd.22# RUN: rm %/t/foo.cpp23# RUN: clangd -background-index -lit-test < %/t/definition.jsonrpc | FileCheck %/t/definition.jsonrpc --check-prefixes=CHECK,USE24