summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2006-03-29 17:01:24 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2006-03-29 17:01:24 (GMT)
commit386900bfdd5836ccabeb0c050a6292c50aec79d6 (patch)
tree8316484c17eb5201a18f11ee8ff6245ae29ce365 /Source/CTest
parentb75166ea45173f8bc2cb9076f511a51b8112f61b (diff)
downloadCMake-386900bfdd5836ccabeb0c050a6292c50aec79d6.zip
CMake-386900bfdd5836ccabeb0c050a6292c50aec79d6.tar.gz
CMake-386900bfdd5836ccabeb0c050a6292c50aec79d6.tar.bz2
ENH: Several cleanups and make sure things get propagated where they should. Also, allow to load CTest custom files to the actual ctest -S script
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx64
-rw-r--r--Source/CTest/cmCTestBuildCommand.h15
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx24
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx117
-rw-r--r--Source/CTest/cmCTestConfigureCommand.h15
-rw-r--r--Source/CTest/cmCTestCoverageCommand.cxx68
-rw-r--r--Source/CTest/cmCTestCoverageCommand.h14
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx2
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx22
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx6
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx42
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h14
-rw-r--r--Source/CTest/cmCTestTestCommand.h14
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx10
-rw-r--r--Source/CTest/cmCTestUpdateCommand.cxx78
-rw-r--r--Source/CTest/cmCTestUpdateCommand.h14
16 files changed, 127 insertions, 392 deletions
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index b323881..5d19e0e 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -39,61 +39,8 @@ cmCTestBuildCommand::~cmCTestBuildCommand()
}
//----------------------------------------------------------------------------
-bool cmCTestBuildCommand::InitialPass(
- std::vector<std::string> const& args)
+cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
{
- const char* build_dir = 0;
- const char* res_var = 0;
-
- bool havereturn_variable = false;
- bool havesource = false;
- for(size_t i=0; i < args.size(); ++i)
- {
- if ( havereturn_variable )
- {
- res_var = args[i].c_str();
- havereturn_variable = false;
- }
- else if ( havesource )
- {
- build_dir = args[i].c_str();
- havesource = false;
- }
- else if(args[i] == "RETURN_VALUE")
- {
- if ( res_var )
- {
- this->SetError("called with incorrect number of arguments. "
- "RETURN_VALUE specified twice.");
- return false;
- }
- havereturn_variable = true;
- }
- else if(args[i] == "BUILD")
- {
- if ( build_dir )
- {
- this->SetError("called with incorrect number of arguments. "
- "BUILD specified twice.");
- return false;
- }
- havesource = true;
- }
- else
- {
- cmOStringStream str;
- str << "called with incorrect number of arguments. Extra argument is: "
- << args[i].c_str() << ".";
- this->SetError(str.str().c_str());
- return false;
- }
- }
-
- if ( build_dir )
- {
- this->CTest->SetCTestConfiguration("BuildDirectory", build_dir);
- }
-
cmCTestGenericHandler* handler
= this->CTest->GetInitializedHandler("build");
if ( !handler )
@@ -161,14 +108,7 @@ bool cmCTestBuildCommand::InitialPass(
}
}
- int res = handler->ProcessHandler();
- if ( res_var )
- {
- cmOStringStream str;
- str << res;
- this->Makefile->AddDefinition(res_var, str.str().c_str());
- }
- return true;
+ return handler;
}
diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h
index 3f4c87a..b4f16b7 100644
--- a/Source/CTest/cmCTestBuildCommand.h
+++ b/Source/CTest/cmCTestBuildCommand.h
@@ -17,7 +17,7 @@
#ifndef cmCTestBuildCommand_h
#define cmCTestBuildCommand_h
-#include "cmCTestCommand.h"
+#include "cmCTestHandlerCommand.h"
class cmGlobalGenerator;
@@ -26,7 +26,7 @@ class cmGlobalGenerator;
*
* cmCTestBuildCommand defineds the command to build the project.
*/
-class cmCTestBuildCommand : public cmCTestCommand
+class cmCTestBuildCommand : public cmCTestHandlerCommand
{
public:
@@ -45,12 +45,6 @@ public:
}
/**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- virtual bool InitialPass(std::vector<std::string> const& args);
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() { return "CTEST_BUILD";}
@@ -73,9 +67,12 @@ public:
"Builds the given build directory and stores results in Build.xml.";
}
- cmTypeMacro(cmCTestBuildCommand, cmCTestCommand);
+ cmTypeMacro(cmCTestBuildCommand, cmCTestHandlerCommand);
cmGlobalGenerator* GlobalGenerator;
+
+protected:
+ cmCTestGenericHandler* InitializeHandler();
};
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 0b7b502..e1011da 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -222,18 +222,18 @@ void cmCTestBuildHandler::Initialize()
//----------------------------------------------------------------------
void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile *mf)
{
- cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_ERROR_MATCH",
- this->CustomErrorMatches);
- cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_ERROR_EXCEPTION",
- this->CustomErrorExceptions);
- cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_WARNING_MATCH",
- this->CustomWarningMatches);
- cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_WARNING_EXCEPTION",
- this->CustomWarningExceptions);
- cmCTest::PopulateCustomInteger(mf,
- "CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS",
- this->MaxErrors);
- cmCTest::PopulateCustomInteger(mf,
+ this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_ERROR_MATCH",
+ this->CustomErrorMatches);
+ this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_ERROR_EXCEPTION",
+ this->CustomErrorExceptions);
+ this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_WARNING_MATCH",
+ this->CustomWarningMatches);
+ this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_WARNING_EXCEPTION",
+ this->CustomWarningExceptions);
+ this->CTest->PopulateCustomInteger(mf,
+ "CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS",
+ this->MaxErrors);
+ this->CTest->PopulateCustomInteger(mf,
"CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS",
this->MaxWarnings);
}
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index 2d5a16f..829f4a5 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -19,98 +19,35 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
-bool cmCTestConfigureCommand::InitialPass(
- std::vector<std::string> const& args)
+cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
{
- const char* source_dir = 0;
- const char* build_dir = 0;
- const char* res_var = 0;
-
- bool havereturn_variable = false;
- bool havesource = false;
- bool havebuild = false;
- for(size_t i=0; i < args.size(); ++i)
- {
- if ( havereturn_variable )
- {
- res_var = args[i].c_str();
- havereturn_variable = false;
- }
- else if ( havebuild )
- {
- build_dir = args[i].c_str();
- havebuild = false;
- }
- else if ( havesource )
- {
- source_dir = args[i].c_str();
- havesource = false;
- }
- else if(args[i] == "RETURN_VALUE")
- {
- if ( res_var )
- {
- this->SetError("called with incorrect number of arguments. "
- "RETURN_VALUE specified twice.");
- return false;
- }
- havereturn_variable = true;
- }
- else if(args[i] == "SOURCE")
- {
- if ( source_dir )
- {
- this->SetError("called with incorrect number of arguments. "
- "SOURCE specified twice.");
- return false;
- }
- havesource = true;
- }
- else if(args[i] == "BUILD")
- {
- if ( build_dir )
- {
- this->SetError("called with incorrect number of arguments. "
- "BUILD specified twice.");
- return false;
- }
- havebuild = true;
- }
- else
- {
- cmOStringStream str;
- str << "called with incorrect number of arguments. Extra argument is: "
- << args[i].c_str() << ".";
- this->SetError(str.str().c_str());
- return false;
- }
- }
-
- if ( source_dir )
+ if ( this->Values[ct_BUILD] )
{
- this->CTest->SetCTestConfiguration("SourceDirectory", source_dir);
+ this->CTest->SetCTestConfiguration("BuildDirectory",
+ this->Values[ct_BUILD]);
}
else
{
- source_dir = this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY");
+ this->CTest->SetCTestConfiguration("BuildDirectory",
+ this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY"));
}
-
- if ( build_dir )
+ if ( this->Values[ct_SOURCE] )
{
- this->CTest->SetCTestConfiguration("BuildDirectory", build_dir);
+ this->CTest->SetCTestConfiguration("SourceDirectory",
+ this->Values[ct_SOURCE]);
}
else
{
- build_dir = this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY");
- if ( !build_dir )
- {
- this->SetError("Build directory not specified. Either use BUILD "
- "argument to CTEST_CONFIGURE command or set CTEST_BINARY_DIRECTORY "
- "variable");
- return false;
- }
+ this->CTest->SetCTestConfiguration("SourceDirectory",
+ this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"));
+ }
+ if ( this->CTest->GetCTestConfiguration("BuildDirectory").empty() )
+ {
+ this->SetError("Build directory not specified. Either use BUILD "
+ "argument to CTEST_CONFIGURE command or set CTEST_BINARY_DIRECTORY "
+ "variable");
+ return false;
}
-
const char* ctestConfigureCommand
= this->Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
@@ -125,6 +62,15 @@ bool cmCTestConfigureCommand::InitialPass(
= this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
if ( cmakeGeneratorName && *cmakeGeneratorName )
{
+ const std::string& source_dir
+ = this->CTest->GetCTestConfiguration("SourceDirectory");
+ if ( source_dir.empty() )
+ {
+ this->SetError("Source directory not specified. Either use SOURCE "
+ "argument to CTEST_CONFIGURE command or set CTEST_SOURCE_DIRECTORY "
+ "variable");
+ return false;
+ }
std::string cmakeConfigureCommand = "\"";
cmakeConfigureCommand += this->CTest->GetCMakeExecutable();
cmakeConfigureCommand += "\" \"-G";
@@ -152,14 +98,7 @@ bool cmCTestConfigureCommand::InitialPass(
"internal CTest error. Cannot instantiate configure handler");
return false;
}
- int res = handler->ProcessHandler();
- if ( res_var )
- {
- cmOStringStream str;
- str << res;
- this->Makefile->AddDefinition(res_var, str.str().c_str());
- }
- return true;
+ return handler;
}
diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h
index 34b9a4d..f5282d9 100644
--- a/Source/CTest/cmCTestConfigureCommand.h
+++ b/Source/CTest/cmCTestConfigureCommand.h
@@ -17,14 +17,14 @@
#ifndef cmCTestConfigureCommand_h
#define cmCTestConfigureCommand_h
-#include "cmCTestCommand.h"
+#include "cmCTestHandlerCommand.h"
/** \class cmCTestConfigure
* \brief Run a ctest script
*
* cmCTestConfigureCommand defineds the command to configures the project.
*/
-class cmCTestConfigureCommand : public cmCTestCommand
+class cmCTestConfigureCommand : public cmCTestHandlerCommand
{
public:
@@ -42,12 +42,6 @@ public:
}
/**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- virtual bool InitialPass(std::vector<std::string> const& args);
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() { return "CTEST_CONFIGURE";}
@@ -72,7 +66,10 @@ public:
"return value.";
}
- cmTypeMacro(cmCTestConfigureCommand, cmCTestCommand);
+ cmTypeMacro(cmCTestConfigureCommand, cmCTestHandlerCommand);
+
+protected:
+ cmCTestGenericHandler* InitializeHandler();
};
diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx
index c70c4cf..b97e0b2 100644
--- a/Source/CTest/cmCTestCoverageCommand.cxx
+++ b/Source/CTest/cmCTestCoverageCommand.cxx
@@ -19,61 +19,8 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
-bool cmCTestCoverageCommand::InitialPass(
- std::vector<std::string> const& args)
+cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
{
- const char* build_dir = 0;
- const char* res_var = 0;
-
- bool havereturn_variable = false;
- bool havesource = false;
- for(size_t i=0; i < args.size(); ++i)
- {
- if ( havereturn_variable )
- {
- res_var = args[i].c_str();
- havereturn_variable = false;
- }
- else if ( havesource )
- {
- build_dir = args[i].c_str();
- havesource = false;
- }
- else if(args[i] == "RETURN_VALUE")
- {
- if ( res_var )
- {
- this->SetError("called with incorrect number of arguments. "
- "RETURN_VALUE specified twice.");
- return false;
- }
- havereturn_variable = true;
- }
- else if(args[i] == "BUILD")
- {
- if ( build_dir )
- {
- this->SetError("called with incorrect number of arguments. "
- "BUILD specified twice.");
- return false;
- }
- havesource = true;
- }
- else
- {
- cmOStringStream str;
- str << "called with incorrect number of arguments. Extra argument is: "
- << args[i].c_str() << ".";
- this->SetError(str.str().c_str());
- return false;
- }
- }
-
- if ( build_dir )
- {
- this->CTest->SetCTestConfiguration("BuildDirectory", build_dir);
- }
-
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
"CoverageCommand", "CTEST_COVERAGE_COMMAND");
@@ -84,18 +31,7 @@ bool cmCTestCoverageCommand::InitialPass(
this->SetError("internal CTest error. Cannot instantiate test handler");
return false;
}
- std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
- cmSystemTools::ChangeDirectory(
- this->CTest->GetCTestConfiguration("BuildDirectory").c_str());
- int res = handler->ProcessHandler();
- if ( res_var )
- {
- cmOStringStream str;
- str << res;
- this->Makefile->AddDefinition(res_var, str.str().c_str());
- }
- cmSystemTools::ChangeDirectory(current_dir.c_str());
- return true;
+ return handler;
}
diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h
index afc2879..7007b18 100644
--- a/Source/CTest/cmCTestCoverageCommand.h
+++ b/Source/CTest/cmCTestCoverageCommand.h
@@ -17,14 +17,14 @@
#ifndef cmCTestCoverageCommand_h
#define cmCTestCoverageCommand_h
-#include "cmCTestCommand.h"
+#include "cmCTestHandlerCommand.h"
/** \class cmCTestCoverage
* \brief Run a ctest script
*
* cmCTestCoverageCommand defineds the command to test the project.
*/
-class cmCTestCoverageCommand : public cmCTestCommand
+class cmCTestCoverageCommand : public cmCTestHandlerCommand
{
public:
@@ -42,12 +42,6 @@ public:
}
/**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- virtual bool InitialPass(std::vector<std::string> const& args);
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() { return "CTEST_COVERAGE";}
@@ -72,8 +66,10 @@ public:
"value.";
}
- cmTypeMacro(cmCTestCoverageCommand, cmCTestCommand);
+ cmTypeMacro(cmCTestCoverageCommand, cmCTestHandlerCommand);
+protected:
+ cmCTestGenericHandler* InitializeHandler();
};
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 11424b9..30187e8 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -836,7 +836,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Add coverage exclude regular expressions." << std::endl);
- cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE",
+ this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE",
this->CustomCoverageExclude);
std::vector<cmStdString>::iterator it;
for ( it = this->CustomCoverageExclude.begin();
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 10d58ae..25662cb 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -44,6 +44,7 @@ bool cmCTestHandlerCommand::InitialPass(
return false;
}
+ cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;);
cmCTestGenericHandler* handler = this->InitializeHandler();
if ( !handler )
{
@@ -51,11 +52,31 @@ bool cmCTestHandlerCommand::InitialPass(
return false;
}
+ cmCTestLog(this->CTest, DEBUG, "Populate Custom Vectors" << std::endl;);
+ handler->PopulateCustomVectors(this->Makefile);
+
if ( this->Values[ct_BUILD] )
{
this->CTest->SetCTestConfiguration("BuildDirectory",
this->Values[ct_BUILD]);
}
+ else
+ {
+ this->CTest->SetCTestConfiguration("BuildDirectory",
+ this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY"));
+ }
+ if ( this->Values[ct_SOURCE] )
+ {
+ cmCTestLog(this->CTest, DEBUG,
+ "Set source directory to: " << this->Values[ct_SOURCE] << std::endl);
+ this->CTest->SetCTestConfiguration("SourceDirectory",
+ this->Values[ct_SOURCE]);
+ }
+ else
+ {
+ this->CTest->SetCTestConfiguration("SourceDirectory",
+ this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"));
+ }
if ( this->Values[ct_SUBMIT_INDEX] )
{
if ( this->CTest->GetDartVersion() <= 1 )
@@ -72,7 +93,6 @@ bool cmCTestHandlerCommand::InitialPass(
}
}
-
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(
this->CTest->GetCTestConfiguration("BuildDirectory").c_str());
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 76ed378..51954ba 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -161,12 +161,12 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf)
{
this->cmCTestTestHandler::PopulateCustomVectors(mf);
- cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_MEMCHECK",
+ this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_MEMCHECK",
this->CustomPreMemCheck);
- cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_POST_MEMCHECK",
+ this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_POST_MEMCHECK",
this->CustomPostMemCheck);
- cmCTest::PopulateCustomVector(mf,
+ this->CTest->PopulateCustomVector(mf,
"CTEST_CUSTOM_MEMCHECK_IGNORE",
this->CustomTestsIgnore);
}
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 5663bc4..a85c33e 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -19,39 +19,8 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
-bool cmCTestSubmitCommand::InitialPass(
- std::vector<std::string> const& args)
+cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
{
- const char* res_var = 0;
-
- bool havereturn_variable = false;
- for(size_t i=0; i < args.size(); ++i)
- {
- if ( havereturn_variable )
- {
- res_var = args[i].c_str();
- havereturn_variable = false;
- }
- else if(args[i] == "RETURN_VALUE")
- {
- if ( res_var )
- {
- this->SetError("called with incorrect number of arguments. "
- "RETURN_VALUE specified twice.");
- return false;
- }
- havereturn_variable = true;
- }
- else
- {
- cmOStringStream str;
- str << "called with incorrect number of arguments. Extra argument is: "
- << args[i].c_str() << ".";
- this->SetError(str.str().c_str());
- return false;
- }
- }
-
const char* ctestDropMethod
= this->Makefile->GetDefinition("CTEST_DROP_METHOD");
const char* ctestDropSite
@@ -137,14 +106,7 @@ bool cmCTestSubmitCommand::InitialPass(
this->SetError("internal CTest error. Cannot instantiate submit handler");
return false;
}
- int res = handler->ProcessHandler();
- if ( res_var )
- {
- cmOStringStream str;
- str << res;
- this->Makefile->AddDefinition(res_var, str.str().c_str());
- }
- return true;
+ return handler;
}
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index a683781..819a140 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -17,7 +17,7 @@
#ifndef cmCTestSubmitCommand_h
#define cmCTestSubmitCommand_h
-#include "cmCTestCommand.h"
+#include "cmCTestHandlerCommand.h"
/** \class cmCTestSubmit
* \brief Run a ctest script
@@ -25,7 +25,7 @@
* cmCTestSubmitCommand defineds the command to submit the test results for
* the project.
*/
-class cmCTestSubmitCommand : public cmCTestCommand
+class cmCTestSubmitCommand : public cmCTestHandlerCommand
{
public:
@@ -43,12 +43,6 @@ public:
}
/**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- virtual bool InitialPass(std::vector<std::string> const& args);
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() { return "CTEST_SUBMIT";}
@@ -71,8 +65,10 @@ public:
"Submits the test results for the project.";
}
- cmTypeMacro(cmCTestSubmitCommand, cmCTestCommand);
+ cmTypeMacro(cmCTestSubmitCommand, cmCTestHandlerCommand);
+protected:
+ cmCTestGenericHandler* InitializeHandler();
};
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index 8831fc3..895de00 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
@@ -19,8 +19,6 @@
#include "cmCTestHandlerCommand.h"
-class cmCTestGenericHandler;
-
/** \class cmCTestTest
* \brief Run a ctest script
*
@@ -31,11 +29,11 @@ class cmCTestTestCommand : public cmCTestHandlerCommand
public:
cmCTestTestCommand();
-
+
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ virtual cmCommand* Clone()
{
cmCTestTestCommand* ni = new cmCTestTestCommand;
ni->CTest = this->CTest;
@@ -51,11 +49,11 @@ public:
/**
* Succinct documentation.
*/
- virtual const char* GetTerseDocumentation()
+ virtual const char* GetTerseDocumentation()
{
return "Tests the repository.";
}
-
+
/**
* More documentation.
*/
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 30b0abb..9e2b3b1 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -385,17 +385,17 @@ void cmCTestTestHandler::Initialize()
//----------------------------------------------------------------------
void cmCTestTestHandler::PopulateCustomVectors(cmMakefile *mf)
{
- cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_TEST",
+ this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_TEST",
this->CustomPreTest);
- cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_POST_TEST",
+ this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_POST_TEST",
this->CustomPostTest);
- cmCTest::PopulateCustomVector(mf,
+ this->CTest->PopulateCustomVector(mf,
"CTEST_CUSTOM_TESTS_IGNORE",
this->CustomTestsIgnore);
- cmCTest::PopulateCustomInteger(mf,
+ this->CTest->PopulateCustomInteger(mf,
"CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE",
this->CustomMaximumPassedTestOutputSize);
- cmCTest::PopulateCustomInteger(mf,
+ this->CTest->PopulateCustomInteger(mf,
"CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE",
this->CustomMaximumFailedTestOutputSize);
}
diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx
index 94a79b9..2e523fe 100644
--- a/Source/CTest/cmCTestUpdateCommand.cxx
+++ b/Source/CTest/cmCTestUpdateCommand.cxx
@@ -19,55 +19,20 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
-bool cmCTestUpdateCommand::InitialPass(
- std::vector<std::string> const& args)
+cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
{
- const char* source_dir = 0;
- const char* res_var = 0;
-
- bool havereturn_variable = false;
- bool havesource = false;
- for(size_t i=0; i < args.size(); ++i)
+ if ( this->Values[ct_SOURCE] )
{
- if ( havereturn_variable )
- {
- res_var = args[i].c_str();
- havereturn_variable = false;
- }
- else if ( havesource )
- {
- source_dir = args[i].c_str();
- havesource = false;
- }
- else if(args[i] == "RETURN_VALUE")
- {
- if ( res_var )
- {
- this->SetError("called with incorrect number of arguments. "
- "RETURN_VALUE specified twice.");
- return false;
- }
- havereturn_variable = true;
- }
- else if(args[i] == "SOURCE")
- {
- if ( source_dir )
- {
- this->SetError("called with incorrect number of arguments. SOURCE "
- "specified twice.");
- return false;
- }
- havesource = true;
- }
- else
- {
- cmOStringStream str;
- str << "called with incorrect number of arguments. Extra argument is: "
- << args[i].c_str() << ".";
- this->SetError(str.str().c_str());
- return false;
- }
+ this->CTest->SetCTestConfiguration("SourceDirectory",
+ this->Values[ct_SOURCE]);
+ }
+ else
+ {
+ this->CTest->SetCTestConfiguration("SourceDirectory",
+ this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"));
}
+ std::string source_dir
+ = this->CTest->GetCTestConfiguration("SourceDirectory");
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
"UpdateCommand", "CTEST_UPDATE_COMMAND");
@@ -97,22 +62,23 @@ bool cmCTestUpdateCommand::InitialPass(
return false;
}
handler->SetCommand(this);
- if ( !source_dir )
+ if ( source_dir.empty() )
{
this->SetError("source directory not specified. Please use SOURCE tag");
return false;
}
+ handler->SetOption("SourceDirectory", source_dir.c_str());
if ( initialCheckoutCommand )
{
handler->SetOption("InitialCheckout", initialCheckoutCommand);
}
- if ( (!cmSystemTools::FileExists(source_dir) ||
- !cmSystemTools::FileIsDirectory(source_dir))
+ if ( (!cmSystemTools::FileExists(source_dir.c_str()) ||
+ !cmSystemTools::FileIsDirectory(source_dir.c_str()))
&& !initialCheckoutCommand )
{
cmOStringStream str;
- str << "cannot find source directory: " << source_dir << ".";
- if ( !cmSystemTools::FileExists(source_dir) )
+ 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.";
@@ -120,15 +86,7 @@ bool cmCTestUpdateCommand::InitialPass(
this->SetError(str.str().c_str());
return false;
}
- handler->SetOption("SourceDirectory", source_dir);
- int res = handler->ProcessHandler();
- if ( res_var )
- {
- cmOStringStream str;
- str << res;
- this->Makefile->AddDefinition(res_var, str.str().c_str());
- }
- return true;
+ return handler;
}
diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h
index cad95c4..a93b05a 100644
--- a/Source/CTest/cmCTestUpdateCommand.h
+++ b/Source/CTest/cmCTestUpdateCommand.h
@@ -17,14 +17,14 @@
#ifndef cmCTestUpdateCommand_h
#define cmCTestUpdateCommand_h
-#include "cmCTestCommand.h"
+#include "cmCTestHandlerCommand.h"
/** \class cmCTestUpdate
* \brief Run a ctest script
*
* cmCTestUpdateCommand defineds the command to updates the repository.
*/
-class cmCTestUpdateCommand : public cmCTestCommand
+class cmCTestUpdateCommand : public cmCTestHandlerCommand
{
public:
@@ -42,12 +42,6 @@ public:
}
/**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- virtual bool InitialPass(std::vector<std::string> const& args);
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() { return "CTEST_UPDATE";}
@@ -72,8 +66,10 @@ public:
"modified. If there is a problem, the variable will be -1.";
}
- cmTypeMacro(cmCTestUpdateCommand, cmCTestCommand);
+ cmTypeMacro(cmCTestUpdateCommand, cmCTestHandlerCommand);
+protected:
+ cmCTestGenericHandler* InitializeHandler();
};