minimize test history file size: don't load output stored to file, ensure output...
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Fri, 28 Aug 2015 17:25:55 +0000 (20:25 +0300)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Fri, 28 Aug 2015 18:05:47 +0000 (21:05 +0300)
platform/testRunner/src/com/intellij/execution/testframework/CompositePrintable.java
platform/testRunner/src/com/intellij/execution/testframework/export/TestResultsXmlFormatter.java

index 9ab852bfca6776ab8fb001e285479f82657d4645..fbb0602b7c32b9f4a2f0e958d896db2f7fac2d37 100644 (file)
@@ -78,7 +78,7 @@ public class CompositePrintable implements Printable, Disposable {
         printables.add(printable);
       }
     }
-    myWrapper.printOn(printer, printables);
+    myWrapper.printOn(printer, printables, true);
   }
 
   public void addLast(@NotNull final Printable printable) {
@@ -224,9 +224,17 @@ public class CompositePrintable implements Printable, Disposable {
     }
 
     public void printOn(final Printer console, final List<Printable> printables) {
+      printOn(console, printables, false);
+    }
+
+    public void printOn(final Printer console, final List<Printable> printables, final boolean skipFileContent) {
       final Runnable request = new Runnable() {
         @Override
         public void run() {
+          if (skipFileContent) {
+            readFileContentAndPrint(console, null, printables);
+            return;
+          }
           final File file = hasOutput() ? getFile() : null;
           synchronized (myFileLock) {
             readFileContentAndPrint(console, file, printables);
index 21b1dd767a3947633921afaa7040781ca6434177..e6a4a752797f1f81f58b1009a2795859cdb9fddf 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.execution.ExecutionBundle;
 import com.intellij.execution.configurations.RunConfiguration;
 import com.intellij.execution.filters.*;
 import com.intellij.execution.filters.Filter;
+import com.intellij.execution.impl.ConsoleBuffer;
 import com.intellij.execution.impl.RunManagerImpl;
 import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl;
 import com.intellij.execution.testframework.*;
@@ -237,9 +238,11 @@ public class TestResultsXmlFormatter {
     final Ref<ConsoleViewContentType> lastType = new Ref<ConsoleViewContentType>();
     final Ref<SAXException> error = new Ref<SAXException>();
 
+    final int bufferSize = ConsoleBuffer.useCycleBuffer() ? ConsoleBuffer.getCycleBufferSize() : -1;
     final Printer printer = new Printer() {
       @Override
       public void print(String text, ConsoleViewContentType contentType) {
+        ProgressManager.checkCanceled();
         if (contentType != lastType.get()) {
           if (buffer.length() > 0) {
             try {
@@ -251,7 +254,9 @@ public class TestResultsXmlFormatter {
           }
           lastType.set(contentType);
         }
-        buffer.append(text);
+        if (bufferSize < 0 || buffer.length() < bufferSize) {
+          buffer.append(text);
+        }
       }
 
       @Override