Skip to content

Commit

Permalink
introduce timeout for hanging highlighting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cdracm committed Nov 9, 2015
1 parent a6bf2c1 commit 749aeb1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.codeInsight.intention.impl.FileLevelIntentionComponent;
import com.intellij.codeInsight.intention.impl.IntentionHintComponent;
import com.intellij.diagnostic.ThreadDumper;
import com.intellij.ide.PowerSaveMode;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.Disposable;
Expand Down Expand Up @@ -343,7 +344,8 @@ List<HighlightInfo> runPasses(@NotNull PsiFile file,
final DaemonProgressIndicator progress = createUpdateProgress();
myPassExecutorService.submitPasses(map, progress);
try {
while (progress.isRunning()) {
long start = System.currentTimeMillis();
while (progress.isRunning() && System.currentTimeMillis() < start + 5*60*1000) {
wrap(new ThrowableRunnable() {
@Override
public void run() throws Throwable {
Expand All @@ -358,6 +360,9 @@ public void run() throws Throwable {
}
});
}
if (progress.isRunning()) {
throw new RuntimeException("Highlighting still running after "+(System.currentTimeMillis()-start)/1000+" seconds.\n"+ ThreadDumper.dumpThreadsToString());
}

final HighlightingSessionImpl session =
(HighlightingSessionImpl)HighlightingSessionImpl.getOrCreateHighlightingSession(file, textEditors.get(0).getEditor(), progress, null);
Expand Down

0 comments on commit 749aeb1

Please sign in to comment.