Show a summary of failures at the end of a vogar run.

Super-useful when running a large batch of jtreg tests, and also useful
for comparing against an earlier run (though hopefully we'll have a better
solution for that eventually).

Change-Id: I144f72ea1ae5240393b0b33193d7773537b7ee20
diff --git a/libcore/tools/runner/java/vogar/Console.java b/libcore/tools/runner/java/vogar/Console.java
index f141cc9..54c8f51 100644
--- a/libcore/tools/runner/java/vogar/Console.java
+++ b/libcore/tools/runner/java/vogar/Console.java
@@ -18,6 +18,7 @@
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.util.List;
 import java.util.logging.ConsoleHandler;
 import java.util.logging.Formatter;
 import java.util.logging.Level;
@@ -135,6 +136,13 @@
         currentLine = CurrentLine.NEW;
     }
 
+    public void summarizeFailures(List<String> failureNames) {
+        System.out.println("Failure summary:");
+        for (String failureName : failureNames) {
+            System.out.println(red(failureName));
+        }
+    }
+
     /**
      * Prints the action output with appropriate indentation.
      */
diff --git a/libcore/tools/runner/java/vogar/Driver.java b/libcore/tools/runner/java/vogar/Driver.java
index d6f045a..40dcf58 100644
--- a/libcore/tools/runner/java/vogar/Driver.java
+++ b/libcore/tools/runner/java/vogar/Driver.java
@@ -17,6 +17,7 @@
 package vogar;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -54,6 +55,7 @@
     private final long timeoutSeconds;
     private int successes = 0;
     private int failures = 0;
+    private List<String> failureNames = new ArrayList<String>();
 
     private Timer actionTimeoutTimer = new Timer("action timeout", true);
 
@@ -188,6 +190,8 @@
         }
 
         if (failures > 0 || unsupportedActions > 0) {
+            Collections.sort(failureNames);
+            console.summarizeFailures(failureNames);
             logger.info(String.format("Outcomes: %s. Passed: %d, Failed: %d, Skipped: %d",
                     (successes + failures), successes, failures, unsupportedActions));
         } else {
@@ -253,6 +257,7 @@
             successes++;
         } else {
             failures++;
+            failureNames.add(outcome.getName());
         }
         console.outcome(outcome.getName());
         console.printResult(outcome.getResult(), ok);