[PATCH] D91330: [clangd] Ensure we test for compatibility of serialized index format

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 04:13:25 PST 2020


kadircet updated this revision to Diff 305096.
kadircet added a comment.

- Update comments
- Query for Bar
- Only run with zlib


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91330/new/

https://reviews.llvm.org/D91330

Files:
  clang-tools-extra/clangd/test/index-serialization/Inputs/sample.cpp
  clang-tools-extra/clangd/test/index-serialization/Inputs/sample.h
  clang-tools-extra/clangd/test/index-serialization/Inputs/sample.idx
  clang-tools-extra/clangd/test/index-serialization/version-is-correct.test
  clang-tools-extra/clangd/test/lit.cfg.py
  clang-tools-extra/clangd/test/lit.site.cfg.py.in


Index: clang-tools-extra/clangd/test/lit.site.cfg.py.in
===================================================================
--- clang-tools-extra/clangd/test/lit.site.cfg.py.in
+++ clang-tools-extra/clangd/test/lit.site.cfg.py.in
@@ -25,6 +25,7 @@
 config.clangd_binary_dir = "@CMAKE_CURRENT_BINARY_DIR@/.."
 config.clangd_build_xpc = @CLANGD_BUILD_XPC@
 config.clangd_enable_remote = @CLANGD_ENABLE_REMOTE@
+config.have_zlib = @LLVM_ENABLE_ZLIB@
 
 # Delegate logic to lit.cfg.py.
 lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg.py")
Index: clang-tools-extra/clangd/test/lit.cfg.py
===================================================================
--- clang-tools-extra/clangd/test/lit.cfg.py
+++ clang-tools-extra/clangd/test/lit.cfg.py
@@ -30,3 +30,6 @@
 
 if config.clangd_enable_remote:
   config.available_features.add('clangd-remote-index')
+
+if config.have_zlib:
+  config.available_features.add('zlib')
Index: clang-tools-extra/clangd/test/index-serialization/version-is-correct.test
===================================================================
--- /dev/null
+++ clang-tools-extra/clangd/test/index-serialization/version-is-correct.test
@@ -0,0 +1,16 @@
+# REQUIRES: zlib
+# This test tries to parse a checked-in binary index.
+# If this test fails it means there has been a backward incompatilbe change to
+# serialization format.
+# Please bump the version number in
+# clang-tools-extra/clangd/index/Serialization.cpp and regenarate sample.idx
+# with
+#
+#   clangd-indexer
+#     clang-tools-extra/clangd/test/index-serialization/Inputs/sample.cpp >
+#     clang-tools-extra/clangd/test/index-serialization/Inputs/sample.idx
+#
+# Also if you've introduced new slabs/chunks to serialized index, make sure
+# indexing sample.cpp would yield non-trivial values for those.
+# RUN: dexp %/S/Inputs/sample.idx -c="find B" | grep Bar
+
Index: clang-tools-extra/clangd/test/index-serialization/Inputs/sample.h
===================================================================
--- /dev/null
+++ clang-tools-extra/clangd/test/index-serialization/Inputs/sample.h
@@ -0,0 +1,4 @@
+#pragma once
+
+// Introduce a symbol.
+struct Foo {};
Index: clang-tools-extra/clangd/test/index-serialization/Inputs/sample.cpp
===================================================================
--- /dev/null
+++ clang-tools-extra/clangd/test/index-serialization/Inputs/sample.cpp
@@ -0,0 +1,5 @@
+// Include a file to ensure we have multiple sources.
+#include "sample.h"
+
+// This introduces a symbol, a reference and a relation.
+struct Bar : public Foo {};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91330.305096.patch
Type: text/x-patch
Size: 2581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201113/04312aa3/attachment.bin>


More information about the cfe-commits mailing list