diff options
Diffstat (limited to 'Source/CTest')
40 files changed, 193 insertions, 146 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index 8d787ea..5885738 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestGenericHandler.h" -#include "cmTypeMacro.h" #include <sstream> #include <stddef.h> @@ -22,7 +21,7 @@ class cmake; class cmCTestBuildAndTestHandler : public cmCTestGenericHandler { public: - cmTypeMacro(cmCTestBuildAndTestHandler, cmCTestGenericHandler); + typedef cmCTestGenericHandler Superclass; /* * The main entry point for this class diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 0aaf623..9cc6f7e 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestHandlerCommand.h" -#include "cmTypeMacro.h" #include <string> #include <vector> @@ -47,8 +46,6 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) CM_OVERRIDE; - cmTypeMacro(cmCTestBuildCommand, cmCTestHandlerCommand); - cmGlobalGenerator* GlobalGenerator; protected: diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 7b4d994..a455908 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -7,6 +7,7 @@ #include "cmFileTimeComparison.h" #include "cmGeneratedFileStream.h" #include "cmMakefile.h" +#include "cmProcessOutput.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" @@ -765,7 +766,7 @@ void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers( int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, const char* dir, int timeout, - std::ostream& ofs) + std::ostream& ofs, Encoding encoding) { // First generate the command and arguments std::vector<std::string> args = cmSystemTools::ParseArguments(command); @@ -809,6 +810,8 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, char* data; int length; + cmProcessOutput processOutput(encoding); + std::string strdata; cmCTestOptionalLog( this->CTest, HANDLER_PROGRESS_OUTPUT, " Each symbol represents " << tick_len << " bytes of output." << std::endl @@ -842,13 +845,25 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, // Process the chunk of data if (res == cmsysProcess_Pipe_STDERR) { - this->ProcessBuffer(data, length, tick, tick_len, ofs, + processOutput.DecodeText(data, length, strdata, 1); + this->ProcessBuffer(strdata.c_str(), strdata.size(), tick, tick_len, ofs, &this->BuildProcessingErrorQueue); } else { - this->ProcessBuffer(data, length, tick, tick_len, ofs, + processOutput.DecodeText(data, length, strdata, 2); + this->ProcessBuffer(strdata.c_str(), strdata.size(), tick, tick_len, ofs, &this->BuildProcessingQueue); } } + processOutput.DecodeText(std::string(), strdata, 1); + if (!strdata.empty()) { + this->ProcessBuffer(strdata.c_str(), strdata.size(), tick, tick_len, ofs, + &this->BuildProcessingErrorQueue); + } + processOutput.DecodeText(std::string(), strdata, 2); + if (!strdata.empty()) { + this->ProcessBuffer(strdata.c_str(), strdata.size(), tick, tick_len, ofs, + &this->BuildProcessingQueue); + } this->ProcessBuffer(CM_NULLPTR, 0, tick, tick_len, ofs, &this->BuildProcessingQueue); @@ -920,7 +935,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, //###################################################################### //###################################################################### -void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, +void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length, size_t& tick, size_t tick_len, std::ostream& ofs, t_BuildProcessingQueueType* queue) diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index 16563ce..a2f6112 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -6,8 +6,8 @@ #include <cmConfigure.h> #include "cmCTestGenericHandler.h" -#include "cmTypeMacro.h" +#include <cmProcessOutput.h> #include <cmsys/RegularExpression.hxx> #include <deque> #include <iosfwd> @@ -25,7 +25,8 @@ class cmXMLWriter; class cmCTestBuildHandler : public cmCTestGenericHandler { public: - cmTypeMacro(cmCTestBuildHandler, cmCTestGenericHandler); + typedef cmCTestGenericHandler Superclass; + typedef cmProcessOutput::Encoding Encoding; /* * The main entry point for this class @@ -50,7 +51,8 @@ private: //! Run command specialized for make and configure. Returns process status // and retVal is return value or exception. int RunMakeCommand(const char* command, int* retVal, const char* dir, - int timeout, std::ostream& ofs); + int timeout, std::ostream& ofs, + Encoding encoding = cmProcessOutput::Auto); enum { @@ -108,7 +110,7 @@ private: typedef std::deque<char> t_BuildProcessingQueueType; - void ProcessBuffer(const char* data, int length, size_t& tick, + void ProcessBuffer(const char* data, size_t length, size_t& tick, size_t tick_len, std::ostream& ofs, t_BuildProcessingQueueType* queue); int ProcessSingleLine(const char* data); diff --git a/Source/CTest/cmCTestCommand.h b/Source/CTest/cmCTestCommand.h index 2b9b93b..6fc237a 100644 --- a/Source/CTest/cmCTestCommand.h +++ b/Source/CTest/cmCTestCommand.h @@ -26,8 +26,6 @@ public: cmCTest* CTest; cmCTestScriptHandler* CTestScriptHandler; - - cmTypeMacro(cmCTestCommand, cmCommand); }; #endif diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 62802ef..73e893d 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -102,6 +102,10 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmakeConfigureCommand += "\""; } + if (this->Makefile->IsOn("CTEST_USE_LAUNCHERS")) { + cmakeConfigureCommand += " \"-DCTEST_USE_LAUNCHERS:BOOL=TRUE\""; + } + cmakeConfigureCommand += " \"-G"; cmakeConfigureCommand += cmakeGeneratorName; cmakeConfigureCommand += "\""; diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index 8bc69fe..22d1217 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestHandlerCommand.h" -#include "cmTypeMacro.h" #include <string> @@ -39,8 +38,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "ctest_configure"; } - cmTypeMacro(cmCTestConfigureCommand, cmCTestHandlerCommand); - protected: cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h index 913e5c9..7fa95ed 100644 --- a/Source/CTest/cmCTestConfigureHandler.h +++ b/Source/CTest/cmCTestConfigureHandler.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestGenericHandler.h" -#include "cmTypeMacro.h" /** \class cmCTestConfigureHandler * \brief A class that handles ctest -S invocations @@ -15,7 +14,7 @@ class cmCTestConfigureHandler : public cmCTestGenericHandler { public: - cmTypeMacro(cmCTestConfigureHandler, cmCTestGenericHandler); + typedef cmCTestGenericHandler Superclass; /* * The main entry point for this class diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index d54e68d..bf42aa1 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestHandlerCommand.h" -#include "cmTypeMacro.h" #include <set> #include <string> @@ -40,7 +39,7 @@ public: */ std::string GetName() const CM_OVERRIDE { return "ctest_coverage"; } - cmTypeMacro(cmCTestCoverageCommand, cmCTestHandlerCommand); + typedef cmCTestHandlerCommand Superclass; protected: cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 062f971..339b5d7 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestGenericHandler.h" -#include "cmTypeMacro.h" #include <cmsys/RegularExpression.hxx> #include <iosfwd> @@ -38,7 +37,7 @@ public: class cmCTestCoverageHandler : public cmCTestGenericHandler { public: - cmTypeMacro(cmCTestCoverageHandler, cmCTestGenericHandler); + typedef cmCTestGenericHandler Superclass; /* * The main entry point for this class diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index 8b5d5a4..4c1438b 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestCommand.h" -#include "cmTypeMacro.h" #include <string> #include <vector> @@ -51,8 +50,6 @@ public: { return "ctest_empty_binary_directory"; } - - cmTypeMacro(cmCTestEmptyBinaryDirectoryCommand, cmCTestCommand); }; #endif diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 1bc1851..20512ea 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -91,7 +91,8 @@ std::string cmCTestGIT::FindGitDir() std::string git_dir_line; OneLineParser rev_parse_out(this, "rev-parse-out> ", git_dir_line); OutputLogger rev_parse_err(this->Log, "rev-parse-err> "); - if (this->RunChild(git_rev_parse, &rev_parse_out, &rev_parse_err)) { + if (this->RunChild(git_rev_parse, &rev_parse_out, &rev_parse_err, CM_NULLPTR, + cmProcessOutput::UTF8)) { git_dir = git_dir_line; } if (git_dir.empty()) { @@ -114,7 +115,8 @@ std::string cmCTestGIT::FindGitDir() 0 }; OneLineParser cygpath_out(this, "cygpath-out> ", git_dir_line); OutputLogger cygpath_err(this->Log, "cygpath-err> "); - if (this->RunChild(cygpath, &cygpath_out, &cygpath_err)) { + if (this->RunChild(cygpath, &cygpath_out, &cygpath_err, CM_NULLPTR, + cmProcessOutput::UTF8)) { git_dir = git_dir_line; } } @@ -134,7 +136,8 @@ std::string cmCTestGIT::FindTopDir() std::string cdup; OneLineParser rev_parse_out(this, "rev-parse-out> ", cdup); OutputLogger rev_parse_err(this->Log, "rev-parse-err> "); - if (this->RunChild(git_rev_parse, &rev_parse_out, &rev_parse_err) && + if (this->RunChild(git_rev_parse, &rev_parse_out, &rev_parse_err, CM_NULLPTR, + cmProcessOutput::UTF8) && !cdup.empty()) { top_dir += "/"; top_dir += cdup; @@ -624,7 +627,7 @@ void cmCTestGIT::LoadRevisions() CommitParser out(this, "dt-out> "); OutputLogger err(this->Log, "dt-err> "); - this->RunProcess(cp, &out, &err); + this->RunProcess(cp, &out, &err, cmProcessOutput::UTF8); // Send one extra zero-byte to terminate the last record. out.Process("", 1); @@ -641,14 +644,16 @@ void cmCTestGIT::LoadModifications() CM_NULLPTR }; OutputLogger ui_out(this->Log, "ui-out> "); OutputLogger ui_err(this->Log, "ui-err> "); - this->RunChild(git_update_index, &ui_out, &ui_err); + this->RunChild(git_update_index, &ui_out, &ui_err, CM_NULLPTR, + cmProcessOutput::UTF8); // Use 'git diff-index' to get modified files. const char* git_diff_index[] = { git, "diff-index", "-z", "HEAD", "--", CM_NULLPTR }; DiffParser out(this, "di-out> "); OutputLogger err(this->Log, "di-err> "); - this->RunChild(git_diff_index, &out, &err); + this->RunChild(git_diff_index, &out, &err, CM_NULLPTR, + cmProcessOutput::UTF8); for (std::vector<Change>::const_iterator ci = out.Changes.begin(); ci != out.Changes.end(); ++ci) { diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index b2ab1d2..4176eb2 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTest.h" -#include "cmObject.h" #include "cmSystemTools.h" #include <map> @@ -22,7 +21,7 @@ class cmMakefile; * \brief A superclass of all CTest Handlers * */ -class cmCTestGenericHandler : public cmObject +class cmCTestGenericHandler { public: /** @@ -70,7 +69,7 @@ public: * Construct handler */ cmCTestGenericHandler(); - ~cmCTestGenericHandler() CM_OVERRIDE; + virtual ~cmCTestGenericHandler(); typedef std::map<std::string, std::string> t_StringToString; diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 2e5b56a..a989b12 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -226,6 +226,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, this->Makefile->AddDefinition(this->Values[ct_RETURN_VALUE], str.str().c_str()); } + this->ProcessAdditionalValues(handler); // log the error message if there was an error if (capureCMakeError) { const char* returnString = "0"; @@ -246,6 +247,10 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, return true; } +void cmCTestHandlerCommand::ProcessAdditionalValues(cmCTestGenericHandler*) +{ +} + bool cmCTestHandlerCommand::CheckArgumentKeyword(std::string const& arg) { // Look for non-value arguments common to all commands. diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h index 3fd384f..c86841f 100644 --- a/Source/CTest/cmCTestHandlerCommand.h +++ b/Source/CTest/cmCTestHandlerCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestCommand.h" -#include "cmTypeMacro.h" #include <stddef.h> #include <string> @@ -32,8 +31,6 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) CM_OVERRIDE; - cmTypeMacro(cmCTestHandlerCommand, cmCTestCommand); - enum { ct_NONE, @@ -48,6 +45,8 @@ public: protected: virtual cmCTestGenericHandler* InitializeHandler() = 0; + virtual void ProcessAdditionalValues(cmCTestGenericHandler* handler); + // Command argument handling. virtual bool CheckArgumentKeyword(std::string const& arg); virtual bool CheckArgumentValue(std::string const& arg); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index e5c50b2..43c0fef 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -4,17 +4,18 @@ #include <cmConfigure.h> +#include "cmCryptoHash.h" #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmProcessOutput.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" #include "cmake.h" #include <cm_auto_ptr.hxx> #include <cmsys/FStream.hxx> -#include <cmsys/MD5.h> #include <cmsys/Process.h> #include <cmsys/RegularExpression.hxx> #include <iostream> @@ -167,17 +168,14 @@ void cmCTestLaunch::ComputeFileNames() // We hash the input command working dir and command line to obtain // a repeatable and (probably) unique name for log files. - char hash[32]; - cmsysMD5* md5 = cmsysMD5_New(); - cmsysMD5_Initialize(md5); - cmsysMD5_Append(md5, (unsigned char const*)(this->CWD.c_str()), -1); + cmCryptoHash md5(cmCryptoHash::AlgoMD5); + md5.Initialize(); + md5.Append(this->CWD); for (std::vector<std::string>::const_iterator ai = this->RealArgs.begin(); ai != this->RealArgs.end(); ++ai) { - cmsysMD5_Append(md5, (unsigned char const*)ai->c_str(), -1); + md5.Append(*ai); } - cmsysMD5_FinalizeHex(md5, hash); - cmsysMD5_Delete(md5); - this->LogHash.assign(hash, 32); + this->LogHash = md5.FinalizeHex(); // We store stdout and stderr in temporary log files. this->LogOut = this->LogDir; @@ -228,17 +226,31 @@ void cmCTestLaunch::RunChild() if (!this->Passthru) { char* data = CM_NULLPTR; int length = 0; + cmProcessOutput processOutput; + std::string strdata; while (int p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) { if (p == cmsysProcess_Pipe_STDOUT) { - fout.write(data, length); - std::cout.write(data, length); + processOutput.DecodeText(data, length, strdata, 1); + fout.write(strdata.c_str(), strdata.size()); + std::cout.write(strdata.c_str(), strdata.size()); this->HaveOut = true; } else if (p == cmsysProcess_Pipe_STDERR) { - ferr.write(data, length); - std::cerr.write(data, length); + processOutput.DecodeText(data, length, strdata, 2); + ferr.write(strdata.c_str(), strdata.size()); + std::cerr.write(strdata.c_str(), strdata.size()); this->HaveErr = true; } } + processOutput.DecodeText(std::string(), strdata, 1); + if (!strdata.empty()) { + fout.write(strdata.c_str(), strdata.size()); + std::cout.write(strdata.c_str(), strdata.size()); + } + processOutput.DecodeText(std::string(), strdata, 2); + if (!strdata.empty()) { + ferr.write(strdata.c_str(), strdata.size()); + std::cerr.write(strdata.c_str(), strdata.size()); + } } // Wait for the real command to finish. diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx index 05d0a53..5e4c5ae 100644 --- a/Source/CTest/cmCTestMemCheckCommand.cxx +++ b/Source/CTest/cmCTestMemCheckCommand.cxx @@ -4,6 +4,15 @@ #include "cmCTest.h" #include "cmCTestGenericHandler.h" +#include "cmCTestMemCheckHandler.h" +#include "cmMakefile.h" + +cmCTestMemCheckCommand::cmCTestMemCheckCommand() +{ + this->Arguments[ctm_DEFECT_COUNT] = "DEFECT_COUNT"; + this->Arguments[ctm_LAST] = CM_NULLPTR; + this->Last = ctm_LAST; +} cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler() { @@ -28,3 +37,14 @@ cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler() handler->SetQuiet(this->Quiet); return handler; } + +void cmCTestMemCheckCommand::ProcessAdditionalValues( + cmCTestGenericHandler* handler) +{ + if (this->Values[ctm_DEFECT_COUNT] && *this->Values[ctm_DEFECT_COUNT]) { + std::ostringstream str; + str << static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount(); + this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT], + str.str().c_str()); + } +} diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index d3b8be7..458ebb0 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestTestCommand.h" -#include "cmTypeMacro.h" #include <string> @@ -21,7 +20,7 @@ class cmCommand; class cmCTestMemCheckCommand : public cmCTestTestCommand { public: - cmCTestMemCheckCommand() {} + cmCTestMemCheckCommand(); /** * This is a virtual constructor for the command. @@ -39,10 +38,16 @@ public: */ std::string GetName() const CM_OVERRIDE { return "ctest_memcheck"; } - cmTypeMacro(cmCTestMemCheckCommand, cmCTestTestCommand); - protected: cmCTestGenericHandler* InitializeActualHandler() CM_OVERRIDE; + + void ProcessAdditionalValues(cmCTestGenericHandler* handler) CM_OVERRIDE; + + enum + { + ctm_DEFECT_COUNT = ctt_LAST, + ctm_LAST + }; }; #endif diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index b37db30..2c31f60 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -127,6 +127,7 @@ void cmCTestMemCheckHandler::Initialize() this->MemoryTesterOptions.clear(); this->MemoryTesterStyle = UNKNOWN; this->MemoryTesterOutputFile = ""; + this->DefectCount = 0; } int cmCTestMemCheckHandler::PreProcessHandler() @@ -279,6 +280,11 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile* mf) this->Quiet); } +int cmCTestMemCheckHandler::GetDefectCount() +{ + return this->DefectCount; +} + void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) { if (!this->CTest->GetProduceXML()) { @@ -323,10 +329,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) } xml.EndElement(); // TestList cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - "-- Processing memory checking output: ", this->Quiet); + "-- Processing memory checking output:\n", this->Quiet); size_t total = this->TestResults.size(); - size_t step = total / 10; - size_t current = 0; for (cc = 0; cc < this->TestResults.size(); cc++) { cmCTestTestResult* result = &this->TestResults[cc]; std::string memcheckstr; @@ -341,20 +345,31 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)); this->WriteTestResultHeader(xml, result); xml.StartElement("Results"); + int memoryErrors = 0; for (std::vector<int>::size_type kk = 0; kk < memcheckresults.size(); ++kk) { if (memcheckresults[kk]) { xml.StartElement("Defect"); xml.Attribute("type", this->ResultStringsLong[kk]); xml.Content(memcheckresults[kk]); + memoryErrors += memcheckresults[kk]; xml.EndElement(); // Defect } this->GlobalResults[kk] += memcheckresults[kk]; } xml.EndElement(); // Results - + if (memoryErrors > 0) { + const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); + std::string outname = result->Name + " "; + outname.resize(maxTestNameWidth + 4, '.'); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, cc + 1 + << "/" << total << " MemCheck: #" + << result->TestCount << ": " << outname + << " Defects: " << memoryErrors << std::endl, + this->Quiet); + } xml.StartElement("Log"); - if (this->CTest->ShouldCompressMemCheckOutput()) { + if (this->CTest->ShouldCompressTestOutput()) { this->CTest->CompressString(memcheckstr); xml.Attribute("compression", "gzip"); xml.Attribute("encoding", "base64"); @@ -363,23 +378,22 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) xml.EndElement(); // Log this->WriteTestResultFooter(xml, result); - if (current < cc) { - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "#" << std::flush, - this->Quiet); - current += step; - } } - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "MemCheck log files can be found here: " + "( * corresponds to test number)" + << std::endl, + this->Quiet); + std::string output = this->MemoryTesterOutputFile; + cmSystemTools::ReplaceString(output, "??", "*"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, output << std::endl, + this->Quiet); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:" << std::endl, this->Quiet); xml.StartElement("DefectList"); for (cc = 0; cc < this->GlobalResults.size(); cc++) { if (this->GlobalResults[cc]) { -#ifdef cerr -#undef cerr -#endif std::cerr.width(35); -#define cerr no_cerr cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->ResultStringsLong[cc] << " - " << this->GlobalResults[cc] << std::endl, @@ -706,6 +720,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( ostr << *i << std::endl; } log = ostr.str(); + this->DefectCount += defects; return defects == 0; } bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( @@ -747,6 +762,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( } log = ostr.str(); + this->DefectCount += defects; return defects == 0; } @@ -882,6 +898,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( << (cmSystemTools::GetTime() - sttime) << std::endl, this->Quiet); log = ostr.str(); + this->DefectCount += defects; return defects == 0; } @@ -927,9 +944,9 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( // only put the output of Bounds Checker if there were // errors or leaks detected log = parser.Log; - return false; } - return true; + this->DefectCount += defects; + return defects == 0; } // PostProcessTest memcheck results diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 8d678af..5faace0 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestTestHandler.h" -#include "cmTypeMacro.h" #include <string> #include <vector> @@ -23,7 +22,7 @@ class cmCTestMemCheckHandler : public cmCTestTestHandler friend class cmCTestRunTest; public: - cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler); + typedef cmCTestTestHandler Superclass; void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE; @@ -31,6 +30,8 @@ public: void Initialize() CM_OVERRIDE; + int GetDefectCount(); + protected: int PreProcessHandler() CM_OVERRIDE; int PostProcessHandler() CM_OVERRIDE; @@ -106,6 +107,7 @@ private: std::vector<std::string> ResultStringsLong; std::vector<int> GlobalResults; bool LogWithPID; // does log file add pid + int DefectCount; std::vector<int>::size_type FindOrAddWarning(const std::string& warning); // initialize the ResultStrings and ResultStringsLong for diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index 29eba90..e155595 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestCommand.h" -#include "cmTypeMacro.h" #include <string> #include <vector> @@ -46,8 +45,6 @@ public: * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "ctest_read_custom_files"; } - - cmTypeMacro(cmCTestReadCustomFilesCommand, cmCTestCommand); }; #endif diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index 2978bb9..01ed62e 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestCommand.h" -#include "cmTypeMacro.h" #include <string> #include <vector> @@ -47,8 +46,6 @@ public: * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "ctest_run_script"; } - - cmTypeMacro(cmCTestRunScriptCommand, cmCTestCommand); }; #endif diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index b30f6eb..fbc94cc 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -153,7 +153,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) if ((!this->TestHandler->MemCheck && this->CTest->ShouldCompressTestOutput()) || (this->TestHandler->MemCheck && - this->CTest->ShouldCompressMemCheckOutput())) { + this->CTest->ShouldCompressTestOutput())) { this->CompressOutput(); } diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 8848a70..08ea4ee 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -22,6 +22,8 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmState.h" +#include "cmStateDirectory.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" @@ -280,7 +282,7 @@ void cmCTestScriptHandler::CreateCMake() this->CMake->AddCMakePaths(); this->GlobalGenerator = new cmGlobalGenerator(this->CMake); - cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot(); + cmStateSnapshot snapshot = this->CMake->GetCurrentSnapshot(); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); snapshot.GetDirectory().SetCurrentSource(cwd); snapshot.GetDirectory().SetCurrentBinary(cwd); diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index 2bace58..47644be 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestGenericHandler.h" -#include "cmTypeMacro.h" #include <string> #include <vector> @@ -56,7 +55,7 @@ class cmake; class cmCTestScriptHandler : public cmCTestGenericHandler { public: - cmTypeMacro(cmCTestScriptHandler, cmCTestGenericHandler); + typedef cmCTestGenericHandler Superclass; /** * Add a script to run, and if is should run in the current process diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index b144012..1052f76 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestCommand.h" -#include "cmTypeMacro.h" #include <string> #include <vector> @@ -47,8 +46,6 @@ public: * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "ctest_sleep"; } - - cmTypeMacro(cmCTestSleepCommand, cmCTestCommand); }; #endif diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 6bb0bc6..cc72d0c 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestCommand.h" -#include "cmTypeMacro.h" #include <iosfwd> #include <string> @@ -60,8 +59,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "ctest_start"; } - cmTypeMacro(cmCTestStartCommand, cmCTestCommand); - private: bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir); bool CreateNewTag; diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index db8a604..f5b52c1 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -7,7 +7,6 @@ #include "cmCTest.h" #include "cmCTestHandlerCommand.h" -#include "cmTypeMacro.h" #include <set> #include <string> @@ -55,7 +54,7 @@ public: */ std::string GetName() const CM_OVERRIDE { return "ctest_submit"; } - cmTypeMacro(cmCTestSubmitCommand, cmCTestHandlerCommand); + typedef cmCTestHandlerCommand Superclass; protected: cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 06cd77f..2b2d207 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -7,7 +7,9 @@ #include "cmCTestScriptHandler.h" #include "cmCurl.h" #include "cmGeneratedFileStream.h" +#include "cmProcessOutput.h" #include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLParser.h" #include "cmake.h" @@ -45,7 +47,6 @@ public: }; StatusType Status; - std::string CDashVersion; std::string Filename; std::string MD5; std::string Message; @@ -62,12 +63,10 @@ private: return val; } - void StartElement(const std::string& name, const char** atts) CM_OVERRIDE + void StartElement(const std::string& /*name*/, + const char** /*atts*/) CM_OVERRIDE { this->CurrentValue.clear(); - if (name == "cdash") { - this->CDashVersion = this->FindAttribute(atts, "version"); - } } void CharacterDataHandler(const char* data, int length) CM_OVERRIDE @@ -469,20 +468,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, // Now run off and do what you've been told! res = ::curl_easy_perform(curl); - if (cmSystemTools::IsOn(this->GetOption("InternalTest")) && - cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, - this->CTest->GetCDashVersion().c_str(), - "1.7")) { - // mock failure output for internal test case - std::string mock_output = - "<cdash version=\"1.7.0\">\n" - " <status>ERROR</status>\n" - " <message>Checksum failed for file.</message>\n" - "</cdash>\n"; - chunk.clear(); - chunk.assign(mock_output.begin(), mock_output.end()); - } - if (!chunk.empty()) { cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) @@ -800,10 +785,20 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command, cmsysProcess_Execute(cp); char* data; int length; + cmProcessOutput processOutput; + std::string strdata; while (cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR)) { + processOutput.DecodeText(data, length, strdata); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - cmCTestLogWrite(data, length), this->Quiet); + cmCTestLogWrite(strdata.c_str(), strdata.size()), + this->Quiet); + } + processOutput.DecodeText(std::string(), strdata); + if (!strdata.empty()) { + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestLogWrite(strdata.c_str(), strdata.size()), + this->Quiet); } cmsysProcess_WaitForExit(cp, CM_NULLPTR); @@ -925,7 +920,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC( return false; } size_t fileSize = static_cast<size_t>(st.st_size); - FILE* fp = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); + FILE* fp = cmsys::SystemTools::Fopen(local_file, "rb"); if (!fp) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot open file: " << local_file << std::endl); diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index abe4fa2..baaf8af 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -7,7 +7,6 @@ #include "cmCTest.h" #include "cmCTestGenericHandler.h" -#include "cmTypeMacro.h" #include <iosfwd> #include <set> @@ -23,7 +22,7 @@ class cmCTestSubmitHandler : public cmCTestGenericHandler { public: - cmTypeMacro(cmCTestSubmitHandler, cmCTestGenericHandler); + typedef cmCTestGenericHandler Superclass; cmCTestSubmitHandler(); ~cmCTestSubmitHandler() CM_OVERRIDE { this->LogFile = CM_NULLPTR; } diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index 6161acb..3250d93 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestHandlerCommand.h" -#include "cmTypeMacro.h" #include <string> @@ -39,8 +38,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "ctest_test"; } - cmTypeMacro(cmCTestTestCommand, cmCTestHandlerCommand); - protected: virtual cmCTestGenericHandler* InitializeActualHandler(); cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 0d0237f..132d049 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -10,6 +10,7 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" #include "cm_auto_ptr.hxx" @@ -58,8 +59,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "subdirs"; } - cmTypeMacro(cmCTestSubdirCommand, cmCommand); - cmCTestTestHandler* TestHandler; }; @@ -139,8 +138,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; } - cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand); - cmCTestTestHandler* TestHandler; }; @@ -213,8 +210,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "add_test"; } - cmTypeMacro(cmCTestAddTestCommand, cmCommand); - cmCTestTestHandler* TestHandler; }; @@ -253,8 +248,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; } - cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand); - cmCTestTestHandler* TestHandler; }; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 73b3174..5b07e98 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestGenericHandler.h" -#include "cmTypeMacro.h" #include <cmsys/RegularExpression.hxx> #include <iosfwd> @@ -32,7 +31,7 @@ class cmCTestTestHandler : public cmCTestGenericHandler friend class cmCTestBatchTestHandler; public: - cmTypeMacro(cmCTestTestHandler, cmCTestGenericHandler); + typedef cmCTestGenericHandler Superclass; /** * The main entry point for this class diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index 9d1a86e..5761f50 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestHandlerCommand.h" -#include "cmTypeMacro.h" #include <string> @@ -39,8 +38,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "ctest_update"; } - cmTypeMacro(cmCTestUpdateCommand, cmCTestHandlerCommand); - protected: cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; }; diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h index c9a8682..87781e8 100644 --- a/Source/CTest/cmCTestUpdateHandler.h +++ b/Source/CTest/cmCTestUpdateHandler.h @@ -6,7 +6,6 @@ #include <cmConfigure.h> #include "cmCTestGenericHandler.h" -#include "cmTypeMacro.h" #include <string> #include <utility> @@ -19,7 +18,7 @@ class cmCTestUpdateHandler : public cmCTestGenericHandler { public: - cmTypeMacro(cmCTestUpdateHandler, cmCTestGenericHandler); + typedef cmCTestGenericHandler Superclass; /* * The main entry point for this class diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index b858077..474f699 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -7,7 +7,6 @@ #include "cmCTest.h" #include "cmCTestHandlerCommand.h" -#include "cmTypeMacro.h" #include <string> @@ -41,7 +40,7 @@ public: */ std::string GetName() const CM_OVERRIDE { return "ctest_upload"; } - cmTypeMacro(cmCTestUploadCommand, cmCTestHandlerCommand); + typedef cmCTestHandlerCommand Superclass; protected: cmCTestGenericHandler* InitializeHandler() CM_OVERRIDE; diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h index 251cd3e..77c2aec 100644 --- a/Source/CTest/cmCTestUploadHandler.h +++ b/Source/CTest/cmCTestUploadHandler.h @@ -7,7 +7,6 @@ #include "cmCTest.h" #include "cmCTestGenericHandler.h" -#include "cmTypeMacro.h" /** \class cmCTestUploadHandler * \brief Helper class for CTest @@ -18,7 +17,7 @@ class cmCTestUploadHandler : public cmCTestGenericHandler { public: - cmTypeMacro(cmCTestUploadHandler, cmCTestGenericHandler); + typedef cmCTestGenericHandler Superclass; cmCTestUploadHandler(); ~cmCTestUploadHandler() CM_OVERRIDE {} diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 7a2fa69..444c43d 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -76,7 +76,8 @@ bool cmCTestVC::InitialCheckout(const char* command) } bool cmCTestVC::RunChild(char const* const* cmd, OutputParser* out, - OutputParser* err, const char* workDir) + OutputParser* err, const char* workDir, + Encoding encoding) { this->Log << this->ComputeCommandLine(cmd) << "\n"; @@ -84,7 +85,7 @@ bool cmCTestVC::RunChild(char const* const* cmd, OutputParser* out, cmsysProcess_SetCommand(cp, cmd); workDir = workDir ? workDir : this->SourceDirectory.c_str(); cmsysProcess_SetWorkingDirectory(cp, workDir); - this->RunProcess(cp, out, err); + this->RunProcess(cp, out, err, encoding); int result = cmsysProcess_GetExitValue(cp); cmsysProcess_Delete(cp); return result == 0; @@ -102,7 +103,7 @@ std::string cmCTestVC::ComputeCommandLine(char const* const* cmd) } bool cmCTestVC::RunUpdateCommand(char const* const* cmd, OutputParser* out, - OutputParser* err) + OutputParser* err, Encoding encoding) { // Report the command line. this->UpdateCommandLine = this->ComputeCommandLine(cmd); @@ -112,7 +113,7 @@ bool cmCTestVC::RunUpdateCommand(char const* const* cmd, OutputParser* out, } // Run the command. - return this->RunChild(cmd, out, err); + return this->RunChild(cmd, out, err, CM_NULLPTR, encoding); } std::string cmCTestVC::GetNightlyTime() diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h index 4f2bba0..dd8b973 100644 --- a/Source/CTest/cmCTestVC.h +++ b/Source/CTest/cmCTestVC.h @@ -116,11 +116,13 @@ protected: /** Run a command line and send output to given parsers. */ bool RunChild(char const* const* cmd, OutputParser* out, OutputParser* err, - const char* workDir = CM_NULLPTR); + const char* workDir = CM_NULLPTR, + Encoding encoding = cmProcessOutput::Auto); /** Run VC update command line and send output to given parsers. */ bool RunUpdateCommand(char const* const* cmd, OutputParser* out, - OutputParser* err = CM_NULLPTR); + OutputParser* err = CM_NULLPTR, + Encoding encoding = cmProcessOutput::Auto); /** Write xml element for one file. */ void WriteXMLEntry(cmXMLWriter& xml, std::string const& path, diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index cf3c7ac..98bd3bb 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -3,6 +3,7 @@ #include "cmProcess.h" #include <cmConfigure.h> +#include <cmProcessOutput.h> #include <cmSystemTools.h> #include <iostream> @@ -104,6 +105,8 @@ bool cmProcess::Buffer::GetLast(std::string& line) int cmProcess::GetNextOutputLine(std::string& line, double timeout) { + cmProcessOutput processOutput; + std::string strdata; for (;;) { // Look for lines already buffered. if (this->Output.GetLine(line)) { @@ -118,12 +121,17 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) return cmsysProcess_Pipe_Timeout; } if (p == cmsysProcess_Pipe_STDOUT) { - this->Output.insert(this->Output.end(), data, data + length); + processOutput.DecodeText(data, length, strdata); + this->Output.insert(this->Output.end(), strdata.begin(), strdata.end()); } else { // p == cmsysProcess_Pipe_None // The process will provide no more data. break; } } + processOutput.DecodeText(std::string(), strdata); + if (!strdata.empty()) { + this->Output.insert(this->Output.end(), strdata.begin(), strdata.end()); + } // Look for partial last lines. if (this->Output.GetLast(line)) { @@ -225,6 +233,7 @@ void cmProcess::ChangeTimeout(double t) void cmProcess::ResetStartTime() { cmsysProcess_ResetStartTime(this->Process); + this->StartTime = cmSystemTools::GetTime(); } int cmProcess::GetExitException() |