ctest_coverage: Add QUIET option
This commit is contained in:
parent
876a680d48
commit
fc58bdb9ad
|
@ -18,3 +18,8 @@ files labeled with at least one of the labels specified.
|
||||||
The APPEND option marks results for append to those previously
|
The APPEND option marks results for append to those previously
|
||||||
submitted to a dashboard server since the last ctest_start. Append
|
submitted to a dashboard server since the last ctest_start. Append
|
||||||
semantics are defined by the dashboard server in use.
|
semantics are defined by the dashboard server in use.
|
||||||
|
|
||||||
|
The QUIET option suppresses any CTest-specific non-error output
|
||||||
|
that would have been printed to the console otherwise. The summary
|
||||||
|
indicating how many lines of code were covered is unaffected by this
|
||||||
|
option.
|
||||||
|
|
|
@ -45,6 +45,10 @@
|
||||||
# Specify options to be passed to gcov. The ``gcov`` command
|
# Specify options to be passed to gcov. The ``gcov`` command
|
||||||
# is run as ``gcov <options>... -o <gcov-dir> <file>.gcda``.
|
# is run as ``gcov <options>... -o <gcov-dir> <file>.gcda``.
|
||||||
# If not specified, the default option is just ``-b``.
|
# If not specified, the default option is just ``-b``.
|
||||||
|
#
|
||||||
|
# ``QUIET``
|
||||||
|
# Suppress non-error messages that otherwise would have been
|
||||||
|
# printed out by this function.
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Copyright 2014-2015 Kitware, Inc.
|
# Copyright 2014-2015 Kitware, Inc.
|
||||||
|
@ -60,7 +64,7 @@
|
||||||
# License text for the above reference.)
|
# License text for the above reference.)
|
||||||
include(CMakeParseArguments)
|
include(CMakeParseArguments)
|
||||||
function(ctest_coverage_collect_gcov)
|
function(ctest_coverage_collect_gcov)
|
||||||
set(options "")
|
set(options QUIET)
|
||||||
set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND)
|
set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND)
|
||||||
set(multiValueArgs GCOV_OPTIONS)
|
set(multiValueArgs GCOV_OPTIONS)
|
||||||
cmake_parse_arguments(GCOV "${options}" "${oneValueArgs}"
|
cmake_parse_arguments(GCOV "${options}" "${oneValueArgs}"
|
||||||
|
@ -106,8 +110,10 @@ function(ctest_coverage_collect_gcov)
|
||||||
# return early if no coverage files were found
|
# return early if no coverage files were found
|
||||||
list(LENGTH gcda_files len)
|
list(LENGTH gcda_files len)
|
||||||
if(len EQUAL 0)
|
if(len EQUAL 0)
|
||||||
|
if (NOT GCOV_QUIET)
|
||||||
message("ctest_coverage_collect_gcov: No .gcda files found, "
|
message("ctest_coverage_collect_gcov: No .gcda files found, "
|
||||||
"ignoring coverage request.")
|
"ignoring coverage request.")
|
||||||
|
endif()
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
# setup the dir for the coverage files
|
# setup the dir for the coverage files
|
||||||
|
@ -130,8 +136,10 @@ function(ctest_coverage_collect_gcov)
|
||||||
WORKING_DIRECTORY ${coverage_dir})
|
WORKING_DIRECTORY ${coverage_dir})
|
||||||
endforeach()
|
endforeach()
|
||||||
if(NOT "${res}" EQUAL 0)
|
if(NOT "${res}" EQUAL 0)
|
||||||
|
if (NOT GCOV_QUIET)
|
||||||
message(STATUS "Error running gcov: ${res} ${out}")
|
message(STATUS "Error running gcov: ${res} ${out}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
# create json file with project information
|
# create json file with project information
|
||||||
file(WRITE ${coverage_dir}/data.json
|
file(WRITE ${coverage_dir}/data.json
|
||||||
"{
|
"{
|
||||||
|
@ -151,8 +159,15 @@ function(ctest_coverage_collect_gcov)
|
||||||
${coverage_dir}/data.json
|
${coverage_dir}/data.json
|
||||||
${label_files}
|
${label_files}
|
||||||
")
|
")
|
||||||
|
|
||||||
|
if (GCOV_QUIET)
|
||||||
|
set(tar_opts "cfj")
|
||||||
|
else()
|
||||||
|
set(tar_opts "cvfj")
|
||||||
|
endif()
|
||||||
|
|
||||||
execute_process(COMMAND
|
execute_process(COMMAND
|
||||||
${CMAKE_COMMAND} -E tar cvfj ${GCOV_TARBALL}
|
${CMAKE_COMMAND} -E tar ${tar_opts} ${GCOV_TARBALL}
|
||||||
"--mtime=1970-01-01 0:0:0 UTC"
|
"--mtime=1970-01-01 0:0:0 UTC"
|
||||||
--files-from=${coverage_dir}/coverage_file_list.txt
|
--files-from=${coverage_dir}/coverage_file_list.txt
|
||||||
WORKING_DIRECTORY ${binary_dir})
|
WORKING_DIRECTORY ${binary_dir})
|
||||||
|
|
|
@ -24,9 +24,9 @@ cmCTestCoverageCommand::cmCTestCoverageCommand()
|
||||||
cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
|
cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
|
||||||
{
|
{
|
||||||
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
||||||
"CoverageCommand", "CTEST_COVERAGE_COMMAND");
|
"CoverageCommand", "CTEST_COVERAGE_COMMAND", this->Quiet);
|
||||||
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
||||||
"CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS");
|
"CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS", this->Quiet);
|
||||||
cmCTestCoverageHandler* handler = static_cast<cmCTestCoverageHandler*>(
|
cmCTestCoverageHandler* handler = static_cast<cmCTestCoverageHandler*>(
|
||||||
this->CTest->GetInitializedHandler("coverage"));
|
this->CTest->GetInitializedHandler("coverage"));
|
||||||
if ( !handler )
|
if ( !handler )
|
||||||
|
@ -41,6 +41,7 @@ cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
|
||||||
handler->SetLabelFilter(this->Labels);
|
handler->SetLabelFilter(this->Labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handler->SetQuiet(this->Quiet);
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,8 +176,8 @@ bool cmCTestCoverageHandler::StartCoverageLogFile(
|
||||||
{
|
{
|
||||||
char covLogFilename[1024];
|
char covLogFilename[1024];
|
||||||
sprintf(covLogFilename, "CoverageLog-%d", logFileCount);
|
sprintf(covLogFilename, "CoverageLog-%d", logFileCount);
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Open file: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Open file: "
|
||||||
<< covLogFilename << std::endl);
|
<< covLogFilename << std::endl, this->Quiet);
|
||||||
if(!this->StartResultingXML(cmCTest::PartCoverage,
|
if(!this->StartResultingXML(cmCTest::PartCoverage,
|
||||||
covLogFilename, covLogFile))
|
covLogFilename, covLogFile))
|
||||||
{
|
{
|
||||||
|
@ -209,8 +209,8 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr,
|
||||||
this->CTest->EndXML(ostr);
|
this->CTest->EndXML(ostr);
|
||||||
char covLogFilename[1024];
|
char covLogFilename[1024];
|
||||||
sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount);
|
sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount);
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Close file: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Close file: "
|
||||||
<< covLogFilename << std::endl);
|
<< covLogFilename << std::endl, this->Quiet);
|
||||||
ostr.Close();
|
ostr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,8 +230,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
|
||||||
{
|
{
|
||||||
if ( sit->find(file) )
|
if ( sit->find(file) )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " File " << file
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " File " << file
|
||||||
<< " is excluded in CTestCustom.ctest" << std::endl;);
|
<< " is excluded in CTestCustom.ctest" << std::endl;, this->Quiet);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,8 +272,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
|
||||||
fFile.c_str(), checkDir.c_str());
|
fFile.c_str(), checkDir.c_str());
|
||||||
if (!ndc.empty())
|
if (!ndc.empty())
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc
|
||||||
<< " so skip coverage of " << file << std::endl);
|
<< " so skip coverage of " << file << std::endl, this->Quiet);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,8 +311,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
|
||||||
fFile.c_str(), checkDir.c_str());
|
fFile.c_str(), checkDir.c_str());
|
||||||
if (!ndc.empty())
|
if (!ndc.empty())
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc
|
||||||
<< " so skip coverage of: " << file << std::endl);
|
<< " so skip coverage of: " << file << std::endl, this->Quiet);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Ok, nothing in source tree, nothing in binary tree
|
// Ok, nothing in source tree, nothing in binary tree
|
||||||
|
@ -356,13 +356,15 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||||
cmSystemTools::ConvertToUnixSlashes(sourceDir);
|
cmSystemTools::ConvertToUnixSlashes(sourceDir);
|
||||||
cmSystemTools::ConvertToUnixSlashes(binaryDir);
|
cmSystemTools::ConvertToUnixSlashes(binaryDir);
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Performing coverage" << std::endl);
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
|
||||||
|
"Performing coverage" << std::endl, this->Quiet);
|
||||||
|
|
||||||
cmCTestCoverageHandlerContainer cont;
|
cmCTestCoverageHandlerContainer cont;
|
||||||
cont.Error = error;
|
cont.Error = error;
|
||||||
cont.SourceDir = sourceDir;
|
cont.SourceDir = sourceDir;
|
||||||
cont.BinaryDir = binaryDir;
|
cont.BinaryDir = binaryDir;
|
||||||
cont.OFS = &ofs;
|
cont.OFS = &ofs;
|
||||||
|
cont.Quiet = this->Quiet;
|
||||||
|
|
||||||
// setup the regex exclude stuff
|
// setup the regex exclude stuff
|
||||||
this->CustomCoverageExcludeRegex.clear();
|
this->CustomCoverageExcludeRegex.clear();
|
||||||
|
@ -442,9 +444,9 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||||
|
|
||||||
if ( file_count == 0 )
|
if ( file_count == 0 )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, WARNING,
|
cmCTestOptionalLog(this->CTest, WARNING,
|
||||||
" Cannot find any coverage files. Ignoring Coverage request."
|
" Cannot find any coverage files. Ignoring Coverage request."
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
cmGeneratedFileStream covSumFile;
|
cmGeneratedFileStream covSumFile;
|
||||||
|
@ -476,10 +478,11 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||||
long total_untested = 0;
|
long total_untested = 0;
|
||||||
//std::string fullSourceDir = sourceDir + "/";
|
//std::string fullSourceDir = sourceDir + "/";
|
||||||
//std::string fullBinaryDir = binaryDir + "/";
|
//std::string fullBinaryDir = binaryDir + "/";
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl);
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl, this->Quiet);
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
|
||||||
" Accumulating results (each . represents one file):" << std::endl);
|
" Accumulating results (each . represents one file):" << std::endl,
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
|
this->Quiet);
|
||||||
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
|
||||||
|
|
||||||
std::vector<std::string> errorsWhileAccumulating;
|
std::vector<std::string> errorsWhileAccumulating;
|
||||||
|
|
||||||
|
@ -488,14 +491,16 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||||
fileIterator != cont.TotalCoverage.end();
|
fileIterator != cont.TotalCoverage.end();
|
||||||
++fileIterator )
|
++fileIterator )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush,
|
||||||
|
this->Quiet);
|
||||||
file_count ++;
|
file_count ++;
|
||||||
if ( file_count % 50 == 0 )
|
if ( file_count % 50 == 0 )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " processed: "
|
||||||
|
<< file_count
|
||||||
<< " out of "
|
<< " out of "
|
||||||
<< cont.TotalCoverage.size() << std::endl);
|
<< cont.TotalCoverage.size() << std::endl, this->Quiet);
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string fullFileName = fileIterator->first;
|
const std::string fullFileName = fileIterator->first;
|
||||||
|
@ -504,15 +509,15 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||||
sourceDir.c_str(), binaryDir.c_str());
|
sourceDir.c_str(), binaryDir.c_str());
|
||||||
if ( !shouldIDoCoverage )
|
if ( !shouldIDoCoverage )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
".NoDartCoverage found, so skip coverage check for: "
|
".NoDartCoverage found, so skip coverage check for: "
|
||||||
<< fullFileName
|
<< fullFileName
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Process file: " << fullFileName << std::endl);
|
"Process file: " << fullFileName << std::endl, this->Quiet);
|
||||||
|
|
||||||
if ( !cmSystemTools::FileExists(fullFileName.c_str()) )
|
if ( !cmSystemTools::FileExists(fullFileName.c_str()) )
|
||||||
{
|
{
|
||||||
|
@ -556,8 +561,9 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||||
|
|
||||||
cmCTestCoverageHandlerContainer::SingleFileCoverageVector::size_type cc;
|
cmCTestCoverageHandlerContainer::SingleFileCoverageVector::size_type cc;
|
||||||
std::string line;
|
std::string line;
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Actually performing coverage for: " << fullFileName << std::endl);
|
"Actually performing coverage for: " << fullFileName << std::endl,
|
||||||
|
this->Quiet);
|
||||||
for ( cc= 0; cc < fcov.size(); cc ++ )
|
for ( cc= 0; cc < fcov.size(); cc ++ )
|
||||||
{
|
{
|
||||||
if ( !cmSystemTools::GetLineFromStream(ifs, line) &&
|
if ( !cmSystemTools::GetLineFromStream(ifs, line) &&
|
||||||
|
@ -641,8 +647,8 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||||
}
|
}
|
||||||
int untested = 0;
|
int untested = 0;
|
||||||
std::string line;
|
std::string line;
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Actually performing coverage for: " << *i << std::endl);
|
"Actually performing coverage for: " << *i << std::endl, this->Quiet);
|
||||||
while (cmSystemTools::GetLineFromStream(ifs, line))
|
while (cmSystemTools::GetLineFromStream(ifs, line))
|
||||||
{
|
{
|
||||||
covLogFile << "\t\t<Line Number=\"" << untested << "\" Count=\"0\">"
|
covLogFile << "\t\t<Line Number=\"" << untested << "\" Count=\"0\">"
|
||||||
|
@ -736,8 +742,8 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
|
void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Add coverage exclude regular expressions." << std::endl);
|
" Add coverage exclude regular expressions." << std::endl, this->Quiet);
|
||||||
this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE",
|
this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE",
|
||||||
this->CustomCoverageExclude);
|
this->CustomCoverageExclude);
|
||||||
this->CTest->PopulateCustomVector(mf, "CTEST_EXTRA_COVERAGE_GLOB",
|
this->CTest->PopulateCustomVector(mf, "CTEST_EXTRA_COVERAGE_GLOB",
|
||||||
|
@ -747,14 +753,14 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
|
||||||
it != this->CustomCoverageExclude.end();
|
it != this->CustomCoverageExclude.end();
|
||||||
++ it )
|
++ it )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< *it << std::endl);
|
" Add coverage exclude: " << *it << std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
for ( it = this->ExtraCoverageGlobs.begin();
|
for ( it = this->ExtraCoverageGlobs.begin();
|
||||||
it != this->ExtraCoverageGlobs.end(); ++it)
|
it != this->ExtraCoverageGlobs.end(); ++it)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage glob: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< *it << std::endl);
|
" Add coverage glob: " << *it << std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,16 +818,16 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage(
|
||||||
|
|
||||||
if(cmSystemTools::FileExists(coverageXMLFile.c_str()))
|
if(cmSystemTools::FileExists(coverageXMLFile.c_str()))
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Parsing Cobertura XML file: " << coverageXMLFile
|
"Parsing Cobertura XML file: " << coverageXMLFile
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
cov.ReadCoverageXML(coverageXMLFile.c_str());
|
cov.ReadCoverageXML(coverageXMLFile.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Cannot find Cobertura XML file: " << coverageXMLFile
|
"Cannot find Cobertura XML file: " << coverageXMLFile
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
return static_cast<int>(cont->TotalCoverage.size());
|
return static_cast<int>(cont->TotalCoverage.size());
|
||||||
}
|
}
|
||||||
|
@ -836,33 +842,33 @@ int cmCTestCoverageHandler::HandleMumpsCoverage(
|
||||||
"/gtm_coverage.mcov";
|
"/gtm_coverage.mcov";
|
||||||
if(cmSystemTools::FileExists(coverageFile.c_str()))
|
if(cmSystemTools::FileExists(coverageFile.c_str()))
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Parsing Cache Coverage: " << coverageFile
|
"Parsing Cache Coverage: " << coverageFile
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
cov.ReadCoverageFile(coverageFile.c_str());
|
cov.ReadCoverageFile(coverageFile.c_str());
|
||||||
return static_cast<int>(cont->TotalCoverage.size());
|
return static_cast<int>(cont->TotalCoverage.size());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Cannot find foobar GTM coverage file: " << coverageFile
|
" Cannot find GTM coverage file: " << coverageFile
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
cmParseCacheCoverage ccov(*cont, this->CTest);
|
cmParseCacheCoverage ccov(*cont, this->CTest);
|
||||||
coverageFile = this->CTest->GetBinaryDir() +
|
coverageFile = this->CTest->GetBinaryDir() +
|
||||||
"/cache_coverage.cmcov";
|
"/cache_coverage.cmcov";
|
||||||
if(cmSystemTools::FileExists(coverageFile.c_str()))
|
if(cmSystemTools::FileExists(coverageFile.c_str()))
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Parsing Cache Coverage: " << coverageFile
|
"Parsing Cache Coverage: " << coverageFile
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
ccov.ReadCoverageFile(coverageFile.c_str());
|
ccov.ReadCoverageFile(coverageFile.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Cannot find Cache coverage file: " << coverageFile
|
" Cannot find Cache coverage file: " << coverageFile
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
return static_cast<int>(cont->TotalCoverage.size());
|
return static_cast<int>(cont->TotalCoverage.size());
|
||||||
}
|
}
|
||||||
|
@ -912,15 +918,15 @@ int cmCTestCoverageHandler::HandleJacocoCoverage(
|
||||||
files=g.GetFiles();
|
files=g.GetFiles();
|
||||||
if (!files.empty())
|
if (!files.empty())
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Found Jacoco Files, Performing Coverage" << std::endl);
|
"Found Jacoco Files, Performing Coverage" << std::endl, this->Quiet);
|
||||||
cov.LoadCoverageData(files);
|
cov.LoadCoverageData(files);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Cannot find Jacoco coverage files: " << coverageFile
|
" Cannot find Jacoco coverage files: " << coverageFile
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
return static_cast<int>(cont->TotalCoverage.size());
|
return static_cast<int>(cont->TotalCoverage.size());
|
||||||
}
|
}
|
||||||
|
@ -945,15 +951,16 @@ int cmCTestCoverageHandler::HandleDelphiCoverage(
|
||||||
files=g.GetFiles();
|
files=g.GetFiles();
|
||||||
if (!files.empty())
|
if (!files.empty())
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Found Delphi HTML Files, Performing Coverage" << std::endl);
|
"Found Delphi HTML Files, Performing Coverage" << std::endl,
|
||||||
|
this->Quiet);
|
||||||
cov.LoadCoverageData(files);
|
cov.LoadCoverageData(files);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Cannot find Delphi coverage files: " << coverageFile
|
" Cannot find Delphi coverage files: " << coverageFile
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
return static_cast<int>(cont->TotalCoverage.size());
|
return static_cast<int>(cont->TotalCoverage.size());
|
||||||
}
|
}
|
||||||
|
@ -975,15 +982,16 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage(
|
||||||
files=g.GetFiles();
|
files=g.GetFiles();
|
||||||
if (!files.empty())
|
if (!files.empty())
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Found BlanketJS output JSON, Performing Coverage" << std::endl);
|
"Found BlanketJS output JSON, Performing Coverage" << std::endl,
|
||||||
|
this->Quiet);
|
||||||
cov.LoadCoverageData(files);
|
cov.LoadCoverageData(files);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Cannot find BlanketJS coverage files: " << coverageFile
|
" Cannot find BlanketJS coverage files: " << coverageFile
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
return static_cast<int>(cont->TotalCoverage.size());
|
return static_cast<int>(cont->TotalCoverage.size());
|
||||||
}
|
}
|
||||||
|
@ -1039,9 +1047,9 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
|
|
||||||
if (files.empty())
|
if (files.empty())
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Cannot find any GCov coverage files."
|
" Cannot find any GCov coverage files."
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
// No coverage files is a valid thing, so the exit code is 0
|
// No coverage files is a valid thing, so the exit code is 0
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1057,9 +1065,10 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
std::set<std::string> missingFiles;
|
std::set<std::string> missingFiles;
|
||||||
|
|
||||||
std::string actualSourceFile = "";
|
std::string actualSourceFile = "";
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
|
||||||
" Processing coverage (each . represents one file):" << std::endl);
|
" Processing coverage (each . represents one file):" << std::endl,
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
|
this->Quiet);
|
||||||
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
|
||||||
int file_count = 0;
|
int file_count = 0;
|
||||||
|
|
||||||
// make sure output from gcov is in English!
|
// make sure output from gcov is in English!
|
||||||
|
@ -1072,7 +1081,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
//
|
//
|
||||||
for ( it = files.begin(); it != files.end(); ++ it )
|
for ( it = files.begin(); it != files.end(); ++ it )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush,
|
||||||
|
this->Quiet);
|
||||||
|
|
||||||
// Call gcov to get coverage data for this *.gcda file:
|
// Call gcov to get coverage data for this *.gcda file:
|
||||||
//
|
//
|
||||||
|
@ -1082,8 +1092,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
"-o \"" + fileDir + "\" " +
|
"-o \"" + fileDir + "\" " +
|
||||||
"\"" + *it + "\"";
|
"\"" + *it + "\"";
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
|
|
||||||
std::string output = "";
|
std::string output = "";
|
||||||
std::string errors = "";
|
std::string errors = "";
|
||||||
|
@ -1111,12 +1121,12 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||||
"Command produced error: " << cont->Error << std::endl);
|
"Command produced error: " << cont->Error << std::endl);
|
||||||
}
|
}
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"--------------------------------------------------------------"
|
"--------------------------------------------------------------"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< output << std::endl
|
<< output << std::endl
|
||||||
<< "--------------------------------------------------------------"
|
<< "--------------------------------------------------------------"
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
|
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
std::vector<std::string>::iterator line;
|
std::vector<std::string>::iterator line;
|
||||||
|
@ -1128,8 +1138,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
std::string sourceFile;
|
std::string sourceFile;
|
||||||
std::string gcovFile;
|
std::string gcovFile;
|
||||||
|
|
||||||
cmCTestLog(this->CTest, DEBUG, "Line: [" << *line << "]"
|
cmCTestOptionalLog(this->CTest, DEBUG, "Line: [" << *line << "]"
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
|
|
||||||
if (line->empty())
|
if (line->empty())
|
||||||
{
|
{
|
||||||
|
@ -1229,8 +1239,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCTestLog(this->CTest, WARNING, "Warning: " << st2re4.match(1)
|
cmCTestOptionalLog(this->CTest, WARNING, "Warning: " << st2re4.match(1)
|
||||||
<< " had unexpected EOF" << std::endl);
|
<< " had unexpected EOF" << std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
else if ( st2re5.find(line->c_str() ) )
|
else if ( st2re5.find(line->c_str() ) )
|
||||||
{
|
{
|
||||||
|
@ -1246,8 +1256,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCTestLog(this->CTest, WARNING, "Warning: Cannot open file: "
|
cmCTestOptionalLog(this->CTest, WARNING, "Warning: Cannot open file: "
|
||||||
<< st2re5.match(1) << std::endl);
|
<< st2re5.match(1) << std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
else if ( st2re6.find(line->c_str() ) )
|
else if ( st2re6.find(line->c_str() ) )
|
||||||
{
|
{
|
||||||
|
@ -1263,8 +1273,9 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCTestLog(this->CTest, WARNING, "Warning: File: " << st2re6.match(1)
|
cmCTestOptionalLog(this->CTest, WARNING, "Warning: File: "
|
||||||
<< " is newer than " << st2re6.match(2) << std::endl);
|
<< st2re6.match(1)
|
||||||
|
<< " is newer than " << st2re6.match(2) << std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1291,8 +1302,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec
|
cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec
|
||||||
= cont->TotalCoverage[actualSourceFile];
|
= cont->TotalCoverage[actualSourceFile];
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in gcovFile: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< gcovFile << std::endl);
|
" in gcovFile: " << gcovFile << std::endl, this->Quiet);
|
||||||
|
|
||||||
cmsys::ifstream ifile(gcovFile.c_str());
|
cmsys::ifstream ifile(gcovFile.c_str());
|
||||||
if ( ! ifile )
|
if ( ! ifile )
|
||||||
|
@ -1366,8 +1377,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
//
|
//
|
||||||
if ( IsFileInDir(sourceFile, cont->SourceDir) )
|
if ( IsFileInDir(sourceFile, cont->SourceDir) )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< sourceFile << std::endl);
|
" produced s: " << sourceFile << std::endl, this->Quiet);
|
||||||
*cont->OFS << " produced in source dir: " << sourceFile
|
*cont->OFS << " produced in source dir: " << sourceFile
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
actualSourceFile
|
actualSourceFile
|
||||||
|
@ -1375,8 +1386,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
}
|
}
|
||||||
else if ( IsFileInDir(sourceFile, cont->BinaryDir) )
|
else if ( IsFileInDir(sourceFile, cont->BinaryDir) )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< sourceFile << std::endl);
|
" produced b: " << sourceFile << std::endl, this->Quiet);
|
||||||
*cont->OFS << " produced in binary dir: " << sourceFile
|
*cont->OFS << " produced in binary dir: " << sourceFile
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
actualSourceFile
|
actualSourceFile
|
||||||
|
@ -1387,19 +1398,19 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
{
|
{
|
||||||
if ( missingFiles.find(sourceFile) == missingFiles.end() )
|
if ( missingFiles.find(sourceFile) == missingFiles.end() )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Something went wrong" << std::endl);
|
"Something went wrong" << std::endl, this->Quiet);
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Cannot find file: ["
|
"Cannot find file: ["
|
||||||
<< sourceFile << "]" << std::endl);
|
<< sourceFile << "]" << std::endl, this->Quiet);
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" in source dir: ["
|
" in source dir: ["
|
||||||
<< cont->SourceDir << "]"
|
<< cont->SourceDir << "]"
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" or binary dir: ["
|
" or binary dir: ["
|
||||||
<< cont->BinaryDir.size() << "]"
|
<< cont->BinaryDir.size() << "]"
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
*cont->OFS << " Something went wrong. Cannot find file: "
|
*cont->OFS << " Something went wrong. Cannot find file: "
|
||||||
<< sourceFile
|
<< sourceFile
|
||||||
<< " in source dir: " << cont->SourceDir
|
<< " in source dir: " << cont->SourceDir
|
||||||
|
@ -1415,9 +1426,10 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||||
|
|
||||||
if ( file_count % 50 == 0 )
|
if ( file_count % 50 == 0 )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " processed: "
|
||||||
<< " out of " << files.size() << std::endl);
|
<< file_count
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
|
<< " out of " << files.size() << std::endl, this->Quiet);
|
||||||
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1435,22 +1447,22 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||||
= this->CTest->GetCTestConfiguration("CoverageExtraFlags");
|
= this->CTest->GetCTestConfiguration("CoverageExtraFlags");
|
||||||
if ( lcovCommand != "codecov" )
|
if ( lcovCommand != "codecov" )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Not a valid Intel Coverage command."
|
" Not a valid Intel Coverage command."
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// There is only percentage completed output from LCOV
|
// There is only percentage completed output from LCOV
|
||||||
std::string st2lcovOutputRex3 = "[0-9]+%";
|
std::string st2lcovOutputRex3 = "[0-9]+%";
|
||||||
cmsys::RegularExpression st2re3(st2lcovOutputRex3.c_str());
|
cmsys::RegularExpression st2re3(st2lcovOutputRex3.c_str());
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" This is coverage command: " << lcovCommand
|
" This is coverage command: " << lcovCommand
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" These are coverage command flags: " << lcovExtraFlags
|
" These are coverage command flags: " << lcovExtraFlags
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
|
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
this->FindLCovFiles(files);
|
this->FindLCovFiles(files);
|
||||||
|
@ -1458,9 +1470,9 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||||
|
|
||||||
if (files.empty())
|
if (files.empty())
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Cannot find any LCov coverage files."
|
" Cannot find any LCov coverage files."
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
// No coverage files is a valid thing, so the exit code is 0
|
// No coverage files is a valid thing, so the exit code is 0
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1471,9 +1483,10 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||||
std::set<std::string> missingFiles;
|
std::set<std::string> missingFiles;
|
||||||
|
|
||||||
std::string actualSourceFile = "";
|
std::string actualSourceFile = "";
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
|
||||||
" Processing coverage (each . represents one file):" << std::endl);
|
" Processing coverage (each . represents one file):" << std::endl,
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
|
this->Quiet);
|
||||||
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
|
||||||
int file_count = 0;
|
int file_count = 0;
|
||||||
|
|
||||||
// make sure output from lcov is in English!
|
// make sure output from lcov is in English!
|
||||||
|
@ -1484,16 +1497,17 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||||
// directory. It collects all *.dyn files to generate .dpi file.
|
// directory. It collects all *.dyn files to generate .dpi file.
|
||||||
for ( it = files.begin(); it != files.end(); ++ it )
|
for ( it = files.begin(); it != files.end(); ++ it )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush,
|
||||||
|
this->Quiet);
|
||||||
std::string fileDir = cmSystemTools::GetFilenamePath(*it);
|
std::string fileDir = cmSystemTools::GetFilenamePath(*it);
|
||||||
cmSystemTools::ChangeDirectory(fileDir);
|
cmSystemTools::ChangeDirectory(fileDir);
|
||||||
std::string command = "\"" + lcovCommand + "\" " +
|
std::string command = "\"" + lcovCommand + "\" " +
|
||||||
lcovExtraFlags + " ";
|
lcovExtraFlags + " ";
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Current coverage dir: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< fileDir << std::endl);
|
"Current coverage dir: " << fileDir << std::endl, this->Quiet);
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
|
|
||||||
std::string output = "";
|
std::string output = "";
|
||||||
std::string errors = "";
|
std::string errors = "";
|
||||||
|
@ -1521,12 +1535,12 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||||
"Command produced error: " << cont->Error << std::endl);
|
"Command produced error: " << cont->Error << std::endl);
|
||||||
}
|
}
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"--------------------------------------------------------------"
|
"--------------------------------------------------------------"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< output << std::endl
|
<< output << std::endl
|
||||||
<< "--------------------------------------------------------------"
|
<< "--------------------------------------------------------------"
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
|
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
std::vector<std::string>::iterator line;
|
std::vector<std::string>::iterator line;
|
||||||
|
@ -1554,8 +1568,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||||
std::string daGlob;
|
std::string daGlob;
|
||||||
daGlob = dir;
|
daGlob = dir;
|
||||||
daGlob += "/*.LCOV";
|
daGlob += "/*.LCOV";
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" looking for LCOV files in: " << daGlob << std::endl);
|
" looking for LCOV files in: " << daGlob << std::endl, this->Quiet);
|
||||||
gl.FindFiles(daGlob);
|
gl.FindFiles(daGlob);
|
||||||
// Keep a list of all LCOV files
|
// Keep a list of all LCOV files
|
||||||
lcovFiles.insert(lcovFiles.end(), gl.GetFiles().begin(),
|
lcovFiles.insert(lcovFiles.end(), gl.GetFiles().begin(),
|
||||||
|
@ -1590,13 +1604,13 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||||
for(std::vector<std::string>::iterator t = lcovFiles.begin();
|
for(std::vector<std::string>::iterator t = lcovFiles.begin();
|
||||||
t != lcovFiles.end(); ++t)
|
t != lcovFiles.end(); ++t)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found LCOV File: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< *t << std::endl);
|
"Found LCOV File: " << *t << std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SourceFile: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SourceFile: "
|
||||||
<< sourceFile << std::endl);
|
<< sourceFile << std::endl, this->Quiet);
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "lCovFile: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "lCovFile: "
|
||||||
<< lcovFile << std::endl);
|
<< lcovFile << std::endl, this->Quiet);
|
||||||
|
|
||||||
// If we have some LCOV files to process
|
// If we have some LCOV files to process
|
||||||
if ( !lcovFile.empty() && !actualSourceFile.empty() )
|
if ( !lcovFile.empty() && !actualSourceFile.empty() )
|
||||||
|
@ -1604,8 +1618,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||||
cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec
|
cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec
|
||||||
= cont->TotalCoverage[actualSourceFile];
|
= cont->TotalCoverage[actualSourceFile];
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in lcovFile: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< lcovFile << std::endl);
|
" in lcovFile: " << lcovFile << std::endl, this->Quiet);
|
||||||
|
|
||||||
cmsys::ifstream ifile(lcovFile.c_str());
|
cmsys::ifstream ifile(lcovFile.c_str());
|
||||||
if ( ! ifile )
|
if ( ! ifile )
|
||||||
|
@ -1620,8 +1634,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||||
|
|
||||||
// Skip the first line
|
// Skip the first line
|
||||||
cmSystemTools::GetLineFromStream(ifile, nl);
|
cmSystemTools::GetLineFromStream(ifile, nl);
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"File is ready, start reading." << std::endl);
|
"File is ready, start reading." << std::endl, this->Quiet);
|
||||||
while ( cmSystemTools::GetLineFromStream(ifile, nl) )
|
while ( cmSystemTools::GetLineFromStream(ifile, nl) )
|
||||||
{
|
{
|
||||||
cnt ++;
|
cnt ++;
|
||||||
|
@ -1679,9 +1693,10 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||||
|
|
||||||
if ( file_count % 50 == 0 )
|
if ( file_count % 50 == 0 )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
|
||||||
<< " out of " << files.size() << std::endl);
|
" processed: " << file_count << " out of " << files.size()
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
|
<< std::endl, this->Quiet);
|
||||||
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1707,8 +1722,8 @@ void cmCTestCoverageHandler::FindGCovFiles(std::vector<std::string>& files)
|
||||||
|
|
||||||
// Coverage files appear next to their object files in the target
|
// Coverage files appear next to their object files in the target
|
||||||
// support directory.
|
// support directory.
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" globbing for coverage in: " << lmi->first << std::endl);
|
" globbing for coverage in: " << lmi->first << std::endl, this->Quiet);
|
||||||
std::string daGlob = lmi->first;
|
std::string daGlob = lmi->first;
|
||||||
daGlob += "/*.da";
|
daGlob += "/*.da";
|
||||||
gl.FindFiles(daGlob);
|
gl.FindFiles(daGlob);
|
||||||
|
@ -1740,12 +1755,12 @@ void cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files)
|
||||||
std::string daGlob;
|
std::string daGlob;
|
||||||
daGlob = prevBinaryDir;
|
daGlob = prevBinaryDir;
|
||||||
daGlob += "/*.dpi";
|
daGlob += "/*.dpi";
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" looking for dpi files in: " << daGlob << std::endl);
|
" looking for dpi files in: " << daGlob << std::endl, this->Quiet);
|
||||||
gl.FindFiles(daGlob);
|
gl.FindFiles(daGlob);
|
||||||
files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end());
|
files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end());
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Now searching in: " << daGlob << std::endl);
|
"Now searching in: " << daGlob << std::endl, this->Quiet);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1761,9 +1776,9 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
|
||||||
|
|
||||||
if (files.empty())
|
if (files.empty())
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Cannot find any Python Trace.py coverage files."
|
" Cannot find any Python Trace.py coverage files."
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
// No coverage files is a valid thing, so the exit code is 0
|
// No coverage files is a valid thing, so the exit code is 0
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1791,13 +1806,13 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
|
||||||
|
|
||||||
std::string actualSourceFile
|
std::string actualSourceFile
|
||||||
= cmSystemTools::CollapseFullPath(fileName);
|
= cmSystemTools::CollapseFullPath(fileName);
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" Check coverage for file: " << actualSourceFile
|
" Check coverage for file: " << actualSourceFile
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
cmCTestCoverageHandlerContainer::SingleFileCoverageVector* vec
|
cmCTestCoverageHandlerContainer::SingleFileCoverageVector* vec
|
||||||
= &cont->TotalCoverage[actualSourceFile];
|
= &cont->TotalCoverage[actualSourceFile];
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" in file: " << *fileIt << std::endl);
|
" in file: " << *fileIt << std::endl, this->Quiet);
|
||||||
cmsys::ifstream ifile(fileIt->c_str());
|
cmsys::ifstream ifile(fileIt->c_str());
|
||||||
if ( ! ifile )
|
if ( ! ifile )
|
||||||
{
|
{
|
||||||
|
@ -1850,9 +1865,9 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
|
||||||
// So, this will be set to 0.
|
// So, this will be set to 0.
|
||||||
cov = 0;
|
cov = 0;
|
||||||
}
|
}
|
||||||
cmCTestLog(this->CTest, DEBUG, "Prefix: " << prefix
|
cmCTestOptionalLog(this->CTest, DEBUG, "Prefix: " << prefix
|
||||||
<< " cov: " << cov
|
<< " cov: " << cov
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
// Read the line number starting at the 10th character of the gcov
|
// Read the line number starting at the 10th character of the gcov
|
||||||
// output line
|
// output line
|
||||||
long lineIdx = cnt;
|
long lineIdx = cnt;
|
||||||
|
@ -1945,18 +1960,16 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
|
||||||
// for each file run covbr on that file to get the coverage
|
// for each file run covbr on that file to get the coverage
|
||||||
// information for that file
|
// information for that file
|
||||||
std::string outputFile;
|
std::string outputFile;
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"run covbr: "
|
"run covbr: " << std::endl, this->Quiet);
|
||||||
<< std::endl);
|
|
||||||
|
|
||||||
if(!this->RunBullseyeCommand(cont, "covbr", 0, outputFile))
|
if(!this->RunBullseyeCommand(cont, "covbr", 0, outputFile))
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE, "error running covbr for." << "\n");
|
cmCTestLog(this->CTest, ERROR_MESSAGE, "error running covbr for." << "\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"covbr output in " << outputFile
|
"covbr output in " << outputFile << std::endl, this->Quiet);
|
||||||
<< std::endl);
|
|
||||||
// open the output file
|
// open the output file
|
||||||
cmsys::ifstream fin(outputFile.c_str());
|
cmsys::ifstream fin(outputFile.c_str());
|
||||||
if(!fin)
|
if(!fin)
|
||||||
|
@ -2002,10 +2015,8 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
|
||||||
// only allow 100 files in each log file
|
// only allow 100 files in each log file
|
||||||
if ( count != 0 && count % 100 == 0 )
|
if ( count != 0 && count % 100 == 0 )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"start a new log file: "
|
"start a new log file: " << count << std::endl, this->Quiet);
|
||||||
<< count
|
|
||||||
<< std::endl);
|
|
||||||
this->EndCoverageLogFile(covLogFile, logFileCount);
|
this->EndCoverageLogFile(covLogFile, logFileCount);
|
||||||
logFileCount ++;
|
logFileCount ++;
|
||||||
if ( !this->StartCoverageLogFile(covLogFile, logFileCount) )
|
if ( !this->StartCoverageLogFile(covLogFile, logFileCount) )
|
||||||
|
@ -2021,10 +2032,9 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
|
||||||
{
|
{
|
||||||
// we have a new file so count it in the output
|
// we have a new file so count it in the output
|
||||||
count++;
|
count++;
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Produce coverage for file: "
|
"Produce coverage for file: " << file << " " << count
|
||||||
<< file << " " << count
|
<< std::endl, this->Quiet);
|
||||||
<< std::endl);
|
|
||||||
// start the file output
|
// start the file output
|
||||||
covLogFile << "\t<File Name=\""
|
covLogFile << "\t<File Name=\""
|
||||||
<< cmXMLSafe(i->first)
|
<< cmXMLSafe(i->first)
|
||||||
|
@ -2083,13 +2093,13 @@ int cmCTestCoverageHandler::RunBullseyeCommand(
|
||||||
}
|
}
|
||||||
if(arg)
|
if(arg)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Run : " << program << " " << arg << "\n");
|
"Run : " << program << " " << arg << "\n", this->Quiet);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Run : " << program << "\n");
|
"Run : " << program << "\n", this->Quiet);
|
||||||
}
|
}
|
||||||
// create a process object and start it
|
// create a process object and start it
|
||||||
cmCTestRunProcess runCoverageSrc;
|
cmCTestRunProcess runCoverageSrc;
|
||||||
|
@ -2215,17 +2225,17 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
|
||||||
cont->BinaryDir.c_str());
|
cont->BinaryDir.c_str());
|
||||||
if ( !shouldIDoCoverage )
|
if ( !shouldIDoCoverage )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
".NoDartCoverage found, so skip coverage check for: "
|
".NoDartCoverage found, so skip coverage check for: "
|
||||||
<< file
|
<< file
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Doing coverage for: "
|
"Doing coverage for: "
|
||||||
<< file
|
<< file
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
|
|
||||||
coveredFiles.push_back(sourceFile);
|
coveredFiles.push_back(sourceFile);
|
||||||
coveredFilesFullPath.push_back(file);
|
coveredFilesFullPath.push_back(file);
|
||||||
|
@ -2328,23 +2338,23 @@ int cmCTestCoverageHandler::HandleBullseyeCoverage(
|
||||||
const char* covfile = cmSystemTools::GetEnv("COVFILE");
|
const char* covfile = cmSystemTools::GetEnv("COVFILE");
|
||||||
if(!covfile || strlen(covfile) == 0)
|
if(!covfile || strlen(covfile) == 0)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" COVFILE environment variable not found, not running "
|
" COVFILE environment variable not found, not running "
|
||||||
" bullseye\n");
|
" bullseye\n", this->Quiet);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" run covsrc with COVFILE=["
|
" run covsrc with COVFILE=["
|
||||||
<< covfile
|
<< covfile
|
||||||
<< "]" << std::endl);
|
<< "]" << std::endl, this->Quiet);
|
||||||
if(!this->RunBullseyeSourceSummary(cont))
|
if(!this->RunBullseyeSourceSummary(cont))
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||||
"Error running bullseye summary.\n");
|
"Error running bullseye summary.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cmCTestLog(this->CTest, DEBUG, "HandleBullseyeCoverage return 1 "
|
cmCTestOptionalLog(this->CTest, DEBUG, "HandleBullseyeCoverage return 1 "
|
||||||
<< std::endl);
|
<< std::endl, this->Quiet);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2438,8 +2448,8 @@ void cmCTestCoverageHandler::LoadLabels()
|
||||||
std::string fileList = this->CTest->GetBinaryDir();
|
std::string fileList = this->CTest->GetBinaryDir();
|
||||||
fileList += cmake::GetCMakeFilesDirectory();
|
fileList += cmake::GetCMakeFilesDirectory();
|
||||||
fileList += "/TargetDirectories.txt";
|
fileList += "/TargetDirectories.txt";
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" target directory list [" << fileList << "]\n");
|
" target directory list [" << fileList << "]\n", this->Quiet);
|
||||||
cmsys::ifstream finList(fileList.c_str());
|
cmsys::ifstream finList(fileList.c_str());
|
||||||
std::string line;
|
std::string line;
|
||||||
while(cmSystemTools::GetLineFromStream(finList, line))
|
while(cmSystemTools::GetLineFromStream(finList, line))
|
||||||
|
@ -2460,8 +2470,8 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
" loading labels from [" << fname << "]\n");
|
" loading labels from [" << fname << "]\n", this->Quiet);
|
||||||
bool inTarget = true;
|
bool inTarget = true;
|
||||||
std::string source;
|
std::string source;
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
|
@ -30,9 +30,10 @@ public:
|
||||||
typedef std::map<std::string, SingleFileCoverageVector> TotalCoverageMap;
|
typedef std::map<std::string, SingleFileCoverageVector> TotalCoverageMap;
|
||||||
TotalCoverageMap TotalCoverage;
|
TotalCoverageMap TotalCoverage;
|
||||||
std::ostream* OFS;
|
std::ostream* OFS;
|
||||||
|
bool Quiet;
|
||||||
};
|
};
|
||||||
/** \class cmCTestCoverageHandler
|
/** \class cmCTestCoverageHandler
|
||||||
* \brief A class that handles coverage computaiton for ctest
|
* \brief A class that handles coverage computation for ctest
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class cmCTestCoverageHandler : public cmCTestGenericHandler
|
class cmCTestCoverageHandler : public cmCTestGenericHandler
|
||||||
|
|
|
@ -138,12 +138,12 @@ bool cmParseBlanketJSCoverage::LoadCoverageData(std::vector<std::string> files)
|
||||||
{
|
{
|
||||||
size_t i=0;
|
size_t i=0;
|
||||||
std::string path;
|
std::string path;
|
||||||
cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
||||||
"Found " << files.size() <<" Files" << std::endl);
|
"Found " << files.size() <<" Files" << std::endl, this->Coverage.Quiet);
|
||||||
for(i=0;i<files.size();i++)
|
for(i=0;i<files.size();i++)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
||||||
"Reading JSON File " << files[i] << std::endl);
|
"Reading JSON File " << files[i] << std::endl, this->Coverage.Quiet);
|
||||||
|
|
||||||
if(!this->ReadJSONFile(files[i]))
|
if(!this->ReadJSONFile(files[i]))
|
||||||
{
|
{
|
||||||
|
@ -157,8 +157,8 @@ bool cmParseBlanketJSCoverage::ReadJSONFile(std::string file)
|
||||||
{
|
{
|
||||||
cmParseBlanketJSCoverage::JSONParser parser
|
cmParseBlanketJSCoverage::JSONParser parser
|
||||||
(this->Coverage);
|
(this->Coverage);
|
||||||
cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
||||||
"Parsing " << file << std::endl);
|
"Parsing " << file << std::endl, this->Coverage.Quiet);
|
||||||
parser.ParseFile(file);
|
parser.ParseFile(file);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,9 @@ void cmParseCacheCoverage::RemoveUnCoveredFiles()
|
||||||
}
|
}
|
||||||
if(nothing)
|
if(nothing)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"No coverage found in: " << ci->first
|
"No coverage found in: " << ci->first
|
||||||
<< std::endl);
|
<< std::endl, this->Coverage.Quiet);
|
||||||
this->Coverage.TotalCoverage.erase(ci++);
|
this->Coverage.TotalCoverage.erase(ci++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -50,8 +50,8 @@ protected:
|
||||||
if (this->InSources && this->InSource)
|
if (this->InSources && this->InSource)
|
||||||
{
|
{
|
||||||
this->FilePaths.push_back(tmp);
|
this->FilePaths.push_back(tmp);
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Adding Source: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< tmp << std::endl);
|
"Adding Source: " << tmp << std::endl, this->Coverage.Quiet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,9 @@ protected:
|
||||||
{
|
{
|
||||||
if(strcmp(atts[tagCount], "filename") == 0)
|
if(strcmp(atts[tagCount], "filename") == 0)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Reading file: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< atts[tagCount+1]<< std::endl);
|
"Reading file: " << atts[tagCount+1]<< std::endl,
|
||||||
|
this->Coverage.Quiet);
|
||||||
std::string filename = atts[tagCount+1];
|
std::string filename = atts[tagCount+1];
|
||||||
this->CurFileName = "";
|
this->CurFileName = "";
|
||||||
|
|
||||||
|
@ -113,9 +114,9 @@ protected:
|
||||||
fin.open(this->CurFileName.c_str());
|
fin.open(this->CurFileName.c_str());
|
||||||
if (!fin)
|
if (!fin)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Skipping system file " << filename <<
|
"Skipping system file " << filename << std::endl,
|
||||||
std::endl);
|
this->Coverage.Quiet);
|
||||||
|
|
||||||
this->SkipThisClass = true;
|
this->SkipThisClass = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -122,8 +122,9 @@ public:
|
||||||
lastoffset = line.find('(',pos);
|
lastoffset = line.find('(',pos);
|
||||||
if(lastoffset==line.npos)
|
if(lastoffset==line.npos)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
||||||
endnamepos << "File not found " << lastoffset << std::endl);
|
endnamepos << "File not found " << lastoffset << std::endl,
|
||||||
|
this->Coverage.Quiet);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
endnamepos = line.find(')',lastoffset);
|
endnamepos = line.find(')',lastoffset);
|
||||||
|
@ -131,8 +132,9 @@ public:
|
||||||
(endnamepos-1)-lastoffset);
|
(endnamepos-1)-lastoffset);
|
||||||
if(filename.find(".pas") != filename.npos)
|
if(filename.find(".pas") != filename.npos)
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
||||||
"Coverage found for file: " << filename << std::endl);
|
"Coverage found for file: " << filename << std::endl,
|
||||||
|
this->Coverage.Quiet);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pos = lastoffset+1;
|
pos = lastoffset+1;
|
||||||
|
@ -153,8 +155,9 @@ public:
|
||||||
* If that doesn't find any matching files
|
* If that doesn't find any matching files
|
||||||
* return a failure.
|
* return a failure.
|
||||||
*/
|
*/
|
||||||
cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
||||||
"Unable to find file matching" << glob << std::endl);
|
"Unable to find file matching" << glob << std::endl,
|
||||||
|
this->Coverage.Quiet);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
FileLinesType& coverageVector =
|
FileLinesType& coverageVector =
|
||||||
|
@ -229,8 +232,8 @@ bool cmParseDelphiCoverage::LoadCoverageData(
|
||||||
{
|
{
|
||||||
path = files[i];
|
path = files[i];
|
||||||
|
|
||||||
cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
||||||
"Reading HTML File " << path << std::endl);
|
"Reading HTML File " << path << std::endl, this->Coverage.Quiet);
|
||||||
if(cmSystemTools::GetFilenameLastExtension(path) == ".html")
|
if(cmSystemTools::GetFilenameLastExtension(path) == ".html")
|
||||||
{
|
{
|
||||||
if(!this->ReadDelphiHTML(path.c_str()))
|
if(!this->ReadDelphiHTML(path.c_str()))
|
||||||
|
|
|
@ -49,8 +49,9 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser
|
||||||
else if(name == "sourcefile")
|
else if(name == "sourcefile")
|
||||||
{
|
{
|
||||||
this->FileName = atts[1];
|
this->FileName = atts[1];
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Reading file: "
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
<< this->FileName << std::endl);
|
"Reading file: " << this->FileName << std::endl,
|
||||||
|
this->Coverage.Quiet);
|
||||||
for(size_t i=0;i < FilePaths.size();i++)
|
for(size_t i=0;i < FilePaths.size();i++)
|
||||||
{
|
{
|
||||||
std::string finalpath = FilePaths[i] + "/" + this->FileName;
|
std::string finalpath = FilePaths[i] + "/" + this->FileName;
|
||||||
|
@ -148,8 +149,8 @@ bool cmParseJacocoCoverage::LoadCoverageData(
|
||||||
{
|
{
|
||||||
path = files[i];
|
path = files[i];
|
||||||
|
|
||||||
cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT,
|
||||||
"Reading XML File " << path << std::endl);
|
"Reading XML File " << path << std::endl, this->Coverage.Quiet);
|
||||||
if(cmSystemTools::GetFilenameLastExtension(path) == ".xml")
|
if(cmSystemTools::GetFilenameLastExtension(path) == ".xml")
|
||||||
{
|
{
|
||||||
if(!this->ReadJacocoXML(path.c_str()))
|
if(!this->ReadJacocoXML(path.c_str()))
|
||||||
|
|
|
@ -131,6 +131,9 @@ add_RunCMake_test(cmake_minimum_required)
|
||||||
add_RunCMake_test(continue)
|
add_RunCMake_test(continue)
|
||||||
add_RunCMake_test(ctest_build)
|
add_RunCMake_test(ctest_build)
|
||||||
add_RunCMake_test(ctest_configure)
|
add_RunCMake_test(ctest_configure)
|
||||||
|
if(COVERAGE_COMMAND)
|
||||||
|
add_RunCMake_test(ctest_coverage -DCOVERAGE_COMMAND=${COVERAGE_COMMAND})
|
||||||
|
endif()
|
||||||
add_RunCMake_test(ctest_start)
|
add_RunCMake_test(ctest_start)
|
||||||
add_RunCMake_test(ctest_submit)
|
add_RunCMake_test(ctest_submit)
|
||||||
add_RunCMake_test(ctest_test)
|
add_RunCMake_test(ctest_test)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
project(CTestCoverage@CASE_NAME@ NONE)
|
||||||
|
include(CTest)
|
||||||
|
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
|
|
@ -0,0 +1 @@
|
||||||
|
set(CTEST_PROJECT_NAME "CTestCoverage@CASE_NAME@")
|
|
@ -0,0 +1 @@
|
||||||
|
sec$
|
|
@ -0,0 +1,10 @@
|
||||||
|
include(RunCTest)
|
||||||
|
|
||||||
|
set(CASE_CTEST_COVERAGE_ARGS "")
|
||||||
|
|
||||||
|
function(run_ctest_coverage CASE_NAME)
|
||||||
|
set(CASE_CTEST_COVERAGE_ARGS "${ARGN}")
|
||||||
|
run_ctest(${CASE_NAME})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
run_ctest_coverage(CoverageQuiet QUIET)
|
|
@ -0,0 +1,18 @@
|
||||||
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
|
||||||
|
set(CTEST_SITE "test-site")
|
||||||
|
set(CTEST_BUILD_NAME "test-build-name")
|
||||||
|
set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@")
|
||||||
|
set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
|
||||||
|
set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
|
||||||
|
set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
|
||||||
|
set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
|
||||||
|
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
|
||||||
|
set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@")
|
||||||
|
|
||||||
|
set(ctest_coverage_args "@CASE_CTEST_COVERAGE_ARGS@")
|
||||||
|
ctest_start(Experimental)
|
||||||
|
ctest_configure()
|
||||||
|
ctest_build()
|
||||||
|
ctest_test()
|
||||||
|
ctest_coverage(${ctest_coverage_args})
|
Loading…
Reference in New Issue