[clang-tools-extra] 076dd0a - [clangd] Speed up an unfortunate timer-based test.
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Fri May 6 07:29:28 PDT 2022
Author: Sam McCall
Date: 2022-05-06T16:29:10+02:00
New Revision: 076dd0a763fd803897b0f806e0e350a27d2c087c
URL: https://github.com/llvm/llvm-project/commit/076dd0a763fd803897b0f806e0e350a27d2c087c
DIFF: https://github.com/llvm/llvm-project/commit/076dd0a763fd803897b0f806e0e350a27d2c087c.diff
LOG: [clangd] Speed up an unfortunate timer-based test.
Added:
Modified:
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
index 919f69c37840..790ce65b1ec7 100644
--- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
@@ -250,19 +250,18 @@ TEST_F(TUSchedulerTests, Debounce) {
std::atomic<int> CallbackCount(0);
{
auto Opts = optsForTest();
- Opts.UpdateDebounce = DebouncePolicy::fixed(std::chrono::seconds(1));
+ Opts.UpdateDebounce = DebouncePolicy::fixed(std::chrono::milliseconds(100));
TUScheduler S(CDB, Opts, captureDiags());
- // FIXME: we could probably use timeouts lower than 1 second here.
auto Path = testPath("foo.cpp");
updateWithDiags(S, Path, "auto (debounced)", WantDiagnostics::Auto,
[&](std::vector<Diag>) {
ADD_FAILURE()
<< "auto should have been debounced and canceled";
});
- std::this_thread::sleep_for(std::chrono::milliseconds(200));
+ std::this_thread::sleep_for(std::chrono::milliseconds(20));
updateWithDiags(S, Path, "auto (timed out)", WantDiagnostics::Auto,
[&](std::vector<Diag>) { ++CallbackCount; });
- std::this_thread::sleep_for(std::chrono::seconds(2));
+ std::this_thread::sleep_for(std::chrono::milliseconds(200));
updateWithDiags(S, Path, "auto (shut down)", WantDiagnostics::Auto,
[&](std::vector<Diag>) { ++CallbackCount; });
More information about the cfe-commits
mailing list