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;
}
 // 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);
     }
 }
 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());
     }
 }
Esempio 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: "");
}
Esempio n. 5
0
        virtual void OnTestEnd(const ::testing::TestInfo& testInfo)
        {
            std::stringstream s;
            std::string name = testInfo.name() ? testInfo.name() : "<unknown>";
            s << "***Ending test [" << GoogleTestCase << ":" << GoogleTestName << "]" << 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
            is_google_test = false;
            GoogleTestCase = "";
            GoogleTestName = "";
        }
Esempio n. 6
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
    }
Esempio n. 7
0
 virtual void OnTestEnd(const ::testing::TestInfo& test) {
     if (test.result() && test.result()->Failed()) {
         cerr << "Test " << test.name() << " failed" << endl;
     }
 }
Esempio n. 8
0
 virtual void OnTestStart(const ::testing::TestInfo& test) {
     cout << "Running test: " << test.name() << endl;
 }
Esempio n. 9
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());
 }
Esempio n. 10
0
 virtual void OnTestStart(const ::testing::TestInfo& test_info) {
   printf("##teamcity[testStarted name='%s']\n", test_info.name());
 }