diff options
author | Joseph Snyder <joe.snyder@kitware.com> | 2014-05-14 13:28:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-05-16 14:16:40 (GMT) |
commit | 9ad07fbeb8166e01f8d22a1fa78b29f6cfa7721e (patch) | |
tree | a460788b53cf70d55424951760e4c6d64234862a /Source/CTest | |
parent | d3417a270f9556caa87851dd8a27ab007a6162b1 (diff) | |
download | CMake-9ad07fbeb8166e01f8d22a1fa78b29f6cfa7721e.zip CMake-9ad07fbeb8166e01f8d22a1fa78b29f6cfa7721e.tar.gz CMake-9ad07fbeb8166e01f8d22a1fa78b29f6cfa7721e.tar.bz2 |
CTest: Fix MUMPS coverage parsing and test
Fix the MUMPS coverage parser:
* Account for tabs after entry points
* Stop double incrementing lines that have explicit calls to the 0 line
* If a line has been previously marked as non executable, but then
contains a count, increment it an extra one to push it back into
the executable code set.
Add a custom routine and corresponding coverage files in the test case.
This file is smaller and has cmcov/mcov files that have data for only
that routine.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmParseCacheCoverage.cxx | 14 | ||||
-rw-r--r-- | Source/CTest/cmParseGTMCoverage.cxx | 22 |
2 files changed, 32 insertions, 4 deletions
diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index 85e07ae..d17f169 100644 --- a/Source/CTest/cmParseCacheCoverage.cxx +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -215,7 +215,19 @@ bool cmParseCacheCoverage::ReadCMCovFile(const char* file) { coverageVector.push_back(-1); } - coverageVector[linenumber] += count; + // Accounts for lines that were previously marked + // as non-executable code (-1). if the parser comes back with + // a non-zero count, increase the count by 1 to push the line + // into the executable code set in addition to the count found. + if(coverageVector[linenumber] == -1 && + count > 0) + { + coverageVector[linenumber] += count+1; + } + else + { + coverageVector[linenumber] += count; + } } return true; } diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx index 5bcfeac..be10c2e 100644 --- a/Source/CTest/cmParseGTMCoverage.cxx +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -106,7 +106,19 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file) { cmCTestCoverageHandlerContainer::SingleFileCoverageVector& coverageVector = this->Coverage.TotalCoverage[filepath]; - coverageVector[lineoffset + linenumber] += count; + // This section accounts for lines that were previously marked + // as non-executable code (-1), if the parser comes back with + // a non-zero count, increase the count by 1 to push the line + // into the executable code set in addtion to the count found. + if(coverageVector[lineoffset + linenumber] == -1 && + count > 0) + { + coverageVector[lineoffset + linenumber] += count+1; + } + else + { + coverageVector[lineoffset + linenumber] += count; + } lastoffset = lineoffset; } } @@ -141,7 +153,7 @@ bool cmParseGTMCoverage::FindFunctionInMumpsFile(std::string const& filepath, if(pos == 0) { char nextchar = line[function.size()]; - if(nextchar == ' ' || nextchar == '(') + if(nextchar == ' ' || nextchar == '('|| nextchar == '\t') { lineoffset = linenum; return true; @@ -261,7 +273,11 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line, // ^COVERAGE("%RSEL","SRC"), the line offset is 0 if(args.size() == 2) { - linenumber = 0; + // To avoid double counting of line 0 of each entry point, + // Don't count the lines that do not give an explicit line + // number. + routine=""; + function=""; } else { |