Example #1
0
    // Fired after the test ends.
    virtual void OnTestEnd(const ::testing::TestInfo& test_info) 
    {
#ifdef __COVERAGESCANNER__
      __coveragescanner_teststate("UNKNOWN");
      if (test_info.result())
      {
        if (test_info.result()->Passed())
          __coveragescanner_teststate("PASSED");
        if (test_info.result()->Failed())
          __coveragescanner_teststate("FAILED");
      }
      __coveragescanner_save(); 
#endif
    }
 // Called after a test ends.
 virtual void OnTestEnd(const ::testing::TestInfo& test_info)
 {
     int numFailuresThisProc = 0;
     if(!test_info.result()->Passed())
     {
         numFailuresThisProc = 1;
     }
     int numTotalFailures = -1;
     int root = 0;
     MPI_Reduce(&numFailuresThisProc, &numTotalFailures, 1, MPI_INT, MPI_SUM, root, MPI_COMM_WORLD);
     if(mProcId == 0)
     {
         if(numTotalFailures == 0)
         {
             ColoredPrintf(COLOR_GREEN, "[       OK ] ");
         }
         else
         {
             int numProcs = -1;
             MPI_Comm_size(MPI_COMM_WORLD, &numProcs);
             ColoredPrintf(COLOR_RED, "[  FAILED  ] ");
             printf("on %d of %d procs ", numTotalFailures, numProcs);
             mNumFails++;
         }
         printf("%s.%s\n", test_info.test_case_name(), test_info.name());
         fflush(stdout);
     }
 }
Example #3
0
 virtual void OnTestEnd(const ::testing::TestInfo& test) {
     if (test.result() && test.result()->Failed()) {
         cerr << "Test " << test.name() << " failed" << endl;
     }
 }
Example #4
0
void PrettyResultPrinter::OnTestEnd(const testing::TestInfo& pTestInfo)
{
  // unit-test results
  if (pTestInfo.result().isPassed()) {
    testing::Log::getOStream() << Color::GREEN
                               << "[       OK ] \n";
  }
  if (pTestInfo.result().isFailed()) {
    testing::Log::getOStream() << Color::RED
                               << "[  FAILED  ] ";
    testing::TestResult::Reliability::const_iterator test =
                                    pTestInfo.result().reliability().begin();
    testing::TestResult::Reliability::const_iterator tEnd =
                                      pTestInfo.result().reliability().end();
    while (test != tEnd) {
      testing::Log::getOStream() << "\n" << Color::Bold(Color::YELLOW)
                                         << (*test)->filename()
                                         << ':'
                                         << (*test)->lineNumber()
                                         << ": ";
      switch ((*test)->type()) {
        case testing::TestPartResult::kFatalFailure: {
          testing::Log::getOStream()
                               << Color::RED
                               << "fatal: "
                               << Color::RESET << Color::Bold(Color::YELLOW)
                               << "failed to assert\n";
          break;
        }
        case testing::TestPartResult::kNonFatalFailure: {
          testing::Log::getOStream()
                               << Color::MAGENTA
                               << "error: "
                               << Color::RESET << Color::Bold(Color::YELLOW)
                               << "failed to expect\n";
          break;
        }
        default:
          break;
      }

      testing::Log::getOStream() << Color::RESET
                                 << (*test)->message();
      ++test;
    }
    testing::Log::getOStream() << std::endl;
  }

  // performance test results
  if (!pTestInfo.result().performance().empty()) {
    // timer's result
    testing::Log::getOStream() << Color::Bold(Color::BLUE)
                               << "[ TIME (ns)]";

    testing::TestResult::Performance::const_iterator perf =
                                      pTestInfo.result().performance().begin();
    testing::TestResult::Performance::const_iterator pEnd =
                                      pTestInfo.result().performance().end();

    while (perf != pEnd) {
      testing::Log::getOStream() << " " << std::setw(7)
                                 << (*perf)->getTimerNum();
      ++perf;
    }
    testing::Log::getOStream() << Color::RESET << std::endl;

    // perf_event's results
    testing::Log::getOStream() << Color::Bold(Color::BLUE)
                               << "[CXT SWITCH]";

    perf = pTestInfo.result().performance().begin();
    pEnd = pTestInfo.result().performance().end();

    while (perf != pEnd) {
      testing::Log::getOStream() << " " << std::setw(7)
                                 << (*perf)->getPerfEventNum();
      ++perf;
    }
    testing::Log::getOStream() << Color::RESET << std::endl;
  }
}
Example #5
0
 virtual void OnTestEnd(const ::testing::TestInfo& test_info) {
   if (test_info.result()->Failed())
     printf("##teamcity[testFailed name='%s']\n", test_info.name());
   printf("##teamcity[testFinished name='%s']\n", test_info.name());
 }
Example #6
0
	virtual void OnTestEnd(const ::testing::TestInfo& test_info) {
		string testname = test_info.test_case_name();
		if (testname == "LEDWhiteDim") {
			ASSERT_LT(test_info.result()->elapsed_time(), 8000);
		}
	}