Do not output XFAIL/XPASS.

The parser for treehugger does not understand these output values and
they are hard to understand.

Also, add a list description to make it clear what tests are failing and
why.

Test: Unit tests pass.
Test: Verify that bionic unit tests pass in treehugger.
Change-Id: I7911f96c5e7f9270ea97038435502bbd79d65d66
diff --git a/Isolate.cpp b/Isolate.cpp
index e2e2f33..58283fd 100644
--- a/Isolate.cpp
+++ b/Isolate.cpp
@@ -413,18 +413,16 @@
   }
 }
 
-void Isolate::PrintResults(size_t total, const char* color, const char* prefix, const char* title,
-                           std::string* footer, bool (*match_func)(const Test&),
-                           void (*print_func)(const Options&, const Test&)) {
-  ColoredPrintf(color, prefix);
-  printf(" %s, listed below:\n", PluralizeString(total, " test").c_str());
+void Isolate::PrintResults(size_t total, const ResultsType& results, std::string* footer) {
+  ColoredPrintf(results.color, results.prefix);
+  printf(" %s %s, listed below:\n", PluralizeString(total, " test").c_str(), results.list_desc);
   for (const auto& entry : finished_) {
     const Test* test = entry.second.get();
-    if (match_func(*test)) {
-      ColoredPrintf(color, prefix);
+    if (results.match_func(*test)) {
+      ColoredPrintf(results.color, results.prefix);
       printf(" %s", test->name().c_str());
-      if (print_func) {
-        print_func(options_, *test);
+      if (results.print_func != nullptr) {
+        results.print_func(options_, *test);
       }
       printf("\n");
     }
@@ -432,9 +430,53 @@
   if (total < 10) {
     *footer += ' ';
   }
-  *footer += PluralizeString(total, (std::string(" ") + title + " TEST").c_str(), true) + '\n';
+  *footer +=
+      PluralizeString(total, (std::string(" ") + results.title + " TEST").c_str(), true) + '\n';
 }
 
+Isolate::ResultsType Isolate::SlowResults = {
+    .color = COLOR_YELLOW,
+    .prefix = "[   SLOW   ]",
+    .list_desc = "slow",
+    .title = "SLOW",
+    .match_func = [](const Test& test) { return test.slow(); },
+    .print_func =
+        [](const Options& options, const Test& test) {
+          printf(" (%" PRIu64 " ms, exceeded %" PRIu64 " ms)", test.RunTimeNs() / kNsPerMs,
+                 options.slow_threshold_ms());
+        },
+};
+
+Isolate::ResultsType Isolate::XpassFailResults = {
+    .color = COLOR_RED,
+    .prefix = "[   FAIL   ]",
+    .list_desc = "should have failed",
+    .title = "SHOULD HAVE FAILED",
+    .match_func = [](const Test& test) { return test.result() == TEST_XPASS; },
+    .print_func = nullptr,
+};
+
+Isolate::ResultsType Isolate::FailResults = {
+    .color = COLOR_RED,
+    .prefix = "[   FAIL   ]",
+    .list_desc = "failed",
+    .title = "FAILED",
+    .match_func = [](const Test& test) { return test.result() == TEST_FAIL; },
+    .print_func = nullptr,
+};
+
+Isolate::ResultsType Isolate::TimeoutResults = {
+    .color = COLOR_RED,
+    .prefix = "[ TIMEOUT  ]",
+    .list_desc = "timed out",
+    .title = "TIMEOUT",
+    .match_func = [](const Test& test) { return test.result() == TEST_TIMEOUT; },
+    .print_func =
+        [](const Options&, const Test& test) {
+          printf(" (stopped at %" PRIu64 " ms)", test.RunTimeNs() / kNsPerMs);
+        },
+};
+
 void Isolate::PrintFooter(uint64_t elapsed_time_ns) {
   ColoredPrintf(COLOR_GREEN, "[==========]");
   printf(" %s from %s ran. (%" PRId64 " ms total)\n",
@@ -451,33 +493,22 @@
   std::string footer;
   // Tests that ran slow.
   if (total_slow_tests_ != 0) {
-    PrintResults(total_slow_tests_, COLOR_YELLOW, "[   SLOW   ]", "SLOW", &footer,
-                 [](const Test& test) { return test.slow(); },
-                 [](const Options& options, const Test& test) {
-                   printf(" (%" PRIu64 " ms, exceeded %" PRIu64 " ms)", test.RunTimeNs() / kNsPerMs,
-                          options.slow_threshold_ms());
-                 });
+    PrintResults(total_slow_tests_, SlowResults, &footer);
   }
 
   // Tests that passed but should have failed.
   if (total_xpass_tests_ != 0) {
-    PrintResults(total_xpass_tests_, COLOR_RED, "[  XPASS   ]", "SHOULD HAVE FAILED", &footer,
-                 [](const Test& test) { return test.result() == TEST_XPASS; }, nullptr);
+    PrintResults(total_xpass_tests_, XpassFailResults, &footer);
   }
 
   // Tests that timed out.
   if (total_timeout_tests_ != 0) {
-    PrintResults(total_timeout_tests_, COLOR_RED, "[ TIMEOUT  ]", "TIMEOUT", &footer,
-                 [](const Test& test) { return test.result() == TEST_TIMEOUT; },
-                 [](const Options&, const Test& test) {
-                   printf(" (stopped at %" PRIu64 " ms)", test.RunTimeNs() / kNsPerMs);
-                 });
+    PrintResults(total_timeout_tests_, TimeoutResults, &footer);
   }
 
   // Tests that failed.
   if (total_fail_tests_ != 0) {
-    PrintResults(total_fail_tests_, COLOR_RED, "[   FAIL   ]", "FAILED", &footer,
-                 [](const Test& test) { return test.result() == TEST_FAIL; }, nullptr);
+    PrintResults(total_fail_tests_, FailResults, &footer);
   }
 
   if (!footer.empty()) {
diff --git a/Isolate.h b/Isolate.h
index a0d7891..fc5166a 100644
--- a/Isolate.h
+++ b/Isolate.h
@@ -45,6 +45,15 @@
   int Run();
 
  private:
+  struct ResultsType {
+    const char* color;
+    const char* prefix;
+    const char* list_desc;
+    const char* title;
+    bool (*match_func)(const Test&);
+    void (*print_func)(const Options&, const Test&);
+  };
+
   size_t CheckTestsFinished();
 
   void CheckTestsTimeout();
@@ -61,9 +70,7 @@
 
   void PrintFooter(uint64_t elapsed_time_ns);
 
-  void PrintResults(size_t total, const char* color, const char* prefix, const char* title,
-                    std::string* footer, bool (*match_func)(const Test&),
-                    void (*print_func)(const Options&, const Test&));
+  void PrintResults(size_t total, const ResultsType& results, std::string* footer);
 
   void WriteXmlResults(uint64_t elapsed_time_ns, time_t start_time);
 
@@ -71,7 +78,6 @@
     return std::get<0>(test) + std::get<1>(test);
   }
 
- private:
   const Options& options_;
   const std::vector<const char*>& child_args_;
 
@@ -99,6 +105,11 @@
   std::map<size_t, std::unique_ptr<Test>> finished_;
 
   static constexpr useconds_t MIN_USECONDS_WAIT = 1000;
+
+  static ResultsType SlowResults;
+  static ResultsType XpassFailResults;
+  static ResultsType FailResults;
+  static ResultsType TimeoutResults;
 };
 
 }  // namespace gtest_extras
diff --git a/Test.cpp b/Test.cpp
index 3e345e9..5fbaa67 100644
--- a/Test.cpp
+++ b/Test.cpp
@@ -78,18 +78,14 @@
   }
 
   switch (result_) {
+    case TEST_XFAIL:
     case TEST_PASS:
       ColoredPrintf(COLOR_GREEN, "[    OK    ]");
       break;
     case TEST_XPASS:
-      ColoredPrintf(COLOR_RED, "[  XPASS   ]");
-      break;
     case TEST_FAIL:
       ColoredPrintf(COLOR_RED, "[  FAILED  ]");
       break;
-    case TEST_XFAIL:
-      ColoredPrintf(COLOR_YELLOW, "[  XFAIL   ]");
-      break;
     case TEST_TIMEOUT:
       ColoredPrintf(COLOR_RED, "[ TIMEOUT  ]");
       break;
diff --git a/tests/SystemTests.cpp b/tests/SystemTests.cpp
index 57d7656..d384317 100644
--- a/tests/SystemTests.cpp
+++ b/tests/SystemTests.cpp
@@ -231,7 +231,7 @@
 TEST_F(SystemTests, verify_xfail_fail_expect_to_fail) {
   std::string expected =
       "[==========] Running 1 test from 1 test case (20 jobs).\n"
-      "[  XFAIL   ] DISABLED_SystemTestsXfail.xfail_fail (XX ms)\n"
+      "[    OK    ] DISABLED_SystemTestsXfail.xfail_fail (XX ms)\n"
       "file:(XX) Failure in test DISABLED_SystemTestsXfail.xfail_fail\n"
       "Expected equality of these values:\n"
       "  1\n"
@@ -245,7 +245,7 @@
 TEST_F(SystemTests, verify_xfail_fail_expect_to_fail_color) {
   std::string expected =
       "\x1B[0;32m[==========]\x1B[m Running 1 test from 1 test case (20 jobs).\n"
-      "\x1B[0;33m[  XFAIL   ]\x1B[m DISABLED_SystemTestsXfail.xfail_fail (XX ms)\n"
+      "\x1B[0;32m[    OK    ]\x1B[m DISABLED_SystemTestsXfail.xfail_fail (XX ms)\n"
       "file:(XX) Failure in test DISABLED_SystemTestsXfail.xfail_fail\n"
       "Expected equality of these values:\n"
       "  1\n"
@@ -276,11 +276,11 @@
 TEST_F(SystemTests, verify_xfail_pass_expect_to_fail) {
   std::string expected =
       "[==========] Running 1 test from 1 test case (20 jobs).\n"
-      "[  XPASS   ] DISABLED_SystemTestsXfail.xfail_pass (XX ms)\n"
+      "[  FAILED  ] DISABLED_SystemTestsXfail.xfail_pass (XX ms)\n"
       "[==========] 1 test from 1 test case ran. (XX ms total)\n"
       "[   PASS   ] 0 tests.\n"
-      "[  XPASS   ] 1 test, listed below:\n"
-      "[  XPASS   ] DISABLED_SystemTestsXfail.xfail_pass\n"
+      "[   FAIL   ] 1 test should have failed, listed below:\n"
+      "[   FAIL   ] DISABLED_SystemTestsXfail.xfail_pass\n"
       "\n"
       " 1 SHOULD HAVE FAILED TEST\n";
   ASSERT_NO_FATAL_FAILURE(Verify("*.xfail_pass", expected, 1));
@@ -293,8 +293,8 @@
       "[  FAILED  ] DISABLED_SystemTestsXfail.xfail_pass (XX ms)\n"
       "[==========] 1 test from 1 test case ran. (XX ms total)\n"
       "[   PASS   ] 0 tests.\n"
-      "[  XPASS   ] 1 test, listed below:\n"
-      "[  XPASS   ] DISABLED_SystemTestsXfail.xfail_pass\n"
+      "[   FAIL   ] 1 test should have failed, listed below:\n"
+      "[   FAIL   ] DISABLED_SystemTestsXfail.xfail_pass\n"
       "\n"
       " 1 SHOULD HAVE FAILED TEST\n";
   ASSERT_NO_FATAL_FAILURE(
@@ -304,11 +304,11 @@
 TEST_F(SystemTests, verify_xfail_pass_expect_to_fail_color) {
   std::string expected =
       "\x1B[0;32m[==========]\x1B[m Running 1 test from 1 test case (20 jobs).\n"
-      "\x1B[0;31m[  XPASS   ]\x1B[m DISABLED_SystemTestsXfail.xfail_pass (XX ms)\n"
+      "\x1B[0;31m[  FAILED  ]\x1B[m DISABLED_SystemTestsXfail.xfail_pass (XX ms)\n"
       "\x1B[0;32m[==========]\x1B[m 1 test from 1 test case ran. (XX ms total)\n"
       "\x1B[0;32m[   PASS   ]\x1B[m 0 tests.\n"
-      "\x1B[0;31m[  XPASS   ]\x1B[m 1 test, listed below:\n"
-      "\x1B[0;31m[  XPASS   ]\x1B[m DISABLED_SystemTestsXfail.xfail_pass\n"
+      "\x1B[0;31m[   FAIL   ]\x1B[m 1 test should have failed, listed below:\n"
+      "\x1B[0;31m[   FAIL   ]\x1B[m DISABLED_SystemTestsXfail.xfail_pass\n"
       "\n"
       " 1 SHOULD HAVE FAILED TEST\n";
   ASSERT_NO_FATAL_FAILURE(
@@ -335,7 +335,7 @@
       "SystemTests.DISABLED_fail exited with exitcode 1.\n"
       "[==========] 1 test from 1 test case ran. (XX ms total)\n"
       "[   PASS   ] 0 tests.\n"
-      "[   FAIL   ] 1 test, listed below:\n"
+      "[   FAIL   ] 1 test failed, listed below:\n"
       "[   FAIL   ] SystemTests.DISABLED_fail\n"
       "\n"
       " 1 FAILED TEST\n";
@@ -353,7 +353,7 @@
       "SystemTests.DISABLED_fail exited with exitcode 1.\n"
       "\x1B[0;32m[==========]\x1B[m 1 test from 1 test case ran. (XX ms total)\n"
       "\x1B[0;32m[   PASS   ]\x1B[m 0 tests.\n"
-      "\x1B[0;31m[   FAIL   ]\x1B[m 1 test, listed below:\n"
+      "\x1B[0;31m[   FAIL   ]\x1B[m 1 test failed, listed below:\n"
       "\x1B[0;31m[   FAIL   ]\x1B[m SystemTests.DISABLED_fail\n"
       "\n"
       " 1 FAILED TEST\n";
@@ -373,7 +373,7 @@
       "[  FAILED  ] SystemTests.DISABLED_fail (XX ms)\n"
       "[==========] 1 test from 1 test case ran. (XX ms total)\n"
       "[   PASS   ] 0 tests.\n"
-      "[   FAIL   ] 1 test, listed below:\n"
+      "[   FAIL   ] 1 test failed, listed below:\n"
       "[   FAIL   ] SystemTests.DISABLED_fail\n"
       "\n"
       " 1 FAILED TEST\n";
@@ -393,7 +393,7 @@
       "\x1B[0;31m[  FAILED  ]\x1B[m SystemTests.DISABLED_fail (XX ms)\n"
       "\x1B[0;32m[==========]\x1B[m 1 test from 1 test case ran. (XX ms total)\n"
       "\x1B[0;32m[   PASS   ]\x1B[m 0 tests.\n"
-      "\x1B[0;31m[   FAIL   ]\x1B[m 1 test, listed below:\n"
+      "\x1B[0;31m[   FAIL   ]\x1B[m 1 test failed, listed below:\n"
       "\x1B[0;31m[   FAIL   ]\x1B[m SystemTests.DISABLED_fail\n"
       "\n"
       " 1 FAILED TEST\n";
@@ -413,7 +413,7 @@
       "SystemTestsDeathTest.DISABLED_death_fail exited with exitcode 1.\n"
       "[==========] 1 test from 1 test case ran. (XX ms total)\n"
       "[   PASS   ] 0 tests.\n"
-      "[   FAIL   ] 1 test, listed below:\n"
+      "[   FAIL   ] 1 test failed, listed below:\n"
       "[   FAIL   ] SystemTestsDeathTest.DISABLED_death_fail\n"
       "\n"
       " 1 FAILED TEST\n";
@@ -431,7 +431,7 @@
 #endif
       "[==========] 1 test from 1 test case ran. (XX ms total)\n"
       "[   PASS   ] 0 tests.\n"
-      "[   FAIL   ] 1 test, listed below:\n"
+      "[   FAIL   ] 1 test failed, listed below:\n"
       "[   FAIL   ] SystemTests.DISABLED_crash\n"
       "\n"
       " 1 FAILED TEST\n";
@@ -444,7 +444,7 @@
       "[    OK    ] SystemTests.DISABLED_sleep5 (XX ms)\n"
       "[==========] 1 test from 1 test case ran. (XX ms total)\n"
       "[   PASS   ] 1 test.\n"
-      "[   SLOW   ] 1 test, listed below:\n"
+      "[   SLOW   ] 1 test slow, listed below:\n"
       "[   SLOW   ] SystemTests.DISABLED_sleep5 (XX ms, exceeded 3000 ms)\n"
       "\n"
       " 1 SLOW TEST\n";
@@ -458,7 +458,7 @@
       "\x1B[0;32m[    OK    ]\x1B[m SystemTests.DISABLED_sleep5 (XX ms)\n"
       "\x1B[0;32m[==========]\x1B[m 1 test from 1 test case ran. (XX ms total)\n"
       "\x1B[0;32m[   PASS   ]\x1B[m 1 test.\n"
-      "\x1B[0;33m[   SLOW   ]\x1B[m 1 test, listed below:\n"
+      "\x1B[0;33m[   SLOW   ]\x1B[m 1 test slow, listed below:\n"
       "\x1B[0;33m[   SLOW   ]\x1B[m SystemTests.DISABLED_sleep5 (XX ms, exceeded 3000 ms)\n"
       "\n"
       " 1 SLOW TEST\n";
@@ -474,7 +474,7 @@
       "SystemTests.DISABLED_sleep_forever killed because of timeout at XX ms.\n"
       "[==========] 1 test from 1 test case ran. (XX ms total)\n"
       "[   PASS   ] 0 tests.\n"
-      "[ TIMEOUT  ] 1 test, listed below:\n"
+      "[ TIMEOUT  ] 1 test timed out, listed below:\n"
       "[ TIMEOUT  ] SystemTests.DISABLED_sleep_forever (stopped at XX ms)\n"
       "\n"
       " 1 TIMEOUT TEST\n";
@@ -492,9 +492,9 @@
       "SystemTests.DISABLED_sleep_forever killed because of timeout at XX ms.\n"
       "[==========] 2 tests from 1 test case ran. (XX ms total)\n"
       "[   PASS   ] 1 test.\n"
-      "[   SLOW   ] 1 test, listed below:\n"
+      "[   SLOW   ] 1 test slow, listed below:\n"
       "[   SLOW   ] SystemTests.DISABLED_sleep5 (XX ms, exceeded 1000 ms)\n"
-      "[ TIMEOUT  ] 1 test, listed below:\n"
+      "[ TIMEOUT  ] 1 test timed out, listed below:\n"
       "[ TIMEOUT  ] SystemTests.DISABLED_sleep_forever (stopped at XX ms)\n"
       "\n"
       " 1 SLOW TEST\n"
@@ -511,7 +511,7 @@
       "SystemTests.DISABLED_sleep_forever killed because of timeout at XX ms.\n"
       "\x1B[0;32m[==========]\x1B[m 1 test from 1 test case ran. (XX ms total)\n"
       "\x1B[0;32m[   PASS   ]\x1B[m 0 tests.\n"
-      "\x1B[0;31m[ TIMEOUT  ]\x1B[m 1 test, listed below:\n"
+      "\x1B[0;31m[ TIMEOUT  ]\x1B[m 1 test timed out, listed below:\n"
       "\x1B[0;31m[ TIMEOUT  ]\x1B[m SystemTests.DISABLED_sleep_forever (stopped at XX ms)\n"
       "\n"
       " 1 TIMEOUT TEST\n";
@@ -580,13 +580,13 @@
   ASSERT_FALSE(footer.empty()) << "Test output:\n" << raw_output_;
   ASSERT_EQ(
       "[   PASS   ] 4 tests.\n"
-      "[   SLOW   ] 2 tests, listed below:\n"
+      "[   SLOW   ] 2 tests slow, listed below:\n"
       "[   SLOW   ] SystemTests.DISABLED_all_slow_1 (XX ms, exceeded 2000 ms)\n"
       "[   SLOW   ] SystemTests.DISABLED_all_slow_2 (XX ms, exceeded 2000 ms)\n"
-      "[ TIMEOUT  ] 2 tests, listed below:\n"
+      "[ TIMEOUT  ] 2 tests timed out, listed below:\n"
       "[ TIMEOUT  ] SystemTests.DISABLED_all_timeout_1 (stopped at XX ms)\n"
       "[ TIMEOUT  ] SystemTests.DISABLED_all_timeout_2 (stopped at XX ms)\n"
-      "[   FAIL   ] 2 tests, listed below:\n"
+      "[   FAIL   ] 2 tests failed, listed below:\n"
       "[   FAIL   ] SystemTests.DISABLED_all_fail_1\n"
       "[   FAIL   ] SystemTests.DISABLED_all_fail_2\n"
       "\n"