int main() { char location[256]; int lg_location; #ifdef __COVERAGESCANNER__ printf(".csexe file name (without extension}:"); fflush(stdout); fgets(location,sizeof(location),stdin); lg_location=strlen(location); if (lg_location) location[lg_location-1]='\0'; // strip \n __coveragescanner_set_custom_io( NULL, csfputs, csfopenappend, NULL, NULL, csfclose, NULL); __coveragescanner_filename(location); #endif /* some sone to instrument here */ #ifdef __COVERAGESCANNER__ __coveragescanner_save(); #endif }
// 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 }
QT_BEGIN_NAMESPACE static void saveCoverageTool(const char * appname, bool testfailed, bool installedTestCoverage) { #ifdef __COVERAGESCANNER__ if (!installedTestCoverage) return; // install again to make sure the filename is correct. // without this, a plugin or similar may have changed the filename. __coveragescanner_install(appname); __coveragescanner_teststate(testfailed ? "FAILED" : "PASSED"); __coveragescanner_save(); __coveragescanner_testname(""); __coveragescanner_clear(); unsetenv("QT_TESTCOCOON_ACTIVE"); #else Q_UNUSED(appname); Q_UNUSED(testfailed); Q_UNUSED(installedTestCoverage); #endif }