Log full thread dump in case of timeout waiting for a promise
authorDmitry Jemerov <yole@jetbrains.com>
Wed, 25 May 2022 13:21:20 +0000 (15:21 +0200)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Wed, 25 May 2022 17:02:19 +0000 (17:02 +0000)
GitOrigin-RevId: 2d664fa96a4867eafe6df5671c756998bd9cd622

platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java

index cbd910b052dd6a88a76b6d5133b95a67a4bf0c47..9f6a537047a0e8398f535475e728f6d1fbbf4670 100644 (file)
@@ -3,6 +3,7 @@ package com.intellij.testFramework;
 
 import com.intellij.configurationStore.StateStorageManagerKt;
 import com.intellij.configurationStore.StoreReloadManager;
+import com.intellij.diagnostic.ThreadDumper;
 import com.intellij.execution.*;
 import com.intellij.execution.actions.ConfigurationContext;
 import com.intellij.execution.actions.ConfigurationFromContext;
@@ -281,7 +282,10 @@ public final class PlatformTestUtil {
 
   private static void assertMaxWaitTimeSince(long startTimeMillis, long timeout) {
     long took = getMillisSince(startTimeMillis);
-    assert took <= timeout : String.format("the waiting takes too long. Expected to take no more than: %d ms but took: %d ms", timeout, took);
+    if (took > timeout) {
+      assert false : String.format("the waiting takes too long. Expected to take no more than: %d ms but took: %d ms\nThread dump: %s",
+                                   timeout, took, ThreadDumper.dumpThreadsToString());
+    }
   }
 
   private static void assertDispatchThreadWithoutWriteAccess() {