summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Snyder <joe.snyder@kitware.com>2015-03-06 16:18:19 (GMT)
committerJoseph Snyder <joe.snyder@kitware.com>2015-03-06 16:18:19 (GMT)
commitc771f9d945444f6cfe41195e26653f368aff7f42 (patch)
treeda364095873cd5d70da4b018b4b67f822b31cf86
parent8f38b8a4433b26da8f64b705fa82e520c40106d5 (diff)
downloadCMake-c771f9d945444f6cfe41195e26653f368aff7f42.zip
CMake-c771f9d945444f6cfe41195e26653f368aff7f42.tar.gz
CMake-c771f9d945444f6cfe41195e26653f368aff7f42.tar.bz2
CTest: Fix Jacoco Coverage
Rename the example jacoco.xml file to be jacoco.xml.in to stop CMake from apptempting to calculate Jacoco Coverage when running over itself. Enclose a push of -1 to the coverage vector to only happen if there is a fin to calculate for. This prevents a crash if the target file doesn't exist.
-rw-r--r--Source/CTest/cmParseJacocoCoverage.cxx5
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/JacocoCoverage/Coverage/target/site/jacoco.xml.in (renamed from Tests/JacocoCoverage/Coverage/target/site/jacoco.xml)0
3 files changed, 6 insertions, 1 deletions
diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx
index ec4cfad..31ad9fe 100644
--- a/Source/CTest/cmParseJacocoCoverage.cxx
+++ b/Source/CTest/cmParseJacocoCoverage.cxx
@@ -78,7 +78,10 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser
std::string line;
FileLinesType& curFileLines =
this->Coverage.TotalCoverage[this->CurFileName];
- curFileLines.push_back(-1);
+ if(fin)
+ {
+ curFileLines.push_back(-1);
+ }
while(cmSystemTools::GetLineFromStream(fin, line))
{
curFileLines.push_back(-1);
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 08765de..703c548 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2409,6 +2409,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
"${CMake_BINARY_DIR}/Testing/JacocoCoverage/DartConfiguration.tcl")
file(COPY "${CMake_SOURCE_DIR}/Tests/JacocoCoverage/Coverage"
DESTINATION "${CMake_BINARY_DIR}/Testing/JacocoCoverage")
+ configure_file("${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml.in"
+ "${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml")
add_test(NAME CTestJacocoCoverage
COMMAND cmake -E chdir
${CMake_BINARY_DIR}/Testing/JacocoCoverage
diff --git a/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml b/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml.in
index 49c3e87..49c3e87 100644
--- a/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml
+++ b/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml.in