[Cmake-commits] [cmake-commits] david.cole committed cmCTestBuildCommand.cxx 1.22 1.23 cmCTestBuildHandler.cxx 1.77 1.78 cmCTestBuildHandler.h 1.17 1.18 cmCTestConfigureCommand.cxx 1.13 1.14 cmCTestHandlerCommand.cxx 1.17 1.18 cmCTestTestCommand.cxx 1.15 1.16
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Dec 4 12:08:59 EST 2009
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv26529/Source/CTest
Modified Files:
cmCTestBuildCommand.cxx cmCTestBuildHandler.cxx
cmCTestBuildHandler.h cmCTestConfigureCommand.cxx
cmCTestHandlerCommand.cxx cmCTestTestCommand.cxx
Log Message:
Fix issue #2336 - honor the -C arg to ctest. Honor it for all stages of running -D dashboards from the command line and running ctest_configure, ctest_build and ctest_test commands in -S scripts. Also, allow a script to change it by setting the CTEST_CONFIGURATION_TYPE variable: allows for multiple configuration build/test cycles within one script. Add a new signature for the cmake command build_command that accepts CONFIGURATION as one argument. The original build_command signature is still there, but now marked as deprecated in the documentation. Of course... also add CTestConfig tests to verify that -C is honored for -D dashboards and -S scripts.
Index: cmCTestConfigureCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestConfigureCommand.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -C 2 -d -r1.13 -r1.14
*** cmCTestConfigureCommand.cxx 28 Sep 2009 15:42:57 -0000 1.13
--- cmCTestConfigureCommand.cxx 4 Dec 2009 17:08:57 -0000 1.14
***************
*** 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,105 ----
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 ****
--- 111,131 ----
{
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;
}
--- 143,149 ----
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;
}
Index: cmCTestBuildCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildCommand.cxx,v
retrieving revision 1.22
retrieving revision 1.23
diff -C 2 -d -r1.22 -r1.23
*** cmCTestBuildCommand.cxx 3 Nov 2009 21:46:30 -0000 1.22
--- cmCTestBuildCommand.cxx 4 Dec 2009 17:08:57 -0000 1.23
***************
*** 54,57 ****
--- 54,58 ----
}
this->Handler = (cmCTestBuildHandler*)handler;
+
const char* ctestBuildCommand
= this->Makefile->GetDefinition("CTEST_BUILD_COMMAND");
***************
*** 68,75 ****
? this->Values[ctb_PROJECT_NAME]
: this->Makefile->GetDefinition("CTEST_PROJECT_NAME");
const char* cmakeBuildConfiguration
= (this->Values[ctb_CONFIGURATION] && *this->Values[ctb_CONFIGURATION])
? this->Values[ctb_CONFIGURATION]
! : this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
const char* cmakeBuildAdditionalFlags
= (this->Values[ctb_FLAGS] && *this->Values[ctb_FLAGS])
--- 69,87 ----
? 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])
***************
*** 118,122 ****
cmakeBuildConfiguration = config;
}
!
std::string buildCommand
= this->GlobalGenerator->
--- 130,134 ----
cmakeBuildConfiguration = config;
}
!
std::string buildCommand
= this->GlobalGenerator->
Index: cmCTestHandlerCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestHandlerCommand.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -C 2 -d -r1.17 -r1.18
*** cmCTestHandlerCommand.cxx 28 Sep 2009 15:43:01 -0000 1.17
--- cmCTestHandlerCommand.cxx 4 Dec 2009 17:08:57 -0000 1.18
***************
*** 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: cmCTestTestCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestCommand.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -C 2 -d -r1.15 -r1.16
*** cmCTestTestCommand.cxx 29 Oct 2009 19:30:12 -0000 1.15
--- cmCTestTestCommand.cxx 4 Dec 2009 17:08:57 -0000 1.16
***************
*** 34,37 ****
--- 34,38 ----
const char* ctestTimeout =
this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
+
double timeout = this->CTest->GetTimeOut();
if ( ctestTimeout )
***************
*** 105,107 ****
return this->CTest->GetInitializedHandler("test");
}
-
--- 106,107 ----
Index: cmCTestBuildHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildHandler.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C 2 -d -r1.17 -r1.18
*** cmCTestBuildHandler.h 28 Sep 2009 15:42:57 -0000 1.17
--- cmCTestBuildHandler.h 4 Dec 2009 17:08:57 -0000 1.18
***************
*** 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: cmCTestBuildHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildHandler.cxx,v
retrieving revision 1.77
retrieving revision 1.78
diff -C 2 -d -r1.77 -r1.78
*** cmCTestBuildHandler.cxx 1 Oct 2009 20:47:08 -0000 1.77
--- cmCTestBuildHandler.cxx 4 Dec 2009 17:08:57 -0000 1.78
***************
*** 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;
}
More information about the Cmake-commits
mailing list