[clang-tools-extra] 81e48ae - [clangd] Reland LSP latency test

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Sun May 3 12:08:45 PDT 2020


Author: Kadir Cetinkaya
Date: 2020-05-03T21:06:57+02:00
New Revision: 81e48ae2b4a55cb79a0f104d5562bbf3a22ec4ff

URL: https://github.com/llvm/llvm-project/commit/81e48ae2b4a55cb79a0f104d5562bbf3a22ec4ff
DIFF: https://github.com/llvm/llvm-project/commit/81e48ae2b4a55cb79a0f104d5562bbf3a22ec4ff.diff

LOG: [clangd] Reland LSP latency test

Added: 
    

Modified: 
    clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
index d8d7e7a6f7da..c60b264baa9c 100644
--- a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
@@ -149,6 +149,16 @@ TEST_F(LSPTest, DiagnosticsHeaderSaved) {
               llvm::ValueIs(testing::ElementsAre(
                   DiagMessage("Use of undeclared identifier 'changed'"))));
 }
+
+TEST_F(LSPTest, RecordsLatencies) {
+  trace::TestTracer Tracer;
+  auto &Client = start();
+  llvm::StringLiteral MethodName = "method_name";
+  EXPECT_THAT(Tracer.takeMetric("lsp_latency", MethodName), testing::SizeIs(0));
+  llvm::consumeError(Client.call(MethodName, {}).take().takeError());
+  Client.sync();
+  EXPECT_THAT(Tracer.takeMetric("lsp_latency", MethodName), testing::SizeIs(1));
+}
 } // namespace
 } // namespace clangd
 } // namespace clang


        


More information about the cfe-commits mailing list