From ba34c2a75c28007d4cd1015e1921031e39ef1c35 Mon Sep 17 00:00:00 2001 From: Ernest Borowski Date: Mon, 27 Jul 2020 00:48:45 +0200 Subject: [PATCH 1/2] Fix tests hanging in MultiQueueWaiter destructor. std::condition_variable_any destructor is only safe to invoke if all threads have been notified. Reference: https://en.cppreference.com/w/cpp/thread/condition_variable_any/%7Econdition_variable_any Signed-off-by: Ernest Borowski --- src/threaded_queue.hh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/threaded_queue.hh b/src/threaded_queue.hh index c2927640..bca221b8 100644 --- a/src/threaded_queue.hh +++ b/src/threaded_queue.hh @@ -46,6 +46,9 @@ private: struct MultiQueueWaiter { std::condition_variable_any cv; + ~MultiQueueWaiter() { + cv.notify_all(); + } static bool hasState(std::initializer_list queues) { for (BaseThreadQueue *queue : queues) { From 6a34664f329f110e10e009988d9d31c106c46562 Mon Sep 17 00:00:00 2001 From: Ernest Borowski Date: Mon, 27 Jul 2020 00:56:49 +0200 Subject: [PATCH 2/2] Allow to execute tests with clang >= 6.0.0. Signed-off-by: Ernest Borowski --- src/test.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test.cc b/src/test.cc index d74d4496..7918440b 100644 --- a/src/test.cc +++ b/src/test.cc @@ -260,15 +260,16 @@ findDbForPathEnding(const std::string &path, bool runIndexTests(const std::string &filter_path, bool enable_update) { gTestOutputMode = true; std::string version = LLVM_VERSION_STRING; + const int majorVersion = LLVM_VERSION_MAJOR; // Index tests change based on the version of clang used. - static const char kRequiredClangVersion[] = "6.0.0"; - if (version != kRequiredClangVersion && + const int kMinRequiredClangVersion = 6; + if (majorVersion < kMinRequiredClangVersion && version.find("svn") == std::string::npos) { fprintf(stderr, - "Index tests must be run using clang version %s, ccls is running " + "Index tests must be run using clang major version >= %d, ccls is running " "with %s\n", - kRequiredClangVersion, version.c_str()); + kMinRequiredClangVersion, version.c_str()); return false; }