[Cmake-commits] [cmake-commits] king committed cmCTestBuildCommand.cxx 1.20.2.1 1.20.2.2 cmCTestBuildCommand.h 1.9.2.1 1.9.2.2 cmCTestBuildHandler.cxx 1.75.2.2 1.75.2.3 cmCTestBuildHandler.h 1.16.2.1 1.16.2.2 cmCTestConfigureCommand.cxx 1.12.2.1 1.12.2.2 cmCTestGIT.cxx 1.2.2.1 1.2.2.2 cmCTestGlobalVC.cxx 1.1.2.1 1.1.2.2 cmCTestGlobalVC.h 1.1.2.1 1.1.2.2 cmCTestHandlerCommand.cxx 1.16.2.1 1.16.2.2 cmCTestMultiProcessHandler.cxx 1.25.2.7 1.25.2.8 cmCTestRunTest.cxx 1.22.2.3 1.22.2.4 cmCTestRunTest.h 1.11.2.2 1.11.2.3 cmCTestSVN.cxx 1.8.2.1 1.8.2.2 cmCTestSVN.h 1.6.2.1 1.6.2.2 cmCTestScriptHandler.cxx 1.55.2.1 1.55.2.2 cmCTestStartCommand.cxx 1.16.4.1 1.16.4.2 cmCTestStartCommand.h 1.6.2.1 1.6.2.2 cmCTestSubmitHandler.cxx 1.48.2.1 1.48.2.2 cmCTestSubmitHandler.h 1.8.2.1 1.8.2.2 cmCTestTestCommand.cxx 1.13.2.1 1.13.2.2 cmCTestTestCommand.h 1.13.2.1 1.13.2.2 cmCTestTestHandler.cxx 1.120.2.4 1.120.2.5 cmCTestTestHandler.h 1.49.2.1 1.49.2.2 cmCTestUpdateCommand.cxx 1.18.2.1 1.18.2.2 cmCTestUpdateHandler.cxx 1.67.2.1 1.67.2.2 cmCTestUpdateHandler.h 1.14.2.1 1.14.2.2 cmProcess.cxx 1.16.2.1 1.16.2.2
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Jan 28 16:48:04 EST 2010
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv23913/Source/CTest
Modified Files:
Tag: CMake-2-8
cmCTestBuildCommand.cxx cmCTestBuildCommand.h
cmCTestBuildHandler.cxx cmCTestBuildHandler.h
cmCTestConfigureCommand.cxx cmCTestGIT.cxx cmCTestGlobalVC.cxx
cmCTestGlobalVC.h cmCTestHandlerCommand.cxx
cmCTestMultiProcessHandler.cxx cmCTestRunTest.cxx
cmCTestRunTest.h cmCTestSVN.cxx cmCTestSVN.h
cmCTestScriptHandler.cxx cmCTestStartCommand.cxx
cmCTestStartCommand.h cmCTestSubmitHandler.cxx
cmCTestSubmitHandler.h cmCTestTestCommand.cxx
cmCTestTestCommand.h cmCTestTestHandler.cxx
cmCTestTestHandler.h cmCTestUpdateCommand.cxx
cmCTestUpdateHandler.cxx cmCTestUpdateHandler.h cmProcess.cxx
Log Message:
CMake 2.8.1-rc1
Index: cmCTestSubmitHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.cxx,v
retrieving revision 1.48.2.1
retrieving revision 1.48.2.2
diff -C 2 -d -r1.48.2.1 -r1.48.2.2
*** cmCTestSubmitHandler.cxx 1 Oct 2009 21:21:13 -0000 1.48.2.1
--- cmCTestSubmitHandler.cxx 28 Jan 2010 21:48:02 -0000 1.48.2.2
***************
*** 73,76 ****
--- 73,78 ----
}
this->CDash = false;
+ this->HasWarnings = false;
+ this->HasErrors = false;
this->Superclass::Initialize();
this->HTTPProxy = "";
***************
*** 310,314 ****
}
}
!
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
--- 312,321 ----
}
}
! if(this->CTest->ShouldUseHTTP10())
! {
! curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
! }
! // enable HTTP ERROR parsing
! curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
***************
*** 410,413 ****
--- 417,421 ----
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
+ this->ParseResponse(chunk);
}
if ( chunkDebug.size() > 0 )
***************
*** 456,459 ****
--- 464,497 ----
//----------------------------------------------------------------------------
+ void cmCTestSubmitHandler
+ ::ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk)
+ {
+ std::string output = "";
+
+ for(cmCTestSubmitHandlerVectorOfChar::iterator i = chunk.begin();
+ i != chunk.end(); ++i)
+ {
+ output += *i;
+ }
+ output = cmSystemTools::UpperCase(output);
+
+ if(output.find("WARNING") != std::string::npos)
+ {
+ this->HasWarnings = true;
+ }
+ if(output.find("ERROR") != std::string::npos)
+ {
+ this->HasErrors = true;
+ }
+
+ if(this->HasWarnings || this->HasErrors)
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, " Server Response:\n" <<
+ cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "\n");
+ }
+
+ }
+
+ //----------------------------------------------------------------------------
bool cmCTestSubmitHandler::TriggerUsingHTTP(
const std::set<cmStdString>& files,
***************
*** 1150,1156 ****
}
}
! cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful"
! << std::endl);
! ofs << " Submission successful" << std::endl;
return 0;
}
--- 1188,1205 ----
}
}
! if(this->HasErrors)
! {
! cmCTestLog(this->CTest, HANDLER_OUTPUT, " Errors occurred during "
! "submission." << std::endl);
! ofs << " Errors occurred during submission. " << std::endl;
! }
! else
! {
! cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" <<
! (this->HasWarnings ? ", with warnings." : "") << std::endl);
! ofs << " Submission successful" <<
! (this->HasWarnings ? ", with warnings." : "") << std::endl;
! }
!
return 0;
}
Index: cmCTestBuildCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildCommand.cxx,v
retrieving revision 1.20.2.1
retrieving revision 1.20.2.2
diff -C 2 -d -r1.20.2.1 -r1.20.2.2
*** cmCTestBuildCommand.cxx 1 Oct 2009 21:21:12 -0000 1.20.2.1
--- cmCTestBuildCommand.cxx 28 Jan 2010 21:48:00 -0000 1.20.2.2
***************
*** 24,28 ****
this->GlobalGenerator = 0;
this->Arguments[ctb_NUMBER_ERRORS] = "NUMBER_ERRORS";
! this->Arguments[ctb_NUMBER_WARNINGS] = "NUMBER_WARNINGS";
this->Arguments[ctb_LAST] = 0;
this->Last = ctb_LAST;
--- 24,32 ----
this->GlobalGenerator = 0;
this->Arguments[ctb_NUMBER_ERRORS] = "NUMBER_ERRORS";
! this->Arguments[ctb_NUMBER_WARNINGS] = "NUMBER_WARNINGS";
! this->Arguments[ctb_TARGET] = "TARGET";
! this->Arguments[ctb_CONFIGURATION] = "CONFIGURATION";
! this->Arguments[ctb_FLAGS] = "FLAGS";
! this->Arguments[ctb_PROJECT_NAME] = "PROJECT_NAME";
this->Arguments[ctb_LAST] = 0;
this->Last = ctb_LAST;
***************
*** 50,53 ****
--- 54,58 ----
}
this->Handler = (cmCTestBuildHandler*)handler;
+
const char* ctestBuildCommand
= this->Makefile->GetDefinition("CTEST_BUILD_COMMAND");
***************
*** 61,71 ****
= this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
const char* cmakeProjectName
! = this->Makefile->GetDefinition("CTEST_PROJECT_NAME");
! const char* cmakeBuildConfiguration
= this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
const char* cmakeBuildAdditionalFlags
! = this->Makefile->GetDefinition("CTEST_BUILD_FLAGS");
const char* cmakeBuildTarget
! = this->Makefile->GetDefinition("CTEST_BUILD_TARGET");
if ( cmakeGeneratorName && *cmakeGeneratorName &&
cmakeProjectName && *cmakeProjectName )
--- 66,96 ----
= this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
const char* cmakeProjectName
! = (this->Values[ctb_PROJECT_NAME] && *this->Values[ctb_PROJECT_NAME])
! ? this->Values[ctb_PROJECT_NAME]
! : this->Makefile->GetDefinition("CTEST_PROJECT_NAME");
!
! // Build configuration is determined by: CONFIGURATION argument,
! // or CTEST_BUILD_CONFIGURATION script variable, or
! // CTEST_CONFIGURATION_TYPE script variable, or ctest -C command
! // line argument... in that order.
! //
! const char* ctestBuildConfiguration
= this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
+ const char* cmakeBuildConfiguration
+ = (this->Values[ctb_CONFIGURATION] && *this->Values[ctb_CONFIGURATION])
+ ? this->Values[ctb_CONFIGURATION]
+ : ((ctestBuildConfiguration && *ctestBuildConfiguration)
+ ? ctestBuildConfiguration
+ : this->CTest->GetConfigType().c_str());
+
const char* cmakeBuildAdditionalFlags
! = (this->Values[ctb_FLAGS] && *this->Values[ctb_FLAGS])
! ? this->Values[ctb_FLAGS]
! : this->Makefile->GetDefinition("CTEST_BUILD_FLAGS");
const char* cmakeBuildTarget
! = (this->Values[ctb_TARGET] && *this->Values[ctb_TARGET])
! ? this->Values[ctb_TARGET]
! : this->Makefile->GetDefinition("CTEST_BUILD_TARGET");
!
if ( cmakeGeneratorName && *cmakeGeneratorName &&
cmakeProjectName && *cmakeProjectName )
***************
*** 105,109 ****
cmakeBuildConfiguration = config;
}
!
std::string buildCommand
= this->GlobalGenerator->
--- 130,134 ----
cmakeBuildConfiguration = config;
}
!
std::string buildCommand
= this->GlobalGenerator->
***************
*** 120,127 ****
{
cmOStringStream ostr;
! ostr << "CTEST_BUILD_COMMAND or CTEST_CMAKE_GENERATOR not specified. "
! "Please specify the CTEST_CMAKE_GENERATOR and CTEST_PROJECT_NAME if "
! "this is a CMake project, or specify the CTEST_BUILD_COMMAND for "
! "cmake or any other project.";
this->SetError(ostr.str().c_str());
return 0;
--- 145,159 ----
{
cmOStringStream ostr;
! ostr << "has no project to build. If this is a "
! "\"built with CMake\" project, verify that CTEST_CMAKE_GENERATOR "
! "and CTEST_PROJECT_NAME are set."
! "\n"
! "CTEST_PROJECT_NAME is usually set in CTestConfig.cmake. Verify "
! "that CTestConfig.cmake exists, or CTEST_PROJECT_NAME "
! "is set in the script, or PROJECT_NAME is passed as an argument "
! "to ctest_build."
! "\n"
! "Alternatively, set CTEST_BUILD_COMMAND to build the project "
! "with a custom command line.";
this->SetError(ostr.str().c_str());
return 0;
Index: cmCTestScriptHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestScriptHandler.cxx,v
retrieving revision 1.55.2.1
retrieving revision 1.55.2.2
diff -C 2 -d -r1.55.2.1 -r1.55.2.2
*** cmCTestScriptHandler.cxx 1 Oct 2009 21:21:13 -0000 1.55.2.1
--- cmCTestScriptHandler.cxx 28 Jan 2010 21:48:01 -0000 1.55.2.2
***************
*** 584,587 ****
--- 584,591 ----
(const std::string& total_script_arg, bool pscope)
{
+ #ifdef CMAKE_BUILD_WITH_CMAKE
+ cmSystemTools::SaveRestoreEnvironment sre;
+ #endif
+
int result;
Index: cmCTestHandlerCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestHandlerCommand.cxx,v
retrieving revision 1.16.2.1
retrieving revision 1.16.2.2
diff -C 2 -d -r1.16.2.1 -r1.16.2.2
*** cmCTestHandlerCommand.cxx 1 Oct 2009 21:21:12 -0000 1.16.2.1
--- cmCTestHandlerCommand.cxx 28 Jan 2010 21:48:01 -0000 1.16.2.2
***************
*** 60,63 ****
--- 60,74 ----
}
+ // Set the config type of this ctest to the current value of the
+ // CTEST_CONFIGURATION_TYPE script variable if it is defined.
+ // The current script value trumps the -C argument on the command
+ // line.
+ const char* ctestConfigType =
+ this->Makefile->GetDefinition("CTEST_CONFIGURATION_TYPE");
+ if (ctestConfigType)
+ {
+ this->CTest->SetConfigType(ctestConfigType);
+ }
+
cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;);
cmCTestGenericHandler* handler = this->InitializeHandler();
Index: cmCTestUpdateHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestUpdateHandler.cxx,v
retrieving revision 1.67.2.1
retrieving revision 1.67.2.2
diff -C 2 -d -r1.67.2.1 -r1.67.2.2
*** cmCTestUpdateHandler.cxx 1 Oct 2009 21:21:13 -0000 1.67.2.1
--- cmCTestUpdateHandler.cxx 28 Jan 2010 21:48:02 -0000 1.67.2.2
***************
*** 202,214 ****
}
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- "Updating the repository" << std::endl);
-
- // Make sure the source directory exists.
- if(!this->InitialCheckout(ofs))
- {
- return -1;
- }
-
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Updating the repository: "
<< sourceDirectory << std::endl);
--- 202,205 ----
***************
*** 268,272 ****
os << "\t<StartDateTime>" << start_time << "</StartDateTime>\n"
<< "\t<StartTime>" << start_time_time << "</StartTime>\n"
! << "\t<UpdateCommand>" << cmXMLSafe(vc->GetUpdateCommandLine())
<< "</UpdateCommand>\n"
<< "\t<UpdateType>" << cmXMLSafe(
--- 259,264 ----
os << "\t<StartDateTime>" << start_time << "</StartDateTime>\n"
<< "\t<StartTime>" << start_time_time << "</StartTime>\n"
! << "\t<UpdateCommand>"
! << cmXMLSafe(vc->GetUpdateCommandLine()).Quotes(false)
<< "</UpdateCommand>\n"
<< "\t<UpdateType>" << cmXMLSafe(
***************
*** 324,353 ****
//----------------------------------------------------------------------
- bool cmCTestUpdateHandler::InitialCheckout(std::ostream& ofs)
- {
- // Use the user-provided command to create the source tree.
- if(const char* command = this->GetOption("InitialCheckout"))
- {
- // Use a generic VC object to run and log the command.
- cmCTestVC vc(this->CTest, ofs);
- vc.SetSourceDirectory(this->GetOption("SourceDirectory"));
- if(!vc.InitialCheckout(command))
- {
- return false;
- }
-
- if(!this->CTest->InitializeFromCommand(this->Command))
- {
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- " Fatal Error in initialize: "
- << std::endl);
- cmSystemTools::SetFatalErrorOccured();
- return false;
- }
- }
- return true;
- }
-
- //----------------------------------------------------------------------
int cmCTestUpdateHandler::DetectVCS(const char* dir)
{
--- 316,319 ----
Index: cmCTestSubmitHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.h,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C 2 -d -r1.8.2.1 -r1.8.2.2
*** cmCTestSubmitHandler.h 1 Oct 2009 21:21:13 -0000 1.8.2.1
--- cmCTestSubmitHandler.h 28 Jan 2010 21:48:02 -0000 1.8.2.2
***************
*** 76,79 ****
--- 76,81 ----
const cmStdString& url);
+ void ParseResponse(std::vector<char>);
+
std::string GetSubmitResultsPrefix();
***************
*** 86,89 ****
--- 88,93 ----
bool SubmitPart[cmCTest::PartCount];
bool CDash;
+ bool HasWarnings;
+ bool HasErrors;
cmCTest::SetOfStrings Files;
};
Index: cmCTestStartCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestStartCommand.cxx,v
retrieving revision 1.16.4.1
retrieving revision 1.16.4.2
diff -C 2 -d -r1.16.4.1 -r1.16.4.2
*** cmCTestStartCommand.cxx 1 Oct 2009 21:21:13 -0000 1.16.4.1
--- cmCTestStartCommand.cxx 28 Jan 2010 21:48:01 -0000 1.16.4.2
***************
*** 15,18 ****
--- 15,25 ----
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
+ #include "cmCTestVC.h"
+ #include "cmGeneratedFileStream.h"
+
+ cmCTestStartCommand::cmCTestStartCommand()
+ {
+ this->CreateNewTag = true;
+ }
bool cmCTestStartCommand
***************
*** 43,46 ****
--- 50,62 ----
}
+ if (cnt < args.size())
+ {
+ if (args[cnt] == "APPEND")
+ {
+ cnt ++;
+ this->CreateNewTag = false;
+ }
+ }
+
if ( cnt < args.size() )
{
***************
*** 77,84 ****
this->CTest->EmptyCTestConfiguration();
! this->CTest->SetCTestConfiguration("SourceDirectory",
! cmSystemTools::CollapseFullPath(src_dir).c_str());
! this->CTest->SetCTestConfiguration("BuildDirectory",
! cmSystemTools::CollapseFullPath(bld_dir).c_str());
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model "
--- 93,101 ----
this->CTest->EmptyCTestConfiguration();
!
! std::string sourceDir = cmSystemTools::CollapseFullPath(src_dir);
! std::string binaryDir = cmSystemTools::CollapseFullPath(bld_dir);
! this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir.c_str());
! this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str());
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model "
***************
*** 93,96 ****
--- 110,139 ----
}
+ // Log startup actions.
+ std::string startLogFile = binaryDir + "/Testing/Temporary/LastStart.log";
+ cmGeneratedFileStream ofs(startLogFile.c_str());
+ if(!ofs)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Cannot create log file: LastStart.log" << std::endl);
+ return false;
+ }
+
+ // Make sure the source directory exists.
+ if(!this->InitialCheckout(ofs, sourceDir))
+ {
+ return false;
+ }
+ if(!cmSystemTools::FileIsDirectory(sourceDir.c_str()))
+ {
+ cmOStringStream e;
+ e << "given source path\n"
+ << " " << sourceDir << "\n"
+ << "which is not an existing directory. "
+ << "Set CTEST_CHECKOUT_COMMAND to a command line to create it.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", "OFF");
this->CTest->SetSuppressUpdatingCTestConfiguration(true);
***************
*** 99,104 ****
this->CTest->SetProduceXML(true);
! return this->CTest->InitializeFromCommand(this, true);
}
!
--- 142,170 ----
this->CTest->SetProduceXML(true);
! return this->CTest->InitializeFromCommand(this);
}
! //----------------------------------------------------------------------------
! bool cmCTestStartCommand::InitialCheckout(
! std::ostream& ofs, std::string const& sourceDir)
! {
! // Use the user-provided command to create the source tree.
! const char* initialCheckoutCommand
! = this->Makefile->GetDefinition("CTEST_CHECKOUT_COMMAND");
! if(!initialCheckoutCommand)
! {
! initialCheckoutCommand =
! this->Makefile->GetDefinition("CTEST_CVS_CHECKOUT");
! }
! if(initialCheckoutCommand)
! {
! // Use a generic VC object to run and log the command.
! cmCTestVC vc(this->CTest, ofs);
! vc.SetSourceDirectory(sourceDir.c_str());
! if(!vc.InitialCheckout(initialCheckoutCommand))
! {
! return false;
! }
! }
! return true;
! }
Index: cmCTestUpdateHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestUpdateHandler.h,v
retrieving revision 1.14.2.1
retrieving revision 1.14.2.2
diff -C 2 -d -r1.14.2.1 -r1.14.2.2
*** cmCTestUpdateHandler.h 1 Oct 2009 21:21:13 -0000 1.14.2.1
--- cmCTestUpdateHandler.h 28 Jan 2010 21:48:02 -0000 1.14.2.2
***************
*** 66,70 ****
int UpdateType;
- bool InitialCheckout(std::ostream& ofs);
int DetectVCS(const char* dir);
bool SelectVCS();
--- 66,69 ----
Index: cmCTestUpdateCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestUpdateCommand.cxx,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -C 2 -d -r1.18.2.1 -r1.18.2.2
*** cmCTestUpdateCommand.cxx 1 Oct 2009 21:21:13 -0000 1.18.2.1
--- cmCTestUpdateCommand.cxx 28 Jan 2010 21:48:02 -0000 1.18.2.2
***************
*** 57,68 ****
"HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS");
- const char* initialCheckoutCommand
- = this->Makefile->GetDefinition("CTEST_CHECKOUT_COMMAND");
- if ( !initialCheckoutCommand )
- {
- initialCheckoutCommand =
- this->Makefile->GetDefinition("CTEST_CVS_CHECKOUT");
- }
-
cmCTestGenericHandler* handler
= this->CTest->GetInitializedHandler("update");
--- 57,60 ----
***************
*** 79,100 ****
}
handler->SetOption("SourceDirectory", source_dir.c_str());
- if ( initialCheckoutCommand )
- {
- handler->SetOption("InitialCheckout", initialCheckoutCommand);
- }
- if ( (!cmSystemTools::FileExists(source_dir.c_str()) ||
- !cmSystemTools::FileIsDirectory(source_dir.c_str()))
- && !initialCheckoutCommand )
- {
- cmOStringStream str;
- str << "cannot find source directory: " << source_dir.c_str() << ".";
- if ( !cmSystemTools::FileExists(source_dir.c_str()) )
- {
- str << " Looks like it is not checked out yet. Please specify "
- "CTEST_CHECKOUT_COMMAND.";
- }
- this->SetError(str.str().c_str());
- return 0;
- }
return handler;
}
--- 71,74 ----
Index: cmCTestGlobalVC.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestGlobalVC.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C 2 -d -r1.1.2.1 -r1.1.2.2
*** cmCTestGlobalVC.h 1 Oct 2009 21:21:12 -0000 1.1.2.1
--- cmCTestGlobalVC.h 28 Jan 2010 21:48:01 -0000 1.1.2.2
***************
*** 61,64 ****
--- 61,65 ----
virtual void LoadRevisions() = 0;
+ virtual void WriteXMLGlobal(std::ostream& xml);
void WriteXMLDirectory(std::ostream& xml, std::string const& path,
Directory const& dir);
Index: cmCTestTestCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestCommand.h,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -C 2 -d -r1.13.2.1 -r1.13.2.2
*** cmCTestTestCommand.h 1 Oct 2009 21:21:13 -0000 1.13.2.1
--- cmCTestTestCommand.h 28 Jan 2010 21:48:02 -0000 1.13.2.2
***************
*** 62,66 ****
" [EXCLUDE_LABEL exclude regex] \n"
" [INCLUDE_LABEL label regex] \n"
! " [PARALLEL_LEVEL level]) \n"
"Tests the given build directory and stores results in Test.xml. The "
"second argument is a variable that will hold value. Optionally, "
--- 62,67 ----
" [EXCLUDE_LABEL exclude regex] \n"
" [INCLUDE_LABEL label regex] \n"
! " [PARALLEL_LEVEL level] \n"
! " [SCHEDULE_RANDOM on]) \n"
"Tests the given build directory and stores results in Test.xml. The "
"second argument is a variable that will hold value. Optionally, "
***************
*** 71,75 ****
"expression for test to be included or excluded by the test "
"property LABEL. PARALLEL_LEVEL should be set to a positive number "
! "representing the number of tests to be run in parallel."
"\n"
CTEST_COMMAND_APPEND_OPTION_DOCS;
--- 72,78 ----
"expression for test to be included or excluded by the test "
"property LABEL. PARALLEL_LEVEL should be set to a positive number "
! "representing the number of tests to be run in parallel. "
! "SCHEDULE_RANDOM will launch tests in a random order, and is "
! "typically used to detect implicit test dependencies."
"\n"
CTEST_COMMAND_APPEND_OPTION_DOCS;
***************
*** 93,96 ****
--- 96,100 ----
ctt_INCLUDE_LABEL,
ctt_PARALLEL_LEVEL,
+ ctt_SCHEDULE_RANDOM,
ctt_LAST
};
Index: cmCTestTestCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestCommand.cxx,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -C 2 -d -r1.13.2.1 -r1.13.2.2
*** cmCTestTestCommand.cxx 1 Oct 2009 21:21:13 -0000 1.13.2.1
--- cmCTestTestCommand.cxx 28 Jan 2010 21:48:02 -0000 1.13.2.2
***************
*** 25,28 ****
--- 25,29 ----
this->Arguments[ctt_INCLUDE_LABEL] = "INCLUDE_LABEL";
this->Arguments[ctt_PARALLEL_LEVEL] = "PARALLEL_LEVEL";
+ this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM";
this->Arguments[ctt_LAST] = 0;
this->Last = ctt_LAST;
***************
*** 33,36 ****
--- 34,38 ----
const char* ctestTimeout =
this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
+
double timeout = this->CTest->GetTimeOut();
if ( ctestTimeout )
***************
*** 92,95 ****
--- 94,102 ----
this->Values[ctt_PARALLEL_LEVEL]);
}
+ if(this->Values[ctt_SCHEDULE_RANDOM])
+ {
+ handler->SetOption("ScheduleRandom",
+ this->Values[ctt_SCHEDULE_RANDOM]);
+ }
return handler;
}
***************
*** 99,101 ****
return this->CTest->GetInitializedHandler("test");
}
-
--- 106,107 ----
Index: cmProcess.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmProcess.cxx,v
retrieving revision 1.16.2.1
retrieving revision 1.16.2.2
diff -C 2 -d -r1.16.2.1 -r1.16.2.2
*** cmProcess.cxx 1 Oct 2009 21:21:13 -0000 1.16.2.1
--- cmProcess.cxx 28 Jan 2010 21:48:02 -0000 1.16.2.2
***************
*** 80,84 ****
const char* text = &*this->begin() + this->First;
size_type length = this->Last - this->First;
! length -= (length && text[length-1] == '\r')? 1:0;
line.assign(text, length);
--- 80,87 ----
const char* text = &*this->begin() + this->First;
size_type length = this->Last - this->First;
! while(length && text[length-1] == '\r')
! {
! length --;
! }
line.assign(text, length);
Index: cmCTestBuildHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildHandler.h,v
retrieving revision 1.16.2.1
retrieving revision 1.16.2.2
diff -C 2 -d -r1.16.2.1 -r1.16.2.2
*** cmCTestBuildHandler.h 1 Oct 2009 21:21:12 -0000 1.16.2.1
--- cmCTestBuildHandler.h 28 Jan 2010 21:48:01 -0000 1.16.2.2
***************
*** 47,51 ****
--- 47,54 ----
int GetTotalErrors() { return this->TotalErrors;}
int GetTotalWarnings() { return this->TotalWarnings;}
+
private:
+ std::string GetMakeCommand();
+
//! Run command specialized for make and configure. Returns process status
// and retVal is return value or exception.
Index: cmCTestStartCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestStartCommand.h,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C 2 -d -r1.6.2.1 -r1.6.2.2
*** cmCTestStartCommand.h 1 Oct 2009 21:21:13 -0000 1.6.2.1
--- cmCTestStartCommand.h 28 Jan 2010 21:48:01 -0000 1.6.2.2
***************
*** 24,28 ****
public:
! cmCTestStartCommand() {}
/**
--- 24,28 ----
public:
! cmCTestStartCommand();
/**
***************
*** 34,37 ****
--- 34,38 ----
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
+ ni->CreateNewTag = this->CreateNewTag;
return ni;
}
***************
*** 45,48 ****
--- 46,57 ----
/**
+ * Will this invocation of ctest_start create a new TAG file?
+ */
+ bool ShouldCreateNewTag()
+ {
+ return this->CreateNewTag;
+ }
+
+ /**
* The name of the command as specified in CMakeList.txt.
*/
***************
*** 63,76 ****
{
return
! " ctest_start(Model [TRACK <track>] [source [binary]])\n"
"Starts the testing for a given model. The command should be called "
"after the binary directory is initialized. If the 'source' and "
"'binary' directory are not specified, it reads the "
"CTEST_SOURCE_DIRECTORY and CTEST_BINARY_DIRECTORY. If the track is "
! "specified, the submissions will go to the specified track.";
}
cmTypeMacro(cmCTestStartCommand, cmCTestCommand);
};
--- 72,90 ----
{
return
! " ctest_start(Model [TRACK <track>] [APPEND] [source [binary]])\n"
"Starts the testing for a given model. The command should be called "
"after the binary directory is initialized. If the 'source' and "
"'binary' directory are not specified, it reads the "
"CTEST_SOURCE_DIRECTORY and CTEST_BINARY_DIRECTORY. If the track is "
! "specified, the submissions will go to the specified track. "
! "If APPEND is used, the existing TAG is used rather than "
! "creating a new one based on the current time stamp.";
}
cmTypeMacro(cmCTestStartCommand, cmCTestCommand);
+ private:
+ bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir);
+ bool CreateNewTag;
};
Index: cmCTestSVN.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSVN.h,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C 2 -d -r1.6.2.1 -r1.6.2.2
*** cmCTestSVN.h 1 Oct 2009 21:21:13 -0000 1.6.2.1
--- cmCTestSVN.h 28 Jan 2010 21:48:01 -0000 1.6.2.2
***************
*** 53,56 ****
--- 53,58 ----
std::vector<Change> const& changes);
+ void WriteXMLGlobal(std::ostream& xml);
+
// Parsing helper classes.
class InfoParser;
Index: cmCTestMultiProcessHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMultiProcessHandler.cxx,v
retrieving revision 1.25.2.7
retrieving revision 1.25.2.8
diff -C 2 -d -r1.25.2.7 -r1.25.2.8
*** cmCTestMultiProcessHandler.cxx 11 Nov 2009 18:34:15 -0000 1.25.2.7
--- cmCTestMultiProcessHandler.cxx 28 Jan 2010 21:48:01 -0000 1.25.2.8
***************
*** 44,49 ****
this->TestFinishMap[i->first] = false;
}
! this->ReadCostData();
! this->CreateTestCostList();
}
--- 44,52 ----
this->TestFinishMap[i->first] = false;
}
! if(!this->CTest->GetShowOnly())
! {
! this->ReadCostData();
! this->CreateTestCostList();
! }
}
***************
*** 103,106 ****
--- 106,110 ----
testRun->EndTest(this->Completed, this->Total, false);
this->Failed->push_back(this->Properties[test]->Name);
+ delete testRun;
}
cmSystemTools::ChangeDirectory(current_dir.c_str());
***************
*** 413,422 ****
}
}
! else
{
! if(cmSystemTools::FileExists(fname.c_str(), true))
! {
! cmSystemTools::RemoveFile(fname.c_str());
! }
}
}
--- 417,423 ----
}
}
! else if(cmSystemTools::FileExists(fname.c_str(), true))
{
! cmSystemTools::RemoveFile(fname.c_str());
}
}
Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.120.2.4
retrieving revision 1.120.2.5
diff -C 2 -d -r1.120.2.4 -r1.120.2.5
*** cmCTestTestHandler.cxx 11 Nov 2009 18:34:15 -0000 1.120.2.4
--- cmCTestTestHandler.cxx 28 Jan 2010 21:48:02 -0000 1.120.2.5
***************
*** 501,509 ****
// Update internal data structure from generic one
this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
! this->SetUseUnion(cmSystemTools::IsOn(this->GetOption("UseUnion")));
if(this->GetOption("ParallelLevel"))
{
this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel")));
}
const char* val;
val = this->GetOption("LabelRegularExpression");
--- 501,514 ----
// Update internal data structure from generic one
this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
! this->SetUseUnion(cmSystemTools::IsOn(this->GetOption("UseUnion")));
! if(cmSystemTools::IsOn(this->GetOption("ScheduleRandom")))
! {
! this->CTest->SetScheduleType("Random");
! }
if(this->GetOption("ParallelLevel"))
{
this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel")));
}
+
const char* val;
val = this->GetOption("LabelRegularExpression");
***************
*** 685,695 ****
}
}
- it = this->TestList.begin();
ri = this->TestResults.begin();
// fill maps
! for(; it != this->TestList.end(); ++it, ++ri)
{
! cmCTestTestProperties& p = *it;
! cmCTestTestResult &result = *ri;
if(p.Labels.size() != 0)
{
--- 690,699 ----
}
}
ri = this->TestResults.begin();
// fill maps
! for(; ri != this->TestResults.end(); ++ri)
{
! cmCTestTestResult &result = *ri;
! cmCTestTestProperties& p = *result.Properties;
if(p.Labels.size() != 0)
{
***************
*** 1031,1034 ****
--- 1035,1044 ----
cmCTestMultiProcessHandler::PropertiesMap properties;
+ bool randomSchedule = this->CTest->GetScheduleType() == "Random";
+ if(randomSchedule)
+ {
+ srand((unsigned)time(0));
+ }
+
for (ListOfTests::iterator it = this->TestList.begin();
it != this->TestList.end(); ++it)
***************
*** 1037,1040 ****
--- 1047,1060 ----
cmCTestMultiProcessHandler::TestSet depends;
+ if(randomSchedule)
+ {
+ p.Cost = rand();
+ }
+
+ if(p.Timeout == 0 && this->CTest->GetGlobalTimeout() != 0)
+ {
+ p.Timeout = this->CTest->GetGlobalTimeout();
+ }
+
if(p.Depends.size())
{
***************
*** 1167,1171 ****
os
<< "\t\t\t<Measurement>\n"
! << "\t\t\t\t<Value>";
os << cmXMLSafe(result->Output);
os
--- 1187,1194 ----
os
<< "\t\t\t<Measurement>\n"
! << "\t\t\t\t<Value"
! << (result->CompressOutput ?
! " encoding=\"base64\" compression=\"gzip\">"
! : ">");
os << cmXMLSafe(result->Output);
os
***************
*** 1173,1176 ****
--- 1196,1201 ----
<< "\t\t\t</Measurement>\n"
<< "\t\t</Results>\n";
+
+ this->AttachFiles(os, result);
this->WriteTestResultFooter(os, result);
}
***************
*** 1235,1238 ****
--- 1260,1330 ----
//----------------------------------------------------------------------
+ void cmCTestTestHandler::AttachFiles(std::ostream& os,
+ cmCTestTestResult* result)
+ {
+ if(result->Status != cmCTestTestHandler::COMPLETED
+ && result->Properties->AttachOnFail.size())
+ {
+ result->Properties->AttachedFiles.insert(
+ result->Properties->AttachedFiles.end(),
+ result->Properties->AttachOnFail.begin(),
+ result->Properties->AttachOnFail.end());
+ }
+ for(std::vector<std::string>::const_iterator file =
+ result->Properties->AttachedFiles.begin();
+ file != result->Properties->AttachedFiles.end(); ++file)
+ {
+ std::string base64 = this->EncodeFile(*file);
+ std::string fname = cmSystemTools::GetFilenameName(*file);
+ os << "\t\t<NamedMeasurement name=\"Attached File\" encoding=\"base64\" "
+ "compression=\"tar/gzip\" filename=\"" << fname << "\" type=\"file\">"
+ "\n\t\t\t<Value>\n\t\t\t"
+ << base64
+ << "\n\t\t\t</Value>\n\t\t</NamedMeasurement>\n";
+ }
+ }
+
+ //----------------------------------------------------------------------
+ std::string cmCTestTestHandler::EncodeFile(std::string file)
+ {
+ std::string tarFile = file + "_temp.tar.gz";
+ std::vector<cmStdString> files;
+ files.push_back(file);
+
+ if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false))
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Error creating tar while "
+ "attaching file: " << file << std::endl);
+ return "";
+ }
+ long len = cmSystemTools::FileLength(tarFile.c_str());
+ std::ifstream ifs(tarFile.c_str(), std::ios::in
+ #ifdef _WIN32
+ | std::ios::binary
+ #endif
+ );
+ unsigned char *file_buffer = new unsigned char [ len + 1 ];
+ ifs.read(reinterpret_cast<char*>(file_buffer), len);
+ ifs.close();
+ cmSystemTools::RemoveFile(tarFile.c_str());
+
+ unsigned char *encoded_buffer
+ = new unsigned char [ static_cast<int>(len * 1.5 + 5) ];
+
+ unsigned long rlen
+ = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);
+
+ std::string base64 = "";
+ for(unsigned long i = 0; i < rlen; i++)
+ {
+ base64 += encoded_buffer[i];
+ }
+ delete [] file_buffer;
+ delete [] encoded_buffer;
+
+ return base64;
+ }
+
+ //----------------------------------------------------------------------
int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)
{
***************
*** 1275,1279 ****
std::string filepath,
std::string &filename)
! {
std::string tempPath;
--- 1367,1371 ----
std::string filepath,
std::string &filename)
! {
std::string tempPath;
***************
*** 1986,1989 ****
--- 2078,2103 ----
rtit->WillFail = cmSystemTools::IsOn(val.c_str());
}
+ if ( key == "ATTACHED_FILES" )
+ {
+ std::vector<std::string> lval;
+ cmSystemTools::ExpandListArgument(val.c_str(), lval);
+
+ for(std::vector<std::string>::iterator f = lval.begin();
+ f != lval.end(); ++f)
+ {
+ rtit->AttachedFiles.push_back(*f);
+ }
+ }
+ if ( key == "ATTACHED_FILES_ON_FAIL" )
+ {
+ std::vector<std::string> lval;
+ cmSystemTools::ExpandListArgument(val.c_str(), lval);
+
+ for(std::vector<std::string>::iterator f = lval.begin();
+ f != lval.end(); ++f)
+ {
+ rtit->AttachOnFail.push_back(*f);
+ }
+ }
if ( key == "TIMEOUT" )
{
***************
*** 1994,1997 ****
--- 2108,2122 ----
rtit->Cost = static_cast<float>(atof(val.c_str()));
}
+ if ( key == "REQUIRED_FILES" )
+ {
+ std::vector<std::string> lval;
+ cmSystemTools::ExpandListArgument(val.c_str(), lval);
+
+ for(std::vector<std::string>::iterator f = lval.begin();
+ f != lval.end(); ++f)
+ {
+ rtit->RequiredFiles.push_back(*f);
+ }
+ }
if ( key == "RUN_SERIAL" )
{
***************
*** 2089,2092 ****
--- 2214,2218 ----
const std::string& testname = args[0];
cmCTestLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl);
+
if (this->UseExcludeRegExpFlag &&
this->UseExcludeRegExpFirst &&
Index: cmCTestBuildCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildCommand.h,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -C 2 -d -r1.9.2.1 -r1.9.2.2
*** cmCTestBuildCommand.h 1 Oct 2009 21:21:12 -0000 1.9.2.1
--- cmCTestBuildCommand.h 28 Jan 2010 21:48:01 -0000 1.9.2.2
***************
*** 83,86 ****
--- 83,90 ----
ctb_NUMBER_ERRORS,
ctb_NUMBER_WARNINGS,
+ ctb_TARGET,
+ ctb_CONFIGURATION,
+ ctb_FLAGS,
+ ctb_PROJECT_NAME,
ctb_LAST
};
Index: cmCTestRunTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestRunTest.h,v
retrieving revision 1.11.2.2
retrieving revision 1.11.2.3
diff -C 2 -d -r1.11.2.2 -r1.11.2.3
*** cmCTestRunTest.h 9 Oct 2009 20:11:27 -0000 1.11.2.2
--- cmCTestRunTest.h 28 Jan 2010 21:48:01 -0000 1.11.2.3
***************
*** 46,49 ****
--- 46,52 ----
bool CheckOutput();
+ // Compresses the output, writing to CompressedOutput
+ void CompressOutput();
+
//launch the test process, return whether it started correctly
bool StartTest(size_t total);
***************
*** 54,57 ****
--- 57,61 ----
private:
void DartProcessing();
+ void ExeNotFound(std::string exe);
bool CreateProcess(double testTimeOut,
std::vector<std::string>* environment);
***************
*** 72,78 ****
--- 76,88 ----
//flag for whether the env was modified for this run
bool ModifyEnv;
+
+ bool UsePrefixCommand;
+ std::string PrefixCommand;
+
//stores the original environment if we are modifying it
std::vector<std::string> OrigEnv;
std::string ProcessOutput;
+ std::string CompressedOutput;
+ double CompressionRatio;
//The test results
cmCTestTestHandler::cmCTestTestResult TestResult;
***************
*** 97,100 ****
--- 107,111 ----
return numWidth;
}
+
#endif
Index: cmCTestGlobalVC.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestGlobalVC.cxx,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C 2 -d -r1.1.2.1 -r1.1.2.2
*** cmCTestGlobalVC.cxx 1 Oct 2009 21:21:12 -0000 1.1.2.1
--- cmCTestGlobalVC.cxx 28 Jan 2010 21:48:01 -0000 1.1.2.2
***************
*** 108,111 ****
--- 108,124 ----
//----------------------------------------------------------------------------
+ void cmCTestGlobalVC::WriteXMLGlobal(std::ostream& xml)
+ {
+ if(!this->NewRevision.empty())
+ {
+ xml << "\t<Revision>" << this->NewRevision << "</Revision>\n";
+ }
+ if(!this->OldRevision.empty() && this->OldRevision != this->NewRevision)
+ {
+ xml << "\t<PriorRevision>" << this->OldRevision << "</PriorRevision>\n";
+ }
+ }
+
+ //----------------------------------------------------------------------------
bool cmCTestGlobalVC::WriteXMLUpdates(std::ostream& xml)
{
***************
*** 118,121 ****
--- 131,136 ----
this->LoadModifications();
+ this->WriteXMLGlobal(xml);
+
for(std::map<cmStdString, Directory>::const_iterator
di = this->Dirs.begin(); di != this->Dirs.end(); ++di)
Index: cmCTestSVN.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSVN.cxx,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C 2 -d -r1.8.2.1 -r1.8.2.2
*** cmCTestSVN.cxx 1 Oct 2009 21:21:13 -0000 1.8.2.1
--- cmCTestSVN.cxx 28 Jan 2010 21:48:01 -0000 1.8.2.2
***************
*** 441,442 ****
--- 441,450 ----
this->RunChild(svn_status, &out, &err);
}
+
+ //----------------------------------------------------------------------------
+ void cmCTestSVN::WriteXMLGlobal(std::ostream& xml)
+ {
+ this->cmCTestGlobalVC::WriteXMLGlobal(xml);
+
+ xml << "\t<SVNPath>" << this->Base << "</SVNPath>\n";
+ }
Index: cmCTestGIT.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestGIT.cxx,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C 2 -d -r1.2.2.1 -r1.2.2.2
*** cmCTestGIT.cxx 1 Oct 2009 21:21:12 -0000 1.2.2.1
--- cmCTestGIT.cxx 28 Jan 2010 21:48:01 -0000 1.2.2.2
***************
*** 20,23 ****
--- 20,25 ----
#include <cmsys/Process.h>
+ #include <sys/types.h>
+ #include <time.h>
#include <ctype.h>
***************
*** 337,350 ****
this->ParsePerson(this->Line.c_str()+7, author);
this->Rev.Author = author.Name;
! char buf[1024];
if(author.TimeZone >= 0)
{
! sprintf(buf, "%lu +%04ld", author.Time, author.TimeZone);
}
else
{
! sprintf(buf, "%lu -%04ld", author.Time, -author.TimeZone);
}
! this->Rev.Date = buf;
}
}
--- 339,364 ----
this->ParsePerson(this->Line.c_str()+7, author);
this->Rev.Author = author.Name;
!
! // Convert the time to a human-readable format that is also easy
! // to machine-parse: "CCYY-MM-DD hh:mm:ss".
! time_t seconds = static_cast<time_t>(author.Time);
! struct tm* t = gmtime(&seconds);
! char dt[1024];
! sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d",
! t->tm_year+1900, t->tm_mon+1, t->tm_mday,
! t->tm_hour, t->tm_min, t->tm_sec);
! this->Rev.Date = dt;
!
! // Add the time-zone field "+zone" or "-zone".
! char tz[32];
if(author.TimeZone >= 0)
{
! sprintf(tz, " +%04ld", author.TimeZone);
}
else
{
! sprintf(tz, " -%04ld", -author.TimeZone);
}
! this->Rev.Date += tz;
}
}
Index: cmCTestRunTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestRunTest.cxx,v
retrieving revision 1.22.2.3
retrieving revision 1.22.2.4
diff -C 2 -d -r1.22.2.3 -r1.22.2.4
*** cmCTestRunTest.cxx 28 Oct 2009 16:15:41 -0000 1.22.2.3
--- cmCTestRunTest.cxx 28 Jan 2010 21:48:01 -0000 1.22.2.4
***************
*** 16,19 ****
--- 16,22 ----
#include "cmSystemTools.h"
+ #include <cm_zlib.h>
+ #include <cmsys/Base64.h>
+
cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler)
{
***************
*** 24,30 ****
this->TestResult.ExecutionTime =0;
this->TestResult.ReturnValue = 0;
! this->TestResult.Status = 0;
this->TestResult.TestCount = 0;
this->TestResult.Properties = 0;
}
--- 27,36 ----
this->TestResult.ExecutionTime =0;
this->TestResult.ReturnValue = 0;
! this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
this->TestResult.TestCount = 0;
this->TestResult.Properties = 0;
+ this->ProcessOutput = "";
+ this->CompressedOutput = "";
+ this->CompressionRatio = 2;
}
***************
*** 53,57 ****
// Store this line of output.
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
! this->GetIndex() << ": " << line << std::endl);
this->ProcessOutput += line;
this->ProcessOutput += "\n";
--- 59,63 ----
// Store this line of output.
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
! this->GetIndex() << ": " << line << std::endl);
this->ProcessOutput += line;
this->ProcessOutput += "\n";
***************
*** 66,71 ****
--- 72,142 ----
//---------------------------------------------------------
+ // Streamed compression of test output. The compressed data
+ // is appended to this->CompressedOutput
+ void cmCTestRunTest::CompressOutput()
+ {
+ int ret;
+ z_stream strm;
+
+ unsigned char* in =
+ reinterpret_cast<unsigned char*>(
+ const_cast<char*>(this->ProcessOutput.c_str()));
+ //zlib makes the guarantee that this is the maximum output size
+ int outSize = static_cast<int>(this->ProcessOutput.size() * 1.001 + 13);
+ unsigned char* out = new unsigned char[outSize];
+
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+ ret = deflateInit(&strm, -1); //default compression level
+ if (ret != Z_OK)
+ {
+ return;
+ }
+
+ strm.avail_in = static_cast<uInt>(this->ProcessOutput.size());
+ strm.next_in = in;
+ strm.avail_out = outSize;
+ strm.next_out = out;
+ ret = deflate(&strm, Z_FINISH);
+
+ if(ret == Z_STREAM_ERROR || ret != Z_STREAM_END)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Error during output "
+ "compression. Sending uncompressed output." << std::endl);
+ return;
+ }
+
+ (void)deflateEnd(&strm);
+
+ unsigned char *encoded_buffer
+ = new unsigned char[static_cast<int>(outSize * 1.5)];
+
+ unsigned long rlen
+ = cmsysBase64_Encode(out, strm.total_out, encoded_buffer, 1);
+
+ for(unsigned long i = 0; i < rlen; i++)
+ {
+ this->CompressedOutput += encoded_buffer[i];
+ }
+
+ if(strm.total_in)
+ {
+ this->CompressionRatio = static_cast<double>(strm.total_out) /
+ static_cast<double>(strm.total_in);
+ }
+
+ delete [] encoded_buffer;
+ delete [] out;
+ }
+
+ //---------------------------------------------------------
bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
{
+ if (this->CTest->ShouldCompressTestOutput())
+ {
+ this->CompressOutput();
+ }
+
//restore the old environment
if (this->ModifyEnv)
***************
*** 147,151 ****
else if ( res == cmsysProcess_State_Expired )
{
! cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Timeout");
this->TestResult.Status = cmCTestTestHandler::TIMEOUT;
outputTestErrorsToConsole = this->CTest->OutputTestOutputOnTestFailure;
--- 218,222 ----
else if ( res == cmsysProcess_State_Expired )
{
! cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Timeout ");
this->TestResult.Status = cmCTestTestHandler::TIMEOUT;
outputTestErrorsToConsole = this->CTest->OutputTestOutputOnTestFailure;
***************
*** 178,185 ****
}
}
! else // if ( res == cmsysProcess_State_Error )
{
! cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Bad command " << res );
! this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND;
}
--- 249,255 ----
}
}
! else //cmsysProcess_State_Error
{
! cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Not Run ");
}
***************
*** 203,218 ****
if(!this->TestHandler->MemCheck && started)
{
- if (this->TestResult.Status == cmCTestTestHandler::COMPLETED)
- {
this->TestHandler->CleanTestOutput(this->ProcessOutput,
static_cast<size_t>
! (this->TestHandler->CustomMaximumPassedTestOutputSize));
! }
! else
! {
! this->TestHandler->CleanTestOutput(this->ProcessOutput,
! static_cast<size_t>
! (this->TestHandler->CustomMaximumFailedTestOutputSize));
! }
}
this->TestResult.Reason = reason;
--- 273,281 ----
if(!this->TestHandler->MemCheck && started)
{
this->TestHandler->CleanTestOutput(this->ProcessOutput,
static_cast<size_t>
! (this->TestResult.Status == cmCTestTestHandler::COMPLETED ?
! this->TestHandler->CustomMaximumPassedTestOutputSize :
! this->TestHandler->CustomMaximumFailedTestOutputSize));
}
this->TestResult.Reason = reason;
***************
*** 259,272 ****
<< std::endl << std::endl;
}
if(started)
{
! this->TestResult.Output = this->ProcessOutput;
this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
this->TestResult.CompletionStatus = "Completed";
this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
- this->TestHandler->TestResults.push_back(this->TestResult);
-
this->MemCheckPostProcess();
}
delete this->TestProcess;
return passed;
--- 322,342 ----
<< std::endl << std::endl;
}
+ // if the test actually started and ran
+ // record the results in TestResult
if(started)
{
! bool compress = this->CompressionRatio < 1 &&
! this->CTest->ShouldCompressTestOutput();
! this->TestResult.Output = compress ? this->CompressedOutput
! : this->ProcessOutput;
! this->TestResult.CompressOutput = compress;
this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
this->TestResult.CompletionStatus = "Completed";
this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
this->MemCheckPostProcess();
}
+ // Always push the current TestResult onto the
+ // TestHandler vector
+ this->TestHandler->TestResults.push_back(this->TestResult);
delete this->TestProcess;
return passed;
***************
*** 309,322 ****
this->TestResult.Properties = this->TestProperties;
this->TestResult.ExecutionTime = 0;
this->TestResult.ReturnValue = -1;
! this->TestResult.CompletionStatus = "Not Run";
! this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
this->TestResult.TestCount = this->TestProperties->Index;
this->TestResult.Name = this->TestProperties->Name;
this->TestResult.Path = this->TestProperties->Directory.c_str();
// log and return if we did not find the executable
if (this->ActualCommand == "")
{
this->TestProcess = new cmProcess;
*this->TestHandler->LogFile << "Unable to find executable: "
--- 379,417 ----
this->TestResult.Properties = this->TestProperties;
this->TestResult.ExecutionTime = 0;
+ this->TestResult.CompressOutput = false;
this->TestResult.ReturnValue = -1;
! this->TestResult.CompletionStatus = "Failed to start";
! this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND;
this->TestResult.TestCount = this->TestProperties->Index;
this->TestResult.Name = this->TestProperties->Name;
this->TestResult.Path = this->TestProperties->Directory.c_str();
+ // Check if all required files exist
+ for(std::vector<std::string>::iterator i =
+ this->TestProperties->RequiredFiles.begin();
+ i != this->TestProperties->RequiredFiles.end(); ++i)
+ {
+ std::string file = *i;
+
+ if(!cmSystemTools::FileExists(file.c_str()))
+ {
+ //Required file was not found
+ this->TestProcess = new cmProcess;
+ *this->TestHandler->LogFile << "Unable to find required file: "
+ << file.c_str() << std::endl;
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find required file: "
+ << file.c_str() << std::endl);
+ this->TestResult.Output = "Unable to find required file: " + file;
+ this->TestResult.FullCommandLine = "";
+ this->TestResult.CompletionStatus = "Not Run";
+ this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
+ return false;
+ }
+ }
// log and return if we did not find the executable
if (this->ActualCommand == "")
{
+ // if the command was not found create a TestResult object
+ // that has that information
this->TestProcess = new cmProcess;
*this->TestHandler->LogFile << "Unable to find executable: "
***************
*** 326,330 ****
this->TestResult.Output = "Unable to find executable: " + args[1];
this->TestResult.FullCommandLine = "";
! this->TestHandler->TestResults.push_back(this->TestResult);
return false;
}
--- 421,426 ----
this->TestResult.Output = "Unable to find executable: " + args[1];
this->TestResult.FullCommandLine = "";
! this->TestResult.CompletionStatus = "Not Run";
! this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
return false;
}
Index: cmCTestBuildHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildHandler.cxx,v
retrieving revision 1.75.2.2
retrieving revision 1.75.2.3
diff -C 2 -d -r1.75.2.2 -r1.75.2.3
*** cmCTestBuildHandler.cxx 9 Oct 2009 20:11:25 -0000 1.75.2.2
--- cmCTestBuildHandler.cxx 28 Jan 2010 21:48:01 -0000 1.75.2.3
***************
*** 266,269 ****
--- 266,295 ----
//----------------------------------------------------------------------
+ std::string cmCTestBuildHandler::GetMakeCommand()
+ {
+ std::string makeCommand
+ = this->CTest->GetCTestConfiguration("MakeCommand");
+ cmCTestLog(this->CTest,
+ HANDLER_VERBOSE_OUTPUT, "MakeCommand:" << makeCommand <<
+ "\n");
+
+ std::string configType = this->CTest->GetConfigType();
+ if (configType == "")
+ {
+ configType
+ = this->CTest->GetCTestConfiguration("DefaultCTestConfigurationType");
+ }
+ if (configType == "")
+ {
+ configType = "Release";
+ }
+
+ cmSystemTools::ReplaceString(makeCommand,
+ "${CTEST_CONFIGURATION_TYPE}", configType.c_str());
+
+ return makeCommand;
+ }
+
+ //----------------------------------------------------------------------
//clearly it would be nice if this were broken up into a few smaller
//functions and commented...
***************
*** 301,309 ****
// Determine build command and build directory
! const std::string &makeCommand
! = this->CTest->GetCTestConfiguration("MakeCommand");
! cmCTestLog(this->CTest,
! HANDLER_VERBOSE_OUTPUT, "MakeCommand:" << makeCommand <<
! "\n");
if ( makeCommand.size() == 0 )
{
--- 327,331 ----
// Determine build command and build directory
! std::string makeCommand = this->GetMakeCommand();
if ( makeCommand.size() == 0 )
{
***************
*** 313,316 ****
--- 335,339 ----
return -1;
}
+
const std::string &buildDirectory
= this->CTest->GetCTestConfiguration("BuildDirectory");
***************
*** 520,525 ****
<< "</StartBuildTime>\n"
<< "<BuildCommand>"
! << cmXMLSafe(
! this->CTest->GetCTestConfiguration("MakeCommand"))
<< "</BuildCommand>" << std::endl;
}
--- 543,547 ----
<< "</StartBuildTime>\n"
<< "<BuildCommand>"
! << cmXMLSafe(this->GetMakeCommand())
<< "</BuildCommand>" << std::endl;
}
Index: cmCTestTestHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.h,v
retrieving revision 1.49.2.1
retrieving revision 1.49.2.2
diff -C 2 -d -r1.49.2.1 -r1.49.2.2
*** cmCTestTestHandler.h 1 Oct 2009 21:21:13 -0000 1.49.2.1
--- cmCTestTestHandler.h 28 Jan 2010 21:48:02 -0000 1.49.2.2
***************
*** 85,89 ****
--- 85,92 ----
cmStdString Directory;
std::vector<std::string> Args;
+ std::vector<std::string> RequiredFiles;
std::vector<std::string> Depends;
+ std::vector<std::string> AttachedFiles;
+ std::vector<std::string> AttachOnFail;
std::vector<std::pair<cmsys::RegularExpression,
std::string> > ErrorRegularExpressions;
***************
*** 112,115 ****
--- 115,119 ----
int ReturnValue;
int Status;
+ bool CompressOutput;
std::string CompletionStatus;
std::string Output;
***************
*** 143,146 ****
--- 147,154 ----
void WriteTestResultHeader(std::ostream& os, cmCTestTestResult* result);
void WriteTestResultFooter(std::ostream& os, cmCTestTestResult* result);
+ // Write attached test files into the xml
+ void AttachFiles(std::ostream& os, cmCTestTestResult* result);
+ // Helper function to encode attached test files
+ std::string EncodeFile(std::string file);
//! Clean test output to specified length
Index: cmCTestConfigureCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestConfigureCommand.cxx,v
retrieving revision 1.12.2.1
retrieving revision 1.12.2.2
diff -C 2 -d -r1.12.2.1 -r1.12.2.2
*** cmCTestConfigureCommand.cxx 1 Oct 2009 21:21:12 -0000 1.12.2.1
--- cmCTestConfigureCommand.cxx 28 Jan 2010 21:48:01 -0000 1.12.2.2
***************
*** 12,15 ****
--- 12,16 ----
#include "cmCTestConfigureCommand.h"
+ #include "cmGlobalGenerator.h"
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
***************
*** 67,70 ****
--- 68,72 ----
const char* ctestConfigureCommand
= this->Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
+
if ( ctestConfigureCommand && *ctestConfigureCommand )
{
***************
*** 87,90 ****
--- 89,115 ----
return 0;
}
+
+ const std::string cmakelists_file = source_dir + "/CMakeLists.txt";
+ if ( !cmSystemTools::FileExists(cmakelists_file.c_str()) )
+ {
+ cmOStringStream e;
+ e << "CMakeLists.txt file does not exist ["
+ << cmakelists_file << "]";
+ this->SetError(e.str().c_str());
+ return 0;
+ }
+
+ bool multiConfig = false;
+ bool cmakeBuildTypeInOptions = false;
+
+ cmGlobalGenerator *gg =
+ this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
+ cmakeGeneratorName);
+ if(gg)
+ {
+ multiConfig = gg->IsMultiConfig();
+ delete gg;
+ }
+
std::string cmakeConfigureCommand = "\"";
cmakeConfigureCommand += this->CTest->GetCMakeExecutable();
***************
*** 96,102 ****
--- 121,141 ----
{
option = *it;
+
cmakeConfigureCommand += " \"";
cmakeConfigureCommand += option;
cmakeConfigureCommand += "\"";
+
+ if ((0 != strstr(option.c_str(), "CMAKE_BUILD_TYPE=")) ||
+ (0 != strstr(option.c_str(), "CMAKE_BUILD_TYPE:STRING=")))
+ {
+ cmakeBuildTypeInOptions = true;
+ }
+ }
+
+ if (!multiConfig && !cmakeBuildTypeInOptions)
+ {
+ cmakeConfigureCommand += " \"-DCMAKE_BUILD_TYPE:STRING=";
+ cmakeConfigureCommand += this->CTest->GetConfigType();
+ cmakeConfigureCommand += "\"";
}
***************
*** 114,120 ****
else
{
! this->SetError("Configure command is not specified. If this is a CMake "
! "project, specify CTEST_CMAKE_GENERATOR, or if this is not CMake "
! "project, specify CTEST_CONFIGURE_COMMAND.");
return 0;
}
--- 153,159 ----
else
{
! this->SetError("Configure command is not specified. If this is a "
! "\"built with CMake\" project, set CTEST_CMAKE_GENERATOR. If not, "
! "set CTEST_CONFIGURE_COMMAND.");
return 0;
}
More information about the Cmake-commits
mailing list