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 a8e26f88de9cc5ca38b264a34ce498a1808d8c44 (commit) via e32877b0f71adca5879f5e04f8f9c6f45d06f52f (commit) from 91731c0eedc11154ac4b32952a78a3cd8a1d8edc (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=a8e26f88de9cc5ca38b264a34ce498a1808d8c44 commit a8e26f88de9cc5ca38b264a34ce498a1808d8c44 Merge: 91731c0 e32877b Author: Joe Snyder <joe.sny...@kitware.com> AuthorDate: Thu Oct 16 12:34:37 2014 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Thu Oct 16 12:34:37 2014 -0400 Merge topic 'add_delphi_coverage' into next e32877b0 CTest: Fix alignment http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e32877b0f71adca5879f5e04f8f9c6f45d06f52f commit e32877b0f71adca5879f5e04f8f9c6f45d06f52f Author: Joseph Snyder <joe.sny...@kitware.com> AuthorDate: Thu Oct 16 12:33:18 2014 -0400 Commit: Joseph Snyder <joe.sny...@kitware.com> CommitDate: Thu Oct 16 12:33:18 2014 -0400 CTest: Fix alignment Fix the alignment of braces and code to align with CTest standards. diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index 0dd7b55..ad71c85 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -11,205 +11,203 @@ class cmParseDelphiCoverage::HTMLParser { - public: - typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector - FileLinesType; - HTMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont) - : CTest(ctest), Coverage(cont) - { - } +public: + typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector + FileLinesType; + HTMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont) + : CTest(ctest), Coverage(cont) + { + } - virtual ~HTMLParser() - { - } + virtual ~HTMLParser() + { + } - bool initializeDelphiFile(const std::string filename, - cmParseDelphiCoverage::HTMLParser::FileLinesType &coverageVector) + bool initializeDelphiFile(const std::string filename, + cmParseDelphiCoverage::HTMLParser::FileLinesType &coverageVector) + { + std::string line; + size_t comPos; + size_t semiPos; + bool blockComFlag= false; + bool lineComFlag= false; + std::vector<std::string> beginSet; + cmsys::ifstream in(filename.c_str()); + if(!in) { - std::string line; - size_t comPos; - size_t semiPos; - bool blockComFlag= false; - bool lineComFlag= false; - std::vector<std::string> beginSet; - cmsys::ifstream in(filename.c_str()); - if(!in) - { - return false; - } - while(cmSystemTools::GetLineFromStream(in, line)) - { - lineComFlag=false; - // Unique cases found in lines. - size_t beginPos = line.find("begin"); - - //Check that the begin is the first non-space string on the line - if( (beginPos == line.find_first_not_of(' ')) && beginPos != line.npos ) - { - beginSet.push_back("begin"); - coverageVector.push_back(-1); - continue; - } - else if (line.find('{') != line.npos) - { - blockComFlag=true; - } - else if (line.find('}') != line.npos) - { - blockComFlag=false; - coverageVector.push_back(-1); - continue; - } - else if ((line.find("end;") != line.npos) - && (beginSet.size() > 0)) - { - beginSet.pop_back(); - coverageVector.push_back(-1); - continue; - } - - // This checks for comments after lines of code, finding the - // comment symbol after the ending semicolon. - comPos = line.find("//"); - if(comPos != line.npos) - { - semiPos= line.find(';'); - if (comPos < semiPos) - { - lineComFlag=true; - } - } - //Based up what was found, add a line to the coverageVector - if((beginSet.size() > 0) && line != "" && !blockComFlag - && !lineComFlag) - { - coverageVector.push_back(0); - } - else - { - coverageVector.push_back(-1); - } - } - return true; + return false; } - bool ParseFile(const char* file) + while(cmSystemTools::GetLineFromStream(in, line)) { - std::string line=file; - std::string lineresult; - std::string lastroutine; - std::string filename; - std::string filelineoffset; - size_t afterLineNum = 0; - size_t lastoffset = 0; - size_t endcovpos = 0; - size_t endnamepos = 0; - size_t pos = 0; + lineComFlag=false; + // Unique cases found in lines. + size_t beginPos = line.find("begin"); - /* - * This first 'while' section goes through the found HTML - * file name and attempts to capture the source file name - * which is set as part of the HTML file name: the name of - * the file is found in parenthesis '()' - * - * See test HTML file name: UTCovTest(UTCovTest.pas).html. - * - * Find the text inside each pair of parenthesis and check - * to see if it ends in '.pas'. If it can't be found, - * exit the function. - */ - while(true) + //Check that the begin is the first non-space string on the line + if( (beginPos == line.find_first_not_of(' ')) && beginPos != line.npos ) { - lastoffset = line.find('(',pos); - if(lastoffset==line.npos) - { - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - endnamepos << "File not found " << lastoffset << std::endl); - return false; - } - endnamepos = line.find(')',lastoffset); - filename = line.substr(lastoffset+1, - (endnamepos-1)-lastoffset); - if(filename.find(".pas") != filename.npos) + beginSet.push_back("begin"); + coverageVector.push_back(-1); + continue; + } + else if(line.find('{') != line.npos) + { + blockComFlag=true; + } + else if(line.find('}') != line.npos) + { + blockComFlag=false; + coverageVector.push_back(-1); + continue; + } + else if((line.find("end;") != line.npos) + && (beginSet.size() > 0)) + { + beginSet.pop_back(); + coverageVector.push_back(-1); + continue; + } + + // This checks for comments after lines of code, finding the + // comment symbol after the ending semicolon. + comPos = line.find("//"); + if(comPos != line.npos) + { + semiPos= line.find(';'); + if(comPos < semiPos) { - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Coverage found for file: " << filename << std::endl); - break; + lineComFlag=true; } - pos = lastoffset+1; - endnamepos = 0; - lastoffset =0; } - /* - * Glob through the source directory for the - * file found above - */ - cmsys::Glob gl; - gl.RecurseOn(); - gl.RecurseThroughSymlinksOff(); - std::string glob = Coverage.SourceDir + "*/" + filename; - gl.FindFiles(glob); - std::vector<std::string> const& files = gl.GetFiles(); - if (files.size() == 0) + //Based up what was found, add a line to the coverageVector + if((beginSet.size() > 0) && line != "" && !blockComFlag + && !lineComFlag) { - /* - * If that doesn't find any matching files - * return a failure. - */ - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Unable to find file matching" << glob << std::endl); - return false; + coverageVector.push_back(0); } - FileLinesType& coverageVector = - this->Coverage.TotalCoverage[files[0]]; - - /* - * Initialize the file to have all code between 'begin' and - * 'end' tags marked as executable - */ - - this->initializeDelphiFile(files[0],coverageVector); - - cmsys::ifstream in(file); - if(!in) + else + { + coverageVector.push_back(-1); + } + } + return true; + } + bool ParseFile(const char* file) + { + std::string line=file; + std::string lineresult; + std::string lastroutine; + std::string filename; + std::string filelineoffset; + size_t afterLineNum = 0; + size_t lastoffset = 0; + size_t endcovpos = 0; + size_t endnamepos = 0; + size_t pos = 0; + + /* + * This first 'while' section goes through the found HTML + * file name and attempts to capture the source file name + * which is set as part of the HTML file name: the name of + * the file is found in parenthesis '()' + * + * See test HTML file name: UTCovTest(UTCovTest.pas).html. + * + * Find the text inside each pair of parenthesis and check + * to see if it ends in '.pas'. If it can't be found, + * exit the function. + */ + while(true) + { + lastoffset = line.find('(',pos); + if(lastoffset==line.npos) { + cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + endnamepos << "File not found " << lastoffset << std::endl); return false; } + endnamepos = line.find(')',lastoffset); + filename = line.substr(lastoffset+1, + (endnamepos-1)-lastoffset); + if(filename.find(".pas") != filename.npos) + { + cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Coverage found for file: " << filename << std::endl); + break; + } + pos = lastoffset+1; + endnamepos = 0; + lastoffset =0; + } + /* + * Glob through the source directory for the + * file found above + */ + cmsys::Glob gl; + gl.RecurseOn(); + gl.RecurseThroughSymlinksOff(); + std::string glob = Coverage.SourceDir + "*/" + filename; + gl.FindFiles(glob); + std::vector<std::string> const& files = gl.GetFiles(); + if(files.size() == 0) + { + /* + * If that doesn't find any matching files + * return a failure. + */ + cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Unable to find file matching" << glob << std::endl); + return false; + } + FileLinesType& coverageVector = + this->Coverage.TotalCoverage[files[0]]; + /* + * Initialize the file to have all code between 'begin' and + * 'end' tags marked as executable + */ - /* - * Now read the HTML file, looking for the lines that have an - * "inline" in it. Then parse out the "class" value of that - * line to determine if the line is executed or not. - * - * Sample HTML line: - * - * <tr class="covered"><td>47</td><td><pre style="display:inline;"> - * CheckEquals(1,2-1);</pre></td></tr> - * - */ + this->initializeDelphiFile(files[0],coverageVector); - while( cmSystemTools::GetLineFromStream(in, line)) - { - if(line.find("inline") == line.npos) - { - continue; - } + cmsys::ifstream in(file); + if(!in) + { + return false; + } - lastoffset = line.find("class="); - endcovpos = line.find(">",lastoffset); - lineresult = line.substr(lastoffset+7,(endcovpos-8)-lastoffset); + /* + * Now read the HTML file, looking for the lines that have an + * "inline" in it. Then parse out the "class" value of that + * line to determine if the line is executed or not. + * + * Sample HTML line: + * + * <tr class="covered"><td>47</td><td><pre style="display:inline;"> + * CheckEquals(1,2-1);</pre></td></tr> + * + */ + + while( cmSystemTools::GetLineFromStream(in, line)) + { + if(line.find("inline") == line.npos) + { + continue; + } + lastoffset = line.find("class="); + endcovpos = line.find(">",lastoffset); + lineresult = line.substr(lastoffset+7,(endcovpos-8)-lastoffset); - if(lineresult == "covered") - { - afterLineNum = line.find('<',endcovpos+5); - filelineoffset= line.substr(endcovpos+5, - afterLineNum-(endcovpos+5)); - coverageVector[atoi(filelineoffset.c_str())-1] = 1; - } - } - return true; + if(lineresult == "covered") + { + afterLineNum = line.find('<',endcovpos+5); + filelineoffset= line.substr(endcovpos+5, + afterLineNum-(endcovpos+5)); + coverageVector[atoi(filelineoffset.c_str())-1] = 1; + } } + return true; + } private: @@ -218,16 +216,15 @@ class cmParseDelphiCoverage::HTMLParser }; cmParseDelphiCoverage::cmParseDelphiCoverage( - cmCTestCoverageHandlerContainer& cont, - cmCTest* ctest) - :Coverage(cont), CTest(ctest) + cmCTestCoverageHandlerContainer& cont, cmCTest* ctest) + :Coverage(cont), CTest(ctest) { } bool cmParseDelphiCoverage::LoadCoverageData( const std::vector<std::string> files) -{ - size_t i; + { + size_t i; std::string path; size_t numf = files.size(); for (i = 0; i < numf; i++) @@ -235,7 +232,7 @@ bool cmParseDelphiCoverage::LoadCoverageData( path = files[i]; cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Reading HTML File " << path << std::endl); + "Reading HTML File " << path << std::endl); if(cmSystemTools::GetFilenameLastExtension(path) == ".html") { if(!this->ReadDelphiHTML(path.c_str())) @@ -245,12 +242,12 @@ bool cmParseDelphiCoverage::LoadCoverageData( } } return true; -}; + }; bool cmParseDelphiCoverage::ReadDelphiHTML(const char* file) -{ + { cmParseDelphiCoverage::HTMLParser - parser(this->CTest, this->Coverage); + parser(this->CTest, this->Coverage); parser.ParseFile(file); return true; -}; + }; diff --git a/Source/CTest/cmParseDelphiCoverage.h b/Source/CTest/cmParseDelphiCoverage.h index c8a01f6..018340b 100644 --- a/Source/CTest/cmParseDelphiCoverage.h +++ b/Source/CTest/cmParseDelphiCoverage.h @@ -25,21 +25,22 @@ * * https://code.google.com/p/delphi-code-coverage/ */ + class cmParseDelphiCoverage -{ -public: - cmParseDelphiCoverage(cmCTestCoverageHandlerContainer& cont, + { + public: + cmParseDelphiCoverage(cmCTestCoverageHandlerContainer& cont, cmCTest* ctest); - bool LoadCoverageData(const std::vector<std::string> files); - bool ReadDelphiHTML(const char* file); - // Read a single mcov file - bool ReadHTMLFile(const char* f); + bool LoadCoverageData(const std::vector<std::string> files); + bool ReadDelphiHTML(const char* file); + // Read a single HTML file from output + bool ReadHTMLFile(const char* f); -protected: + protected: - class HTMLParser; - cmCTestCoverageHandlerContainer& Coverage; - cmCTest* CTest; -}; + class HTMLParser; + cmCTestCoverageHandlerContainer& Coverage; + cmCTest* CTest; + }; #endif ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmParseDelphiCoverage.cxx | 371 ++++++++++++++++---------------- Source/CTest/cmParseDelphiCoverage.h | 25 +-- 2 files changed, 197 insertions(+), 199 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits