From 5a5cc522309a21cda8449912f457282f941641e1 Mon Sep 17 00:00:00 2001 From: Zach Mullen Date: Mon, 31 Aug 2009 09:50:35 -0400 Subject: [PATCH] Fixed conversion warning on 64 bit machines --- Source/CTest/cmCTestMultiProcessHandler.h | 4 +- Source/CTest/cmCTestRunTest.cxx | 4 +- Source/CTest/cmCTestRunTest.h | 4 +- Source/CTest/cmCTestTestHandler.cxx | 314 ---------------------- 4 files changed, 6 insertions(+), 320 deletions(-) diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index cb3aecbfc..34df780db 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -81,9 +81,9 @@ protected: // map from test number to set of depend tests TestMap Tests; //Total number of tests we'll be running - int Total; + size_t Total; //Number of tests that are complete - int Completed; + size_t Completed; //list of test properties (indices concurrent to the test map) PropertiesMap Properties; std::map TestRunningMap; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index a9bbab7d6..f10f9c90c 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -56,7 +56,7 @@ void cmCTestRunTest::CheckOutput() } //--------------------------------------------------------- -bool cmCTestRunTest::EndTest(int completed, int total) +bool cmCTestRunTest::EndTest(size_t completed, size_t total) { //restore the old environment if (this->ModifyEnv) @@ -427,7 +427,7 @@ bool cmCTestRunTest::CreateProcess(double testTimeOut, return this->TestProcess->StartProcess(); } -void cmCTestRunTest::WriteLogOutputTop(int completed, int total) +void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) { /* Not sure whether we want to prepend the test index anymore cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3) diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 1fbe5bb48..88a4d6bd6 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -56,14 +56,14 @@ public: //launch the test process, return whether it started correctly bool StartTest(); //capture and report the test results - bool EndTest(int completed, int total); + bool EndTest(size_t completed, size_t total); //Called by ctest -N to log the command string void ComputeArguments(); private: void DartProcessing(); bool CreateProcess(double testTimeOut, std::vector* environment); - void WriteLogOutputTop(int completed, int total); + void WriteLogOutputTop(size_t completed, size_t total); //Run post processing of the process output for MemCheck void MemCheckPostProcess(); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index af7c22260..83178a3bb 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -709,321 +709,7 @@ void cmCTestTestHandler::PrintLabelSummary() } } } -/* -//---------------------------------------------------------------------- -void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, - std::vector &passed, - std::vector &failed, - int cnt, int tmsize) -{ - const std::string& testname = it->Name; - std::vector& args = it->Args; - cmCTestTestResult cres; - cres.Properties = &*it; - cres.ExecutionTime = 0; - cres.ReturnValue = -1; - cres.Status = cmCTestTestHandler::NOT_RUN; - cres.TestCount = cnt; - cres.Name = testname; - cres.Path = it->Directory.c_str(); - - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3) << cnt << "/"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3) << tmsize << " "); - if ( this->MemCheck ) - { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory Check"); - } - else - { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Testing"); - } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); - const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); - std::string outname = testname + " "; - outname.resize(maxTestNameWidth, '.'); - *this->LogFile << cnt << "/" << tmsize << " Testing: " << testname - << std::endl; - - if ( this->CTest->GetShowOnly() ) - { - cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str() << std::endl); - } - else - { - cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str()); - } - - cmCTestLog(this->CTest, DEBUG, "Testing " << args[0].c_str() << " ... "); - // find the test executable - std::string actualCommand = this->FindTheExecutable(args[1].c_str()); - std::string testCommand - = cmSystemTools::ConvertToOutputPath(actualCommand.c_str()); - - // continue if we did not find the executable - if (testCommand == "") - { - *this->LogFile << "Unable to find executable: " << args[1].c_str() - << std::endl; - cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find executable: " - << args[1].c_str() << std::endl); - cres.Output = "Unable to find executable: " + args[1]; - if ( !this->CTest->GetShowOnly() ) - { - cres.FullCommandLine = actualCommand; - this->TestResults.push_back( cres ); - failed.push_back(testname); - return; - } - } - - // add the arguments - std::vector::const_iterator j = args.begin(); - ++j; // skip test name - ++j; // skip command as it is in actualCommand - std::vector arguments; - this->GenerateTestCommand(arguments); - arguments.push_back(actualCommand.c_str()); - for(;j != args.end(); ++j) - { - testCommand += " "; - testCommand += cmSystemTools::EscapeSpaces(j->c_str()); - arguments.push_back(j->c_str()); - } - arguments.push_back(0); - - std::string output; - int retVal = 0; - - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl - << (this->MemCheck?"MemCheck":"Test") - << " command: " << testCommand - << std::endl); - *this->LogFile << cnt << "/" << tmsize - << " Test: " << testname.c_str() << std::endl; - *this->LogFile << "Command: "; - std::vector::size_type ll; - for ( ll = 0; ll < arguments.size()-1; ll ++ ) - { - *this->LogFile << "\"" << arguments[ll] << "\" "; - } - *this->LogFile - << std::endl - << "Directory: " << it->Directory << std::endl - << "\"" << testname.c_str() << "\" start time: " - << this->CTest->CurrentTime() << std::endl - << "Output:" << std::endl - << "----------------------------------------------------------" - << std::endl; - int res = 0; - double clock_start, clock_finish; - clock_start = cmSystemTools::GetTime(); - - if ( !this->CTest->GetShowOnly() ) - { - res = this->CTest->RunTest(arguments, &output, &retVal, this->LogFile, - it->Timeout, &it->Environment); - } - clock_finish = cmSystemTools::GetTime(); - - cres.ExecutionTime = (double)(clock_finish - clock_start); - cres.FullCommandLine = testCommand; - std::string reason; - if ( !this->CTest->GetShowOnly() ) - { - std::vector >::iterator passIt; - bool forceFail = false; - if ( it->RequiredRegularExpressions.size() > 0 ) - { - bool found = false; - for ( passIt = it->RequiredRegularExpressions.begin(); - passIt != it->RequiredRegularExpressions.end(); - ++ passIt ) - { - if ( passIt->first.find(output.c_str()) ) - { - found = true; - reason = "Required regular expression found."; - } - } - if ( !found ) - { - reason = "Required regular expression not found."; - forceFail = true; - } - reason += "Regex=["; - for ( passIt = it->RequiredRegularExpressions.begin(); - passIt != it->RequiredRegularExpressions.end(); - ++ passIt ) - { - reason += passIt->second; - reason += "\n"; - } - reason += "]"; - } - if ( it->ErrorRegularExpressions.size() > 0 ) - { - for ( passIt = it->ErrorRegularExpressions.begin(); - passIt != it->ErrorRegularExpressions.end(); - ++ passIt ) - { - if ( passIt->first.find(output.c_str()) ) - { - reason = "Error regular expression found in output."; - reason += " Regex=["; - reason += passIt->second; - reason += "]"; - forceFail = true; - } - } - } - - if (res == cmsysProcess_State_Exited) - { - bool success = - !forceFail && (retVal == 0 || it->RequiredRegularExpressions.size()); - if((success && !it->WillFail) || (!success && it->WillFail)) - { - cres.Status = cmCTestTestHandler::COMPLETED; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Passed " ); - } - else - { - cres.Status = cmCTestTestHandler::FAILED; - cmCTestLog(this->CTest, HANDLER_OUTPUT, - "***Failed " << reason ); - } - } - else if ( res == cmsysProcess_State_Expired ) - { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Timeout"); - cres.Status = cmCTestTestHandler::TIMEOUT; - } - else if ( res == cmsysProcess_State_Exception ) - { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Exception: "); - switch ( retVal ) - { - case cmsysProcess_Exception_Fault: - cmCTestLog(this->CTest, HANDLER_OUTPUT, "SegFault"); - cres.Status = cmCTestTestHandler::SEGFAULT; - break; - case cmsysProcess_Exception_Illegal: - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Illegal"); - cres.Status = cmCTestTestHandler::ILLEGAL; - break; - case cmsysProcess_Exception_Interrupt: - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Interrupt"); - cres.Status = cmCTestTestHandler::INTERRUPT; - break; - case cmsysProcess_Exception_Numerical: - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Numerical"); - cres.Status = cmCTestTestHandler::NUMERICAL; - break; - default: - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Other"); - cres.Status = cmCTestTestHandler::OTHER_FAULT; - } - } - else // if ( res == cmsysProcess_State_Error ) - { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Bad command " << res ); - cres.Status = cmCTestTestHandler::BAD_COMMAND; - } - - if(cres.Status == cmCTestTestHandler::COMPLETED) - { - passed.push_back(testname); - } - else - { - failed.push_back(testname); - } - char buf[1024]; - sprintf(buf, "%6.2f sec", cres.ExecutionTime); - cmCTestLog(this->CTest, HANDLER_OUTPUT, buf << "\n" ); - if (!output.empty() && output.find("DartStuff.find(output.c_str())) - { - std::string dartString = this->DartStuff.match(1); - // keep searching and replacing until none are left - while (this->DartStuff1.find(output.c_str())) - { - // replace the exact match for the string - cmSystemTools::ReplaceString(output, - this->DartStuff1.match(1).c_str(), ""); - } - cres.RegressionImages - = this->GenerateRegressionImages(dartString); - } - } - } - - // if this is doing MemCheck then all the output needs to be put into - // Output since that it what is parsed to by cmCTestMemCheckHandler - if(!this->MemCheck) - { - if ( cres.Status == cmCTestTestHandler::COMPLETED ) - { - this->CleanTestOutput(output, static_cast - (this->CustomMaximumPassedTestOutputSize)); - } - else - { - this->CleanTestOutput(output, static_cast - (this->CustomMaximumFailedTestOutputSize)); - } - } - cres.Reason = reason; - if ( this->LogFile ) - { - bool pass = true; - const char* reasonType = "Test Pass Reason"; - if(cres.Status != cmCTestTestHandler::COMPLETED && - cres.Status != cmCTestTestHandler::NOT_RUN) - { - reasonType = "Test Fail Reason"; - pass = false; - } - double ttime = clock_finish - clock_start; - int hours = static_cast(ttime / (60 * 60)); - int minutes = static_cast(ttime / 60) % 60; - int seconds = static_cast(ttime) % 60; - char buffer[100]; - sprintf(buffer, "%02d:%02d:%02d", hours, minutes, seconds); - *this->LogFile - << "----------------------------------------------------------" - << std::endl; - if(cres.Reason.size()) - { - *this->LogFile << reasonType << ":\n" << cres.Reason << "\n"; - } - else - { - if(pass) - { - *this->LogFile << "Test Passed.\n"; - } - else - { - *this->LogFile << "Test Failed.\n"; - } - } - *this->LogFile << "\"" << testname.c_str() << "\" end time: " - << this->CTest->CurrentTime() << std::endl - << "\"" << testname.c_str() << "\" time elapsed: " - << buffer << std::endl - << "----------------------------------------------------------" - << std::endl << std::endl; - } - cres.Output = output; - cres.ReturnValue = retVal; - cres.CompletionStatus = "Completed"; - this->TestResults.push_back( cres ); -} -*/ //---------------------------------------------------------------------- void cmCTestTestHandler::CheckLabelFilterInclude(cmCTestTestProperties& it) {