From 460f90de2b9c9937cc423c44075698e5830133cb Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Wed, 24 Dec 2003 09:19:36 -0500 Subject: ENH: Fix coverage to actually work and add support for .NoDartCoverage --- Source/cmCTest.cxx | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d57c350..136f2d2 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1472,7 +1472,7 @@ int cmCTest::CoverageDirectory() covlines[kk] = 0; } cov.m_Tested ++; - covlines[kk] += count; + covlines[kk] ++; //std::cout << "Tested[" << count << "] - "; } @@ -1496,6 +1496,19 @@ int cmCTest::CoverageDirectory() { continue; } + + // Check if we should ignore the directory + std::string coverage_dir = cmSystemTools::GetFilenamePath(cov.m_AbsolutePath.c_str()); + coverage_dir += "/.NoDartCoverage"; + if ( cmSystemTools::FileExists(coverage_dir.c_str()) ) + { + if ( m_Verbose ) + { + std::cout << "Ignore file: " << cov.m_FullPath.c_str() << std::endl; + } + continue; + } + if ( ccount == 100 ) { local_end_time = ::CurrentTime(); @@ -1522,7 +1535,19 @@ int cmCTest::CoverageDirectory() } //std::cerr << "Final process of Source file: " << cit->first << std::endl; - + cov.m_UnTested = 0; + cov.m_Tested = 0; + for ( cc = 0; cc < cov.m_Lines.size(); cc ++ ) + { + if ( cov.m_Lines[cc] == 0 ) + { + cov.m_UnTested ++; + } + else if ( cov.m_Lines[cc] > 0 ) + { + cov.m_Tested ++; + } + } std::ifstream ifile(cov.m_AbsolutePath.c_str()); if ( !ifile ) @@ -1539,6 +1564,7 @@ int cmCTest::CoverageDirectory() std::vector lines; cmSystemTools::Split(buffer, lines); delete [] buffer; + cfileoutput << "\tfirst << "\" FullPath=\"" << cov.m_FullPath << "\">\n" << "\t\t" << std::endl; -- cgit v0.12