diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 137 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 3 | ||||
-rw-r--r-- | Source/cmCustomCommandGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmCustomCommandGenerator.h | 1 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmTimestamp.cxx | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 12 |
8 files changed, 71 insertions, 110 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 04380a0..0dd1651 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 9) -set(CMake_VERSION_PATCH 20170909) +set(CMake_VERSION_PATCH 20170912) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 18d9346..9962c49 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -535,14 +535,13 @@ int cmCTestTestHandler::ProcessHandler() << static_cast<int>(percent + .5f) << "% tests passed, " << failed.size() << " tests failed out of " << total << std::endl); - - if (!this->CTest->GetLabelsForSubprojects().empty() && - this->CTest->GetSubprojectSummary()) { - this->PrintSubprojectSummary(); - } else if (this->CTest->GetLabelSummary()) { - this->PrintLabelSummary(); + if ((!this->CTest->GetLabelsForSubprojects().empty() && + this->CTest->GetSubprojectSummary())) { + this->PrintLabelOrSubprojectSummary(true); + } + if (this->CTest->GetLabelSummary()) { + this->PrintLabelOrSubprojectSummary(false); } - char realBuf[1024]; sprintf(realBuf, "%6.2f sec", clock_finish - clock_start); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, @@ -620,96 +619,32 @@ int cmCTestTestHandler::ProcessHandler() return 0; } -void cmCTestTestHandler::PrintLabelSummary() -{ - cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin(); - std::map<std::string, double> labelTimes; - std::map<std::string, int> labelCounts; - std::set<std::string> labels; - // initialize maps - std::string::size_type maxlen = 0; - for (; it != this->TestList.end(); ++it) { - cmCTestTestProperties& p = *it; - if (!p.Labels.empty()) { - for (std::vector<std::string>::iterator l = p.Labels.begin(); - l != p.Labels.end(); ++l) { - if ((*l).size() > maxlen) { - maxlen = (*l).size(); - } - labels.insert(*l); - labelTimes[*l] = 0; - labelCounts[*l] = 0; - } - } - } - cmCTestTestHandler::TestResultsVector::iterator ri = - this->TestResults.begin(); - // fill maps - for (; ri != this->TestResults.end(); ++ri) { - cmCTestTestResult& result = *ri; - cmCTestTestProperties& p = *result.Properties; - if (!p.Labels.empty()) { - for (std::vector<std::string>::iterator l = p.Labels.begin(); - l != p.Labels.end(); ++l) { - labelTimes[*l] += result.ExecutionTime; - ++labelCounts[*l]; - } - } - } - // now print times - if (!labels.empty()) { - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:", - this->Quiet); - } - for (std::set<std::string>::const_iterator i = labels.begin(); - i != labels.end(); ++i) { - std::string label = *i; - label.resize(maxlen + 3, ' '); - - char buf[1024]; - sprintf(buf, "%6.2f sec", labelTimes[*i]); - - std::ostringstream labelCountStr; - labelCountStr << "(" << labelCounts[*i] << " test"; - if (labelCounts[*i] > 1) { - labelCountStr << "s"; - } - labelCountStr << ")"; - - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n" - << label << " = " << buf << " " - << labelCountStr.str(), - this->Quiet); - if (this->LogFile) { - *this->LogFile << "\n" << *i << " = " << buf << "\n"; - } - } - if (!labels.empty()) { - if (this->LogFile) { - *this->LogFile << "\n"; - } - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n", this->Quiet); - } -} - -void cmCTestTestHandler::PrintSubprojectSummary() +void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) { + // collect subproject labels std::vector<std::string> subprojects = this->CTest->GetLabelsForSubprojects(); - - cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin(); std::map<std::string, double> labelTimes; std::map<std::string, int> labelCounts; std::set<std::string> labels; - // initialize maps std::string::size_type maxlen = 0; - for (; it != this->TestList.end(); ++it) { + // initialize maps + for (cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin(); + it != this->TestList.end(); ++it) { cmCTestTestProperties& p = *it; for (std::vector<std::string>::iterator l = p.Labels.begin(); l != p.Labels.end(); ++l) { + // first check to see if the current label is a subproject label + bool isSubprojectLabel = false; std::vector<std::string>::iterator subproject = std::find(subprojects.begin(), subprojects.end(), *l); if (subproject != subprojects.end()) { + isSubprojectLabel = true; + } + // if we are doing sub projects and this label is one, then use it + // if we are not doing sub projects and the label is not one use it + if ((doSubProject && isSubprojectLabel) || + (!doSubProject && !isSubprojectLabel)) { if ((*l).size() > maxlen) { maxlen = (*l).size(); } @@ -719,26 +654,32 @@ void cmCTestTestHandler::PrintSubprojectSummary() } } } - cmCTestTestHandler::TestResultsVector::iterator ri = - this->TestResults.begin(); // fill maps - for (; ri != this->TestResults.end(); ++ri) { + for (cmCTestTestHandler::TestResultsVector::iterator ri = + this->TestResults.begin(); + ri != this->TestResults.end(); ++ri) { cmCTestTestResult& result = *ri; cmCTestTestProperties& p = *result.Properties; for (std::vector<std::string>::iterator l = p.Labels.begin(); l != p.Labels.end(); ++l) { - std::vector<std::string>::iterator subproject = - std::find(subprojects.begin(), subprojects.end(), *l); - if (subproject != subprojects.end()) { - labelTimes[*l] += result.ExecutionTime; + // only use labels found in labels + if (labels.find(*l) != labels.end()) { + labelTimes[*l] += result.ExecutionTime * result.Properties->Processors; ++labelCounts[*l]; } } } + // if no labels are found return and print nothing + if (labels.empty()) { + return; + } // now print times - if (!labels.empty()) { + if (doSubProject) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nSubproject Time Summary:", this->Quiet); + } else { + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:", + this->Quiet); } for (std::set<std::string>::const_iterator i = labels.begin(); i != labels.end(); ++i) { @@ -746,7 +687,7 @@ void cmCTestTestHandler::PrintSubprojectSummary() label.resize(maxlen + 3, ' '); char buf[1024]; - sprintf(buf, "%6.2f sec", labelTimes[*i]); + sprintf(buf, "%6.2f sec*proc", labelTimes[*i]); std::ostringstream labelCountStr; labelCountStr << "(" << labelCounts[*i] << " test"; @@ -754,7 +695,6 @@ void cmCTestTestHandler::PrintSubprojectSummary() labelCountStr << "s"; } labelCountStr << ")"; - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n" << label << " = " << buf << " " << labelCountStr.str(), @@ -763,13 +703,12 @@ void cmCTestTestHandler::PrintSubprojectSummary() *this->LogFile << "\n" << *i << " = " << buf << "\n"; } } - if (!labels.empty()) { - if (this->LogFile) { - *this->LogFile << "\n"; - } - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n", this->Quiet); + if (this->LogFile) { + *this->LogFile << "\n"; } + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n", this->Quiet); } + void cmCTestTestHandler::CheckLabelFilterInclude(cmCTestTestProperties& it) { // if not using Labels to filter then return diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 965552c..4c5b55f 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -232,8 +232,7 @@ private: */ virtual void GenerateDartOutput(cmXMLWriter& xml); - void PrintLabelSummary(); - void PrintSubprojectSummary(); + void PrintLabelOrSubprojectSummary(bool isSubProject); /** * Run the tests for a directory and any subdirectories diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index fdc0a97..fa1c70e 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -13,6 +13,8 @@ #include "cmSystemTools.h" #include "cm_auto_ptr.hxx" +#include <stddef.h> + cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, const std::string& config, cmLocalGenerator* lg) @@ -97,6 +99,18 @@ const char* cmCustomCommandGenerator::GetArgv0Location(unsigned int c) const return nullptr; } +bool cmCustomCommandGenerator::HasOnlyEmptyCommandLines() const +{ + for (size_t i = 0; i < this->CommandLines.size(); ++i) { + for (size_t j = 0; j < this->CommandLines[i].size(); ++j) { + if (!this->CommandLines[i][j].empty()) { + return false; + } + } + } + return true; +} + std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { if (const char* emulator = this->GetCrossCompilingEmulator(c)) { diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index ea33b51..34fd653 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -40,6 +40,7 @@ public: std::vector<std::string> const& GetOutputs() const; std::vector<std::string> const& GetByproducts() const; std::vector<std::string> const& GetDepends() const; + bool HasOnlyEmptyCommandLines() const; }; #endif diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 41025af..d772d95 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -191,13 +191,17 @@ std::string cmLocalVisualStudioGenerator::ConstructScript( // Write each command on a single line. for (unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) { + // Add this command line. + std::string cmd = ccg.GetCommand(c); + + if (cmd.empty()) { + continue; + } + // Start a new line. script += newline; newline = newline_text; - // Add this command line. - std::string cmd = ccg.GetCommand(c); - // Use "call " before any invocations of .bat or .cmd files // invoked as custom commands. // diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 4dea24c..9fb79d9 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -123,7 +123,9 @@ std::string cmTimestamp::AddTimestampComponent(char flag, switch (flag) { case 'a': + case 'A': case 'b': + case 'B': case 'd': case 'H': case 'I': diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7fe2f2a..bd3e82d 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3536,11 +3536,13 @@ void cmVisualStudio10TargetGenerator::WriteEvent( for (std::vector<cmCustomCommand>::const_iterator i = commands.begin(); i != commands.end(); ++i) { cmCustomCommandGenerator ccg(*i, configName, this->LocalGenerator); - comment += pre; - comment += lg->ConstructComment(ccg); - script += pre; - pre = "\n"; - script += cmVS10EscapeXML(lg->ConstructScript(ccg)); + if (!ccg.HasOnlyEmptyCommandLines()) { + comment += pre; + comment += lg->ConstructComment(ccg); + script += pre; + pre = "\n"; + script += cmVS10EscapeXML(lg->ConstructScript(ccg)); + } } comment = cmVS10EscapeComment(comment); if (this->ProjectType != csproj) { |