ENH: Fix coverage to actually work and add support for .NoDartCoverage

This commit is contained in:
Andy Cedilnik 2003-12-24 09:19:36 -05:00
parent 09ba0a0a31
commit 460f90de2b
1 changed files with 28 additions and 2 deletions

View File

@ -1472,7 +1472,7 @@ int cmCTest::CoverageDirectory()
covlines[kk] = 0; covlines[kk] = 0;
} }
cov.m_Tested ++; cov.m_Tested ++;
covlines[kk] += count; covlines[kk] ++;
//std::cout << "Tested[" << count << "] - "; //std::cout << "Tested[" << count << "] - ";
} }
@ -1496,6 +1496,19 @@ int cmCTest::CoverageDirectory()
{ {
continue; 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 ) if ( ccount == 100 )
{ {
local_end_time = ::CurrentTime(); local_end_time = ::CurrentTime();
@ -1522,7 +1535,19 @@ int cmCTest::CoverageDirectory()
} }
//std::cerr << "Final process of Source file: " << cit->first << std::endl; //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()); std::ifstream ifile(cov.m_AbsolutePath.c_str());
if ( !ifile ) if ( !ifile )
@ -1539,6 +1564,7 @@ int cmCTest::CoverageDirectory()
std::vector<cmStdString> lines; std::vector<cmStdString> lines;
cmSystemTools::Split(buffer, lines); cmSystemTools::Split(buffer, lines);
delete [] buffer; delete [] buffer;
cfileoutput << "\t<File Name=\"" << cit->first << "\" FullPath=\"" cfileoutput << "\t<File Name=\"" << cit->first << "\" FullPath=\""
<< cov.m_FullPath << "\">\n" << cov.m_FullPath << "\">\n"
<< "\t\t<Report>" << std::endl; << "\t\t<Report>" << std::endl;