Merge topic 'fix-12490-shorten-gcov-filenames'

2f309cb CTest: Add COVERAGE_EXTRA_FLAGS cache variable (#12490)
This commit is contained in:
David Cole 2011-10-25 15:34:16 -04:00 committed by CMake Topic Stage
commit 5576655f36
3 changed files with 14 additions and 3 deletions

View File

@ -189,6 +189,8 @@ IF(BUILD_TESTING)
FIND_PROGRAM(COVERAGE_COMMAND gcov DOC FIND_PROGRAM(COVERAGE_COMMAND gcov DOC
"Path to the coverage program that CTest uses for performing coverage inspection" "Path to the coverage program that CTest uses for performing coverage inspection"
) )
SET(COVERAGE_EXTRA_FLAGS "-l" CACHE STRING
"Extra command line flags to pass to the coverage tool")
# set the site name # set the site name
SITE_NAME(SITE) SITE_NAME(SITE)
@ -257,6 +259,7 @@ IF(BUILD_TESTING)
BZRCOMMAND BZRCOMMAND
BZR_UPDATE_OPTIONS BZR_UPDATE_OPTIONS
COVERAGE_COMMAND COVERAGE_COMMAND
COVERAGE_EXTRA_FLAGS
CTEST_SUBMIT_RETRY_DELAY CTEST_SUBMIT_RETRY_DELAY
CTEST_SUBMIT_RETRY_COUNT CTEST_SUBMIT_RETRY_COUNT
CVSCOMMAND CVSCOMMAND

View File

@ -59,14 +59,17 @@ UpdateType: @UPDATE_TYPE@
# Compiler info # Compiler info
Compiler: @CMAKE_CXX_COMPILER@ Compiler: @CMAKE_CXX_COMPILER@
# Dynamic analysis and coverage # Dynamic analysis (MemCheck)
PurifyCommand: @PURIFYCOMMAND@ PurifyCommand: @PURIFYCOMMAND@
ValgrindCommand: @VALGRIND_COMMAND@ ValgrindCommand: @VALGRIND_COMMAND@
ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@ ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@
MemoryCheckCommand: @MEMORYCHECK_COMMAND@ MemoryCheckCommand: @MEMORYCHECK_COMMAND@
MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@ MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@
MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@ MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@
# Coverage
CoverageCommand: @COVERAGE_COMMAND@ CoverageCommand: @COVERAGE_COMMAND@
CoverageExtraFlags: @COVERAGE_EXTRA_FLAGS@
# Cluster commands # Cluster commands
SlurmBatchCommand: @SLURM_SBATCH_COMMAND@ SlurmBatchCommand: @SLURM_SBATCH_COMMAND@

View File

@ -751,12 +751,15 @@ int cmCTestCoverageHandler::HandlePHPCoverage(
} }
return static_cast<int>(cont->TotalCoverage.size()); return static_cast<int>(cont->TotalCoverage.size());
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCTestCoverageHandler::HandleGCovCoverage( int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestCoverageHandlerContainer* cont) cmCTestCoverageHandlerContainer* cont)
{ {
std::string gcovCommand std::string gcovCommand
= this->CTest->GetCTestConfiguration("CoverageCommand"); = this->CTest->GetCTestConfiguration("CoverageCommand");
std::string gcovExtraFlags
= this->CTest->GetCTestConfiguration("CoverageExtraFlags");
// Style 1 // Style 1
std::string st1gcovOutputRex1 std::string st1gcovOutputRex1
@ -825,8 +828,10 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
// Call gcov to get coverage data for this *.gcda file: // Call gcov to get coverage data for this *.gcda file:
// //
std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str()); std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str());
std::string command = "\"" + gcovCommand + "\" -l -p -o \"" + fileDir std::string command = "\"" + gcovCommand + "\" " +
+ "\" \"" + *it + "\""; gcovExtraFlags + " " +
"-o \"" + fileDir + "\" " +
"\"" + *it + "\"";
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
<< std::endl); << std::endl);