Blame SOURCES/clangd-tests.patch

d4a856
diff --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
d4a856
index 0c9455f..22638ee 100644
d4a856
--- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
d4a856
+++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
d4a856
@@ -451,123 +451,6 @@ TEST_F(TUSchedulerTests, InvalidationUnchanged) {
d4a856
   EXPECT_EQ(1, Actions.load()) << "All actions should run";
d4a856
 }
d4a856
 
d4a856
-TEST_F(TUSchedulerTests, ManyUpdates) {
d4a856
-  const int FilesCount = 3;
d4a856
-  const int UpdatesPerFile = 10;
d4a856
-
d4a856
-  std::mutex Mut;
d4a856
-  int TotalASTReads = 0;
d4a856
-  int TotalPreambleReads = 0;
d4a856
-  int TotalUpdates = 0;
d4a856
-  llvm::StringMap<int> LatestDiagVersion;
d4a856
-
d4a856
-  // Run TUScheduler and collect some stats.
d4a856
-  {
d4a856
-    auto Opts = optsForTest();
d4a856
-    Opts.UpdateDebounce = DebouncePolicy::fixed(std::chrono::milliseconds(50));
d4a856
-    TUScheduler S(CDB, Opts, captureDiags());
d4a856
-
d4a856
-    std::vector<std::string> Files;
d4a856
-    for (int I = 0; I < FilesCount; ++I) {
d4a856
-      std::string Name = "foo" + std::to_string(I) + ".cpp";
d4a856
-      Files.push_back(testPath(Name));
d4a856
-      this->FS.Files[Files.back()] = "";
d4a856
-    }
d4a856
-
d4a856
-    StringRef Contents1 = R"cpp(int a;)cpp";
d4a856
-    StringRef Contents2 = R"cpp(int main() { return 1; })cpp";
d4a856
-    StringRef Contents3 = R"cpp(int a; int b; int sum() { return a + b; })cpp";
d4a856
-
d4a856
-    StringRef AllContents[] = {Contents1, Contents2, Contents3};
d4a856
-    const int AllContentsSize = 3;
d4a856
-
d4a856
-    // Scheduler may run tasks asynchronously, but should propagate the
d4a856
-    // context. We stash a nonce in the context, and verify it in the task.
d4a856
-    static Key<int> NonceKey;
d4a856
-    int Nonce = 0;
d4a856
-
d4a856
-    for (int FileI = 0; FileI < FilesCount; ++FileI) {
d4a856
-      for (int UpdateI = 0; UpdateI < UpdatesPerFile; ++UpdateI) {
d4a856
-        auto Contents = AllContents[(FileI + UpdateI) % AllContentsSize];
d4a856
-
d4a856
-        auto File = Files[FileI];
d4a856
-        auto Inputs = getInputs(File, Contents.str());
d4a856
-        {
d4a856
-          WithContextValue WithNonce(NonceKey, ++Nonce);
d4a856
-          Inputs.Version = std::to_string(UpdateI);
d4a856
-          updateWithDiags(
d4a856
-              S, File, Inputs, WantDiagnostics::Auto,
d4a856
-              [File, Nonce, Version(Inputs.Version), &Mut, &TotalUpdates,
d4a856
-               &LatestDiagVersion](std::vector<Diag>) {
d4a856
-                EXPECT_THAT(Context::current().get(NonceKey), Pointee(Nonce));
d4a856
-                EXPECT_EQ(File, boundPath());
d4a856
-
d4a856
-                std::lock_guard<std::mutex> Lock(Mut);
d4a856
-                ++TotalUpdates;
d4a856
-                EXPECT_EQ(File, *TUScheduler::getFileBeingProcessedInContext());
d4a856
-                // Make sure Diags are for a newer version.
d4a856
-                auto It = LatestDiagVersion.try_emplace(File, -1);
d4a856
-                const int PrevVersion = It.first->second;
d4a856
-                int CurVersion;
d4a856
-                ASSERT_TRUE(llvm::to_integer(Version, CurVersion, 10));
d4a856
-                EXPECT_LT(PrevVersion, CurVersion);
d4a856
-                It.first->getValue() = CurVersion;
d4a856
-              });
d4a856
-        }
d4a856
-        {
d4a856
-          WithContextValue WithNonce(NonceKey, ++Nonce);
d4a856
-          S.runWithAST(
d4a856
-              "CheckAST", File,
d4a856
-              [File, Inputs, Nonce, &Mut,
d4a856
-               &TotalASTReads](Expected<InputsAndAST> AST) {
d4a856
-                EXPECT_THAT(Context::current().get(NonceKey), Pointee(Nonce));
d4a856
-                EXPECT_EQ(File, boundPath());
d4a856
-
d4a856
-                ASSERT_TRUE((bool)AST);
d4a856
-                EXPECT_EQ(AST->Inputs.Contents, Inputs.Contents);
d4a856
-                EXPECT_EQ(AST->Inputs.Version, Inputs.Version);
d4a856
-                EXPECT_EQ(AST->AST.version(), Inputs.Version);
d4a856
-
d4a856
-                std::lock_guard<std::mutex> Lock(Mut);
d4a856
-                ++TotalASTReads;
d4a856
-                EXPECT_EQ(File, *TUScheduler::getFileBeingProcessedInContext());
d4a856
-              });
d4a856
-        }
d4a856
-
d4a856
-        {
d4a856
-          WithContextValue WithNonce(NonceKey, ++Nonce);
d4a856
-          S.runWithPreamble(
d4a856
-              "CheckPreamble", File, TUScheduler::Stale,
d4a856
-              [File, Inputs, Nonce, &Mut,
d4a856
-               &TotalPreambleReads](Expected<InputsAndPreamble> Preamble) {
d4a856
-                EXPECT_THAT(Context::current().get(NonceKey), Pointee(Nonce));
d4a856
-                EXPECT_EQ(File, boundPath());
d4a856
-
d4a856
-                ASSERT_TRUE((bool)Preamble);
d4a856
-                EXPECT_EQ(Preamble->Contents, Inputs.Contents);
d4a856
-
d4a856
-                std::lock_guard<std::mutex> Lock(Mut);
d4a856
-                ++TotalPreambleReads;
d4a856
-                EXPECT_EQ(File, *TUScheduler::getFileBeingProcessedInContext());
d4a856
-              });
d4a856
-        }
d4a856
-      }
d4a856
-    }
d4a856
-    ASSERT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
d4a856
-  } // TUScheduler destructor waits for all operations to finish.
d4a856
-
d4a856
-  std::lock_guard<std::mutex> Lock(Mut);
d4a856
-  // Updates might get coalesced in preamble thread and result in dropping
d4a856
-  // diagnostics for intermediate snapshots.
d4a856
-  EXPECT_GE(TotalUpdates, FilesCount);
d4a856
-  EXPECT_LE(TotalUpdates, FilesCount * UpdatesPerFile);
d4a856
-  // We should receive diags for last update.
d4a856
-  for (const auto &Entry : LatestDiagVersion)
d4a856
-    EXPECT_EQ(Entry.second, UpdatesPerFile - 1);
d4a856
-  EXPECT_EQ(TotalASTReads, FilesCount * UpdatesPerFile);
d4a856
-  EXPECT_EQ(TotalPreambleReads, FilesCount * UpdatesPerFile);
d4a856
-}
d4a856
-
d4a856
 TEST_F(TUSchedulerTests, EvictedAST) {
d4a856
   std::atomic<int> BuiltASTCounter(0);
d4a856
   auto Opts = optsForTest();