Author: Kadir Cetinkaya Date: 2023-08-22T16:20:15+02:00 New Revision: 8c21544286a0cf5eba7df67e23e3b7265364e752
URL: https://github.com/llvm/llvm-project/commit/8c21544286a0cf5eba7df67e23e3b7265364e752 DIFF: https://github.com/llvm/llvm-project/commit/8c21544286a0cf5eba7df67e23e3b7265364e752.diff LOG: [clangd] Bump timeouts for LSPServerTests We seem to be hitting limits in some windows build bots, see https://github.com/clangd/clangd/issues/1712#issuecomment-1686478931. So bumping the timeouts to 60 seconds and completely dropping them for sync requests. As mentioned in the comment above, this should improve things, considering even the tests that don't touch any complicated scheduler is failing. Differential Revision: https://reviews.llvm.org/D158426 Added: Modified: clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp clang-tools-extra/clangd/unittests/LSPClient.cpp clang-tools-extra/clangd/unittests/LSPClient.h Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp index 4c6a238bbb261f..15d4be8dd9ba91 100644 --- a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp +++ b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp @@ -8,19 +8,38 @@ #include "Annotations.h" #include "ClangdLSPServer.h" +#include "ClangdServer.h" +#include "ConfigProvider.h" +#include "Diagnostics.h" +#include "FeatureModule.h" +#include "LSPBinder.h" #include "LSPClient.h" -#include "Protocol.h" #include "TestFS.h" +#include "support/Function.h" #include "support/Logger.h" #include "support/TestTracer.h" +#include "support/Threading.h" +#include "clang/Basic/Diagnostic.h" +#include "clang/Basic/LLVM.h" +#include "llvm/ADT/FunctionExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/JSON.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/Testing/Support/Error.h" #include "llvm/Testing/Support/SupportHelpers.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include <cassert> +#include <condition_variable> +#include <cstddef> +#include <deque> +#include <memory> +#include <mutex> #include <optional> +#include <thread> +#include <utility> namespace clang { namespace clangd { @@ -358,7 +377,7 @@ TEST_F(LSPTest, FeatureModulesThreadingTest) { Client.notify("increment", nullptr); Client.notify("increment", nullptr); Client.notify("increment", nullptr); - EXPECT_THAT_EXPECTED(Client.call("sync", nullptr).take(), Succeeded()); + Client.sync(); EXPECT_EQ(3, FeatureModules.get<AsyncCounter>()->getSync()); // Throw some work on the queue to make sure shutdown blocks on it. Client.notify("increment", nullptr); diff --git a/clang-tools-extra/clangd/unittests/LSPClient.cpp b/clang-tools-extra/clangd/unittests/LSPClient.cpp index 9361c0e29c91e7..4d8ba137e8c55d 100644 --- a/clang-tools-extra/clangd/unittests/LSPClient.cpp +++ b/clang-tools-extra/clangd/unittests/LSPClient.cpp @@ -12,21 +12,36 @@ #include "Transport.h" #include "support/Logger.h" #include "support/Threading.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/JSON.h" #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" #include "gtest/gtest.h" #include <condition_variable> +#include <cstddef> +#include <cstdint> +#include <deque> +#include <functional> +#include <memory> +#include <mutex> #include <optional> #include <queue> +#include <string> +#include <utility> +#include <vector> namespace clang { namespace clangd { llvm::Expected<llvm::json::Value> clang::clangd::LSPClient::CallResult::take() { std::unique_lock<std::mutex> Lock(Mu); - if (!clangd::wait(Lock, CV, timeoutSeconds(10), + static constexpr size_t TimeoutSecs = 60; + if (!clangd::wait(Lock, CV, timeoutSeconds(TimeoutSecs), [this] { return Value.has_value(); })) { - ADD_FAILURE() << "No result from call after 10 seconds!"; + ADD_FAILURE() << "No result from call after " << TimeoutSecs << " seconds!"; return llvm::json::Value(nullptr); } auto Res = std::move(*Value); diff --git a/clang-tools-extra/clangd/unittests/LSPClient.h b/clang-tools-extra/clangd/unittests/LSPClient.h index be8bd42b84df13..3d459076321aca 100644 --- a/clang-tools-extra/clangd/unittests/LSPClient.h +++ b/clang-tools-extra/clangd/unittests/LSPClient.h @@ -9,12 +9,14 @@ #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_UNITTESTS_LSPCLIENT_H #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_UNITTESTS_LSPCLIENT_H +#include "llvm/ADT/StringRef.h" +#include <condition_variable> #include <llvm/Support/Error.h> #include <llvm/Support/JSON.h> -#include <condition_variable> -#include <deque> +#include <memory> #include <mutex> #include <optional> +#include <vector> namespace clang { namespace clangd { @@ -32,7 +34,7 @@ class LSPClient { class CallResult { public: ~CallResult(); - // Blocks up to 10 seconds for the result to be ready. + // Blocks up to 60 seconds for the result to be ready. // Records a test failure if there was no reply. llvm::Expected<llvm::json::Value> take(); // Like take(), but records a test failure if the result was an error. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits