diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index fdf17e0e0..12d5fd140 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -164,7 +164,7 @@ cmCTestScriptHandler::~cmCTestScriptHandler() //---------------------------------------------------------------------- // just adds an argument to the vector -void cmCTestScriptHandler::AddConfigurationScript(const char *script, +void cmCTestScriptHandler::AddConfigurationScript(const char *script, bool pscope) { this->ConfigurationScripts.push_back(script); @@ -224,12 +224,12 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) argv.push_back("-SR"); argv.push_back(total_script_arg.c_str()); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Executable for CTest is: " << + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Executable for CTest is: " << this->CTest->GetCTestExecutable() << "\n"); // now pass through all the other arguments - std::vector &initArgs = + std::vector &initArgs = this->CTest->GetInitialCommandLineArguments(); //*** need to make sure this does not have the current script *** for(size_t i=1; i < initArgs.size(); ++i) @@ -252,7 +252,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) int pipe = cmSystemTools::WaitForLine(cp, line, 100.0, out, err); while(pipe != cmsysProcess_Pipe_None) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Output: " + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Output: " << line << "\n"); if(pipe == cmsysProcess_Pipe_STDERR) { @@ -264,7 +264,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) } pipe = cmSystemTools::WaitForLine(cp, line, 100, out, err); } - + // Properly handle output of the build command cmsysProcess_WaitForExit(cp, 0); int result = cmsysProcess_GetState(cp); @@ -278,7 +278,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) { retVal = cmsysProcess_GetExitException(cp); cmCTestLog(this->CTest, ERROR_MESSAGE, "\tThere was an exception: " - << cmsysProcess_GetExceptionString(cp) << " " << + << cmsysProcess_GetExceptionString(cp) << " " << retVal << std::endl); failed = true; } @@ -338,7 +338,7 @@ void cmCTestScriptHandler::CreateCMake() this->Makefile->SetStartDirectory(cwd.c_str()); this->Makefile->SetStartOutputDirectory(cwd.c_str()); - // remove all cmake commands which are not scriptable, since they can't be + // remove all cmake commands which are not scriptable, since they can't be // used in ctest scripts this->CMake->RemoveUnscriptableCommands(); @@ -418,17 +418,17 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) this->Makefile->AddFunctionBlocker(f); - /* Execute CTestScriptMode.cmake, which loads CMakeDetermineSystem and - CMakeSystemSpecificInformation, so + /* Execute CTestScriptMode.cmake, which loads CMakeDetermineSystem and + CMakeSystemSpecificInformation, so that variables like CMAKE_SYSTEM and also the search paths for libraries, header and executables are set correctly and can be used. Makes new-style ctest scripting easier. */ - std::string systemFile = + std::string systemFile = this->Makefile->GetModulesFile("CTestScriptMode.cmake"); if (!this->Makefile->ReadListFile(0, systemFile.c_str()) || cmSystemTools::GetErrorOccuredFlag()) - { - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read:" + { + cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read:" << systemFile.c_str() << "\n"); return 2; } @@ -440,8 +440,8 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read script: " << script.c_str() << std::endl); - // Reset the error flag so that it can run more than - // one script with an error when you + // Reset the error flag so that it can run more than + // one script with an error when you // use ctest_run_script cmSystemTools::ResetErrorOccuredFlag(); return 2; @@ -880,7 +880,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() // put the initial cache into the bin dir if (!this->InitialCache.empty()) { - if (!this->WriteInitialCache(this->BinaryDir.c_str(), + if (!this->WriteInitialCache(this->BinaryDir.c_str(), this->InitialCache.c_str())) { this->RestoreBackupDirectories(); @@ -986,7 +986,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() } //------------------------------------------------------------------------- -bool cmCTestScriptHandler::WriteInitialCache(const char* directory, +bool cmCTestScriptHandler::WriteInitialCache(const char* directory, const char* text) { std::string cacheFile = directory; @@ -1032,7 +1032,7 @@ void cmCTestScriptHandler::RestoreBackupDirectories() } } -bool cmCTestScriptHandler::RunScript(cmCTest* ctest, const char *sname, +bool cmCTestScriptHandler::RunScript(cmCTest* ctest, const char *sname, bool InProcess, int* returnValue) { cmCTestScriptHandler* sh = new cmCTestScriptHandler(); @@ -1076,13 +1076,13 @@ double cmCTestScriptHandler::GetRemainingTimeAllowed() const char *timelimitS = this->Makefile->GetDefinition("CTEST_TIME_LIMIT"); - + if (!timelimitS) { return 1.0e7; } double timelimit = atof(timelimitS); - + return timelimit - cmSystemTools::GetTime() + this->ScriptStartTime; } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 9f9f85a83..43441c0a1 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -296,7 +296,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix, *this->LogFile << " Error when uploading file: " << local_file.c_str() << std::endl - << " Error message was: " + << " Error message was: " << error_buffer << std::endl << " Curl output was: "; // avoid dereference of empty vector @@ -364,13 +364,13 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, { if(verifyPeerOff) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Set CURLOPT_SSL_VERIFYPEER to off\n"); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); } if(verifyHostOff) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Set CURLOPT_SSL_VERIFYHOST to off\n"); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); } @@ -601,7 +601,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, *this->LogFile << " Error when uploading file: " << local_file.c_str() << std::endl - << " Error message was: " << error_buffer + << " Error message was: " << error_buffer << std::endl; // avoid deref of begin for zero size array if(chunk.size()) @@ -763,7 +763,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( << error_buffer << std::endl); *this->LogFile << "\tTriggering failed with error: " << error_buffer << std::endl - << " Error message was: " << error_buffer + << " Error message was: " << error_buffer << std::endl; if(chunk.size()) { @@ -913,8 +913,8 @@ bool cmCTestSubmitHandler::SubmitUsingCP( { if ( !localprefix.size() || !files.size() || !remoteprefix.size() || !destination.size() ) - { - cmCTestLog(this->CTest, ERROR_MESSAGE, + { + cmCTestLog(this->CTest, ERROR_MESSAGE, "Missing arguments for submit via cp:\n" << "\tlocalprefix: " << localprefix << "\n" << "\tNumber of files: " << files.size() << "\n" @@ -1285,7 +1285,7 @@ int cmCTestSubmitHandler::ProcessHandler() << std::endl); ofs << " Problems when submitting via FTP" << std::endl; return -1; - } + } if(!this->CDash) { cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method" @@ -1369,7 +1369,7 @@ int cmCTestSubmitHandler::ProcessHandler() { cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" << (this->HasWarnings ? ", with warnings." : "") << std::endl); - ofs << " Submission successful" << + ofs << " Submission successful" << (this->HasWarnings ? ", with warnings." : "") << std::endl; } @@ -1439,20 +1439,20 @@ int cmCTestSubmitHandler::ProcessHandler() { std::string location = this->CTest->GetCTestConfiguration("DropLocation"); - + // change to the build directory so that we can uses a relative path // on windows since scp dosn't support "c:" a drive in the path - std::string + std::string oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory(buildDirectory.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Change directory: " << buildDirectory.c_str() << std::endl); if ( !this->SubmitUsingCP( - "Testing/"+this->CTest->GetCurrentTag(), - files, - prefix, + "Testing/"+this->CTest->GetCurrentTag(), + files, + prefix, location) ) { cmSystemTools::ChangeDirectory(oldWorkingDirectory.c_str()); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 87c75ebf8..f87c929c0 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -108,7 +108,7 @@ bool cmCTestSubdirCommand // does the CTestTestfile.cmake exist ? testFilename = "CTestTestfile.cmake"; } - else if( cmSystemTools::FileExists("DartTestfile.txt") ) + else if( cmSystemTools::FileExists("DartTestfile.txt") ) { // does the DartTestfile.txt exist ? testFilename = "DartTestfile.txt"; @@ -121,7 +121,7 @@ bool cmCTestSubdirCommand } fname += "/"; fname += testFilename; - bool readit = + bool readit = this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), fname.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str()); @@ -212,7 +212,7 @@ bool cmCTestAddSubdirectoryCommand } fname += "/"; fname += testFilename; - bool readit = + bool readit = this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), fname.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str()); @@ -538,7 +538,7 @@ int cmCTestTestHandler::ProcessHandler() this->UseExcludeRegExp(); this->SetExcludeRegExp(val); } - + this->TestResults.clear(); cmCTestLog(this->CTest, HANDLER_OUTPUT, @@ -616,7 +616,7 @@ int cmCTestTestHandler::ProcessHandler() cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "The following tests FAILED:" << std::endl); this->StartLogFile("TestsFailed", ofs); - + std::vector::iterator ftit; for(ftit = this->TestResults.begin(); ftit != this->TestResults.end(); ++ftit) @@ -625,9 +625,9 @@ int cmCTestTestHandler::ProcessHandler() { ofs << ftit->TestCount << ":" << ftit->Name << std::endl; cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) - << ftit->TestCount << " - " + << ftit->TestCount << " - " << ftit->Name.c_str() << " (" - << this->GetTestStatus(ftit->Status) << ")" + << this->GetTestStatus(ftit->Status) << ")" << std::endl); } } @@ -696,18 +696,18 @@ void cmCTestTestHandler::PrintLabelSummary() // fill maps for(; ri != this->TestResults.end(); ++ri) { - cmCTestTestResult &result = *ri; + cmCTestTestResult &result = *ri; cmCTestTestProperties& p = *result.Properties; if(p.Labels.size() != 0) { for(std::vector::iterator l = p.Labels.begin(); l != p.Labels.end(); ++l) - { + { labelTimes[*l] += result.ExecutionTime; } } } - // now print times + // now print times if(labels.size()) { cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:"); @@ -728,7 +728,7 @@ void cmCTestTestHandler::PrintLabelSummary() } } if(labels.size()) - { + { if(this->LogFile) { *this->LogFile << "\n"; @@ -840,7 +840,7 @@ void cmCTestTestHandler::ComputeTestList() // Now create a final list of tests to run int cnt = 0; inREcnt = 0; - std::string last_directory = ""; + std::string last_directory = ""; ListOfTests finalList; for ( it = this->TestList.begin(); it != this->TestList.end(); it ++ ) { @@ -888,13 +888,13 @@ void cmCTestTestHandler::ComputeTestList() max = p.Name.size(); } } - if(static_cast(this->CTest->GetMaxTestNameWidth()) + if(static_cast(this->CTest->GetMaxTestNameWidth()) != max) { this->CTest->SetMaxTestNameWidth(static_cast(max)); } } - + bool cmCTestTestHandler::GetValue(const char* tag, int& value, std::ifstream& fin) @@ -984,7 +984,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, ret = cmSystemTools::GetLineFromStream(fin, line); // read blank line } else - { + { cmCTestLog(this->CTest, ERROR_MESSAGE, "parse error: missing tag: " << tag << " found [" << line.c_str() << "]" << std::endl); @@ -1036,7 +1036,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &passed, cmCTestMultiProcessHandler::TestMap tests; cmCTestMultiProcessHandler::PropertiesMap properties; - + bool randomSchedule = this->CTest->GetScheduleType() == "Random"; if(randomSchedule) { @@ -1045,7 +1045,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &passed, for (ListOfTests::iterator it = this->TestList.begin(); it != this->TestList.end(); ++it) - { + { cmCTestTestProperties& p = *it; cmCTestMultiProcessHandler::TestSet depends; @@ -1158,7 +1158,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) << result->ExecutionTime << "\n"; if(result->Reason.size()) - { + { const char* reasonType = "Pass Reason"; if(result->Status != cmCTestTestHandler::COMPLETED && result->Status != cmCTestTestHandler::NOT_RUN) @@ -1195,7 +1195,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) os << "\t\t\t\n" << "\t\t\t\tCompressOutput ? + << (result->CompressOutput ? " encoding=\"base64\" compression=\"gzip\">" : ">"); os << cmXMLSafe(result->Output); @@ -1278,7 +1278,7 @@ void cmCTestTestHandler::AttachFiles(std::ostream& os, result->Properties->AttachOnFail.begin(), result->Properties->AttachOnFail.end()); } - for(std::vector::const_iterator file = + for(std::vector::const_iterator file = result->Properties->AttachedFiles.begin(); file != result->Properties->AttachedFiles.end(); ++file) { @@ -1322,7 +1322,7 @@ std::string cmCTestTestHandler::EncodeFile(std::string file) unsigned long rlen = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1); - + std::string base64 = ""; for(unsigned long i = 0; i < rlen; i++) { @@ -1370,7 +1370,7 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe) // add additional configurations to the search path void cmCTestTestHandler -::AddConfigurations(cmCTest *ctest, +::AddConfigurations(cmCTest *ctest, std::vector &attempted, std::vector &attemptedConfigs, std::string filepath, @@ -1378,7 +1378,7 @@ void cmCTestTestHandler { std::string tempPath; - if (filepath.size() && + if (filepath.size() && filepath[filepath.size()-1] != '/') { filepath += "/"; @@ -1386,7 +1386,7 @@ void cmCTestTestHandler tempPath = filepath + filename; attempted.push_back(tempPath); attemptedConfigs.push_back(""); - + if(ctest->GetConfigType().size()) { tempPath = filepath; @@ -1425,7 +1425,7 @@ void cmCTestTestHandler tempPath = filepath; tempPath += "RelWithDebInfo/"; tempPath += filename; - attempted.push_back(tempPath); + attempted.push_back(tempPath); attemptedConfigs.push_back("RelWithDebInfo"); tempPath = filepath; tempPath += "Deployment/"; @@ -1472,8 +1472,8 @@ std::string cmCTestTestHandler attemptedConfigs, localfilepath,filename); } - - + + // if extraPaths are provided and we were not passed a full path, try them, // try any extra paths if (filepath.size() == 0) @@ -1489,8 +1489,8 @@ std::string cmCTestTestHandler filepathExtra, filenameExtra); } - } - + } + // store the final location in fullPath std::string fullPath; @@ -1523,7 +1523,7 @@ std::string cmCTestTestHandler } } } - + // if everything else failed, check the users path, but only if a full path // wasn't specified if (fullPath.size() == 0 && filepath.size() == 0) @@ -1547,7 +1547,7 @@ std::string cmCTestTestHandler i->c_str() << "\n"); } } - + return fullPath; } @@ -1589,13 +1589,13 @@ void cmCTestTestHandler::GetListOfTests() cm.AddCommand(newCom1); // Add handler for SUBDIRS - cmCTestSubdirCommand* newCom2 = + cmCTestSubdirCommand* newCom2 = new cmCTestSubdirCommand; newCom2->TestHandler = this; cm.AddCommand(newCom2); // Add handler for ADD_SUBDIRECTORY - cmCTestAddSubdirectoryCommand* newCom3 = + cmCTestAddSubdirectoryCommand* newCom3 = new cmCTestAddSubdirectoryCommand; newCom3->TestHandler = this; cm.AddCommand(newCom3); @@ -2156,7 +2156,7 @@ bool cmCTestTestHandler::SetTestsProperties( } } if ( key == "ENVIRONMENT" ) - { + { std::vector lval; cmSystemTools::ExpandListArgument(val.c_str(), lval); std::vector::iterator crit; @@ -2272,7 +2272,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) test.Directory = cmSystemTools::GetCurrentWorkingDirectory(); cmCTestLog(this->CTest, DEBUG, "Set test directory: " << test.Directory << std::endl); - + test.IsInBasedOnREOptions = true; test.WillFail = false; test.RunSerial = false; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 7aa8522e9..2c4b230ac 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -126,7 +126,7 @@ public: }; // add configuraitons to a search path for an executable - static void AddConfigurations(cmCTest *ctest, + static void AddConfigurations(cmCTest *ctest, std::vector &attempted, std::vector &attemptedConfigs, std::string filepath, @@ -205,7 +205,7 @@ private: // compute the lists of tests that will actually run // based on union regex and -I stuff void ComputeTestList(); - + bool GetValue(const char* tag, std::string& value, std::ifstream& fin);