mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
tests: propagate critical error marks instead of recalculating for children (IDEA-148322)
This commit is contained in:
+13
-27
@@ -66,7 +66,6 @@ public class SMTestProxy extends AbstractTestProxy {
|
||||
private Long myDuration = null; // duration is unknown
|
||||
private boolean myDurationIsCached = false; // is used for separating unknown and unset duration
|
||||
private boolean myHasCriticalErrors = false;
|
||||
private boolean myHasErrorsCached = false;
|
||||
private boolean myHasPassedTests = false;
|
||||
private boolean myHasPassedTestsCached = false;
|
||||
|
||||
@@ -144,32 +143,7 @@ public class SMTestProxy extends AbstractTestProxy {
|
||||
}
|
||||
|
||||
public boolean hasErrors() {
|
||||
// if already cached
|
||||
if (myHasErrorsCached) {
|
||||
return myHasCriticalErrors;
|
||||
}
|
||||
|
||||
final boolean canCacheErrors = !myState.isInProgress();
|
||||
// calculate
|
||||
final boolean hasErrors = calcHasErrors();
|
||||
if (canCacheErrors || hasErrors) {
|
||||
myHasCriticalErrors = hasErrors;
|
||||
myHasErrorsCached = true;
|
||||
}
|
||||
return hasErrors;
|
||||
}
|
||||
|
||||
private boolean calcHasErrors() {
|
||||
if (myHasCriticalErrors) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (SMTestProxy child : getChildren()) {
|
||||
if (child.hasErrors()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return myHasCriticalErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -608,6 +582,9 @@ public class SMTestProxy extends AbstractTestProxy {
|
||||
|
||||
public void addError(final String output, @Nullable final String stackTrace, boolean isCritical) {
|
||||
myHasCriticalErrors = isCritical;
|
||||
if (isCritical) {
|
||||
invalidateCachedHasErrorMark();
|
||||
}
|
||||
setStacktraceIfNotSet(stackTrace);
|
||||
|
||||
addLast(new Printable() {
|
||||
@@ -619,6 +596,15 @@ public class SMTestProxy extends AbstractTestProxy {
|
||||
});
|
||||
}
|
||||
|
||||
private void invalidateCachedHasErrorMark() {
|
||||
myHasCriticalErrors = true;
|
||||
// Invalidates hasError state of container suite
|
||||
final SMTestProxy containerSuite = getParent();
|
||||
if (containerSuite != null && !containerSuite.hasErrors()) {
|
||||
containerSuite.invalidateCachedHasErrorMark();
|
||||
}
|
||||
}
|
||||
|
||||
public void addSystemOutput(final String output) {
|
||||
addLast(new Printable() {
|
||||
public void printOn(final Printer printer) {
|
||||
|
||||
Reference in New Issue
Block a user