logging around daemon execution in tests

to hopefully help a bit the next time it's canceled for a mysterious reason
This commit is contained in:
peter
2017-08-07 13:41:15 +02:00
parent 82521c0487
commit c8b9a68450
3 changed files with 13 additions and 3 deletions
@@ -308,6 +308,7 @@ class RefCountHolder {
ProgressIndicator result;
if (myState.compareAndSet(EMPTY, indicator)) {
if (!file.getTextRange().equals(dirtyScope)) {
log(" RefCountHolder: invalid scope " + dirtyScope);
// empty holder needs filling before it can be used, so restart daemon to re-analyze the whole file
myState.set(EMPTY);
return false;
@@ -68,6 +68,15 @@ public class ProgressWrapper extends AbstractProgressIndicatorBase implements Wr
}
}
@Nullable
@Override
protected Throwable getCancellationTrace() {
if (myOriginal instanceof AbstractProgressIndicatorBase) {
return ((AbstractProgressIndicatorBase)myOriginal).getCancellationTrace();
}
return super.getCancellationTrace();
}
private boolean isCanceledRaw() { return super.isCanceled(); }
private void checkCanceledRaw() { super.checkCanceled(); }
@@ -207,7 +207,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
DaemonCodeAnalyzerSettings settings = DaemonCodeAnalyzerSettings.getInstance();
ProcessCanceledException exception = null;
for (int i = 0; i < 1000; i++) {
int retries = 1000;
for (int i = 0; i < retries; i++) {
int oldDelay = settings.AUTOREPARSE_DELAY;
try {
settings.AUTOREPARSE_DELAY = 0;
@@ -231,8 +232,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
settings.AUTOREPARSE_DELAY = oldDelay;
}
}
// unable to highlight after 100 retries
throw exception;
throw new AssertionError("Unable to highlight after " + retries + " retries", exception);
}
public static void ensureIndexesUpToDate(@NotNull Project project) {