[Cmake-commits] CMake branch, next, updated. v3.1.0-1620-ga9adf6a
Zack Galbreath
zack.galbreath at kitware.com
Fri Jan 9 11:54:53 EST 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via a9adf6ad4b1300a805dca29fe8e09d4db3c9fd73 (commit)
via 96e332c4324bd7a129ce762062dcb468762e385d (commit)
from 76e41f6262ebabcc7e60ecd8112e09fa928e07db (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9adf6ad4b1300a805dca29fe8e09d4db3c9fd73
commit a9adf6ad4b1300a805dca29fe8e09d4db3c9fd73
Merge: 76e41f6 96e332c
Author: Zack Galbreath <zack.galbreath at kitware.com>
AuthorDate: Fri Jan 9 11:54:51 2015 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jan 9 11:54:51 2015 -0500
Merge topic 'improve_cobertura' into next
96e332c4 Fix parsing of absolute paths
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=96e332c4324bd7a129ce762062dcb468762e385d
commit 96e332c4324bd7a129ce762062dcb468762e385d
Author: Zack Galbreath <zack.galbreath at kitware.com>
AuthorDate: Fri Dec 19 10:12:25 2014 -0500
Commit: Zack Galbreath <zack.galbreath at kitware.com>
CommitDate: Fri Jan 9 11:31:28 2015 -0500
Fix parsing of absolute paths
This commit fixes a segmentation fault I encountered when my
Coverage.xml referenced a system file, eg /usr/lib/python/foo.py.
Similar to other CMake coverage parsers, this one now ignores any
files it finds that are not located within this project's source
or binary directories.
diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx
index 0742be1..e19b199 100644
--- a/Source/CTest/cmParseCoberturaCoverage.cxx
+++ b/Source/CTest/cmParseCoberturaCoverage.cxx
@@ -12,9 +12,11 @@ public:
XMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont)
: CTest(ctest), Coverage(cont)
{
- this->InSources = false;
- this->InSource = false;
+ this->InSources = false;
+ this->InSource = false;
+ this->SkipThisClass = false;
this->FilePaths.push_back(this->Coverage.SourceDir);
+ this->FilePaths.push_back(this->Coverage.BinaryDir);
this->CurFileName = "";
}
@@ -35,6 +37,10 @@ protected:
{
this->InSources=false;
}
+ else if(name == "class")
+ {
+ this->SkipThisClass = false;
+ }
}
virtual void CharacterDataHandler(const char* data, int length)
@@ -72,15 +78,33 @@ protected:
<< atts[tagCount+1]<< std::endl);
std::string filename = atts[tagCount+1];
this->CurFileName = "";
+
+ // Check if this is an absolute path that falls within our
+ // source or binary directories.
for(size_t i=0;i < FilePaths.size();i++)
{
- finalpath = FilePaths[i] + "/" + filename;
- if(cmSystemTools::FileExists(finalpath.c_str()))
+ if (filename.find(FilePaths[i]) == 0)
{
- this->CurFileName = finalpath;
+ this->CurFileName = filename;
break;
}
}
+
+ if (this->CurFileName == "")
+ {
+ // Check if this is a path that is relative to our source or
+ // binary directories.
+ for(size_t i=0;i < FilePaths.size();i++)
+ {
+ finalpath = FilePaths[i] + "/" + filename;
+ if(cmSystemTools::FileExists(finalpath.c_str()))
+ {
+ this->CurFileName = finalpath;
+ break;
+ }
+ }
+ }
+
cmsys::ifstream fin(this->CurFileName.c_str());
if(this->CurFileName == "" || !fin )
{
@@ -89,10 +113,11 @@ protected:
fin.open(this->CurFileName.c_str());
if (!fin)
{
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Python Coverage: Error opening " << this->CurFileName
- << std::endl);
- this->Coverage.Error++;
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Skipping system file " << filename <<
+ std::endl);
+
+ this->SkipThisClass = true;
break;
}
}
@@ -117,6 +142,10 @@ protected:
int curHits = -1;
while(true)
{
+ if(this->SkipThisClass)
+ {
+ break;
+ }
if(strcmp(atts[tagCount], "hits") == 0)
{
curHits = atoi(atts[tagCount+1]);
@@ -144,6 +173,7 @@ private:
bool InSources;
bool InSource;
+ bool SkipThisClass;
std::vector<std::string> FilePaths;
typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector
FileLinesType;
-----------------------------------------------------------------------
Summary of changes:
Source/CTest/cmParseCoberturaCoverage.cxx | 48 +++++++++++++++++++++++------
1 file changed, 39 insertions(+), 9 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list