diff options
author | Patrick Reynolds <patrick.reynolds@kitware.com> | 2013-09-27 14:42:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-10-08 13:20:30 (GMT) |
commit | d0ec3a01a61f259768d31fc20791780807e1788e (patch) | |
tree | d5dfba622c1739ddedadfe7190eda5c7959a27f5 /Source/CTest/cmCTestCoverageHandler.cxx | |
parent | 6ed8504ea5633932e5db3a5a70853a763df7af50 (diff) | |
download | CMake-d0ec3a01a61f259768d31fc20791780807e1788e.zip CMake-d0ec3a01a61f259768d31fc20791780807e1788e.tar.gz CMake-d0ec3a01a61f259768d31fc20791780807e1788e.tar.bz2 |
Adding support for the Python coverage.py tool.
This assumes that coverage.py has been run in such a way to produce its
standard XML output. This uses the Cobertura schema and should be somewhat
generalizable.
Diffstat (limited to 'Source/CTest/cmCTestCoverageHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 20aded2..ef071b9 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmCTestCoverageHandler.h" #include "cmParsePHPCoverage.h" +#include "cmParsePythonCoverage.h" #include "cmParseGTMCoverage.h" #include "cmParseCacheCoverage.h" #include "cmCTest.h" @@ -392,6 +393,13 @@ int cmCTestCoverageHandler::ProcessHandler() { return error; } + file_count += this->HandlePythonCoverage(&cont); + error = cont.Error; + if ( file_count < 0 ) + { + return error; + } + file_count += this->HandleMumpsCoverage(&cont); error = cont.Error; if ( file_count < 0 ) @@ -761,6 +769,32 @@ int cmCTestCoverageHandler::HandlePHPCoverage( } return static_cast<int>(cont->TotalCoverage.size()); } + +//---------------------------------------------------------------------- +int cmCTestCoverageHandler::HandlePythonCoverage( + cmCTestCoverageHandlerContainer* cont) +{ + cmParsePythonCoverage cov(*cont, this->CTest); + + // Assume the coverage.xml is in the source directory + std::string coverageXMLFile = this->CTest->GetBinaryDir() + "/coverage.xml"; + + if(cmSystemTools::FileExists(coverageXMLFile.c_str())) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Parsing coverage.py XML file: " << coverageXMLFile + << std::endl); + cov.ReadCoverageXML(coverageXMLFile.c_str()); + } + else + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Cannot find coverage.py XML file: " << coverageXMLFile + << std::endl); + } + return static_cast<int>(cont->TotalCoverage.size()); +} + //---------------------------------------------------------------------- int cmCTestCoverageHandler::HandleMumpsCoverage( cmCTestCoverageHandlerContainer* cont) |