[PATCH] D68273: [clangd] Fix raciness in code completion tests

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 2 12:32:27 PDT 2019


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp:1141
+    ReceivedRequestCV.wait(Lock,
+                           [this, Num] { return NumRequestsReceived == Num; });
+    NumRequestsReceived = 0;
----------------
ilya-biryukov wrote:
> Could we wait with timeout here (a really high one, e.g. 10 seconds) here and assert we did not hit the timeout?
> The `wait` helper from `Threading.h` is a nice API to do this.
> 
> This would ensure the test never actually runs into an infinite loop in practice.
I don't think it is that important, but sure I suppose a failing test is better than a hanging one :D


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68273





More information about the cfe-commits mailing list