Exemplo n.º 1
0
 // 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);
     }
 }
Exemplo n.º 2
0
void AutowiringEnclosure::OnTestEnd(const testing::TestInfo& info) {
  // Verify we can grab the test case back out and that the pointer is correct:
  Autowired<TestInfoProxy> ti;
  Autowired<AutowiringEnclosureExceptionFilter> ecef;
  auto ctxt = ecef ? ecef->GetContext() : nullptr;

  // Unconditionally reset the global context as the current context
  AutoGlobalContext()->SetCurrent();

  // Global initialization tests are special, we don't bother checking closure principle on them:
  if(!strcmp("GlobalInitTest", info.test_case_name()))
    return;

  // Need to make sure we got back our exception filter before continuing:
  ASSERT_TRUE(ecef.IsAutowired()) << "Failed to find the enclosed context exception filter; unit test may have incorrectly reset the enclosing context before returning";

  // Now try to tear down the test context enclosure:
  ctxt->SignalShutdown();

  // Do not allow teardown to take more than 250 milliseconds or so
  if(!ctxt->Wait(std::chrono::milliseconds(250))) {
    // Critical error--took too long to tear down
    assert(false);
  }

  static const char s_autothrow[] = "AUTOTHROW_";
  if(!strncmp(s_autothrow, info.name(), ARRAYCOUNT(s_autothrow) - 1))
    // Throw expected, end here
    return;

  // If an exception occurred somewhere, report it:
  ASSERT_FALSE(ecef->m_excepted)
    << "An unhandled exception occurred in this context" << std::endl
    << "[" << (ecef->m_ti ? ecef->m_ti->name() : "unknown") << "] " << ecef->m_what;
}
Exemplo n.º 3
0
 virtual void OnTestStart(const ::testing::TestInfo& test_info)
 {
     if(mProcId == 0)
     {
         printf("*** Starting test %s.%s.\n",
                 test_info.test_case_name(), test_info.name());
     }
 }
Exemplo n.º 4
0
void MinimalistPrinter::OnTestStart(const ::testing::TestInfo &test_info) {
  auto vp = test_info.value_param();
  auto tp = test_info.type_param();
  _impl->_current_test = std::string()
      + test_info.test_case_name() + "." + test_info.name()
      // Add type param or value param information when available
      + ((vp || tp) ? " " : "") + (vp ? vp: "") + (tp ? tp: "");
}
Exemplo n.º 5
0
    // Fired before the test starts.
    virtual void OnTestStart(const ::testing::TestInfo& test_info) 
    {
#ifdef __COVERAGESCANNER__
      __coveragescanner_clear(); 
      std::string test_name=
        std::string(test_info.test_case_name())
        + '/'
        + std::string(test_info.name());
      __coveragescanner_testname(test_name.c_str());
#endif
    }
Exemplo n.º 6
0
        virtual void OnTestStart(const testing::TestInfo& testInfo) 
        {
            is_google_test = true;
            GoogleTestCase = testInfo.test_case_name();
            GoogleTestName = testInfo.name();

            std::stringstream s;
            std::string name = testInfo.name() ? testInfo.name() : "<unknown>";
            s << "***Starting test [" << GoogleTestCase << ":" << name << "]" << std::endl;
            BOOST_TEST_CHECKPOINT(s.str());
#if defined(UNICODE)
            std::string sstr = s.str();
            std::wstring ws(sstr.size(), L' ');
            ws.resize(mbstowcs(&ws[0], sstr.c_str(), sstr.size()));
            output_debug_string(ws.c_str());
#else
            output_debug_string(s.str().c_str());
#endif
        }
Exemplo n.º 7
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);
		}
	}