summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestHandlerCommand.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 14:34:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-16 20:05:19 (GMT)
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/CTest/cmCTestHandlerCommand.cxx
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadCMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Source/CTest/cmCTestHandlerCommand.cxx')
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx169
1 files changed, 74 insertions, 95 deletions
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 4b24a199..76f971d 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -19,10 +19,9 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
const size_t INIT_SIZE = 100;
size_t cc;
this->Arguments.reserve(INIT_SIZE);
- for ( cc = 0; cc < INIT_SIZE; ++ cc )
- {
+ for (cc = 0; cc < INIT_SIZE; ++cc) {
this->Arguments.push_back(0);
- }
+ }
this->Arguments[ct_RETURN_VALUE] = "RETURN_VALUE";
this->Arguments[ct_SOURCE] = "SOURCE";
this->Arguments[ct_BUILD] = "BUILD";
@@ -32,8 +31,8 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
this->Quiet = false;
}
-bool cmCTestHandlerCommand
-::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
+bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus&)
{
// Allocate space for argument values.
this->Values.clear();
@@ -41,24 +40,21 @@ bool cmCTestHandlerCommand
// Process input arguments.
this->ArgumentDoing = ArgumentDoingNone;
- for(unsigned int i=0; i < args.size(); ++i)
- {
+ for (unsigned int i = 0; i < args.size(); ++i) {
// Check this argument.
- if(!this->CheckArgumentKeyword(args[i]) &&
- !this->CheckArgumentValue(args[i]))
- {
+ if (!this->CheckArgumentKeyword(args[i]) &&
+ !this->CheckArgumentValue(args[i])) {
std::ostringstream e;
e << "called with unknown argument \"" << args[i] << "\".";
this->SetError(e.str());
return false;
- }
+ }
// Quit if an argument is invalid.
- if(this->ArgumentDoing == ArgumentDoingError)
- {
+ if (this->ArgumentDoing == ArgumentDoingError) {
return false;
- }
}
+ }
// Set the config type of this ctest to the current value of the
// CTEST_CONFIGURATION_TYPE script variable if it is defined.
@@ -66,94 +62,83 @@ bool cmCTestHandlerCommand
// line.
const char* ctestConfigType =
this->Makefile->GetDefinition("CTEST_CONFIGURATION_TYPE");
- if (ctestConfigType)
- {
+ if (ctestConfigType) {
this->CTest->SetConfigType(ctestConfigType);
- }
+ }
- if ( this->Values[ct_BUILD] )
- {
- this->CTest->SetCTestConfiguration("BuildDirectory",
- cmSystemTools::CollapseFullPath(
- this->Values[ct_BUILD]).c_str(), this->Quiet);
- }
- else
- {
+ if (this->Values[ct_BUILD]) {
+ this->CTest->SetCTestConfiguration(
+ "BuildDirectory",
+ cmSystemTools::CollapseFullPath(this->Values[ct_BUILD]).c_str(),
+ this->Quiet);
+ } else {
const char* bdir =
this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY");
- if(bdir)
- {
- this->
- CTest->SetCTestConfiguration("BuildDirectory",
- cmSystemTools::CollapseFullPath(bdir).c_str(), this->Quiet);
- }
- else
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "CTEST_BINARY_DIRECTORY not set" << std::endl;);
- }
- }
- if ( this->Values[ct_SOURCE] )
- {
- cmCTestLog(this->CTest, DEBUG,
- "Set source directory to: " << this->Values[ct_SOURCE] << std::endl);
- this->CTest->SetCTestConfiguration("SourceDirectory",
- cmSystemTools::CollapseFullPath(
- this->Values[ct_SOURCE]).c_str(), this->Quiet);
+ if (bdir) {
+ this->CTest->SetCTestConfiguration(
+ "BuildDirectory", cmSystemTools::CollapseFullPath(bdir).c_str(),
+ this->Quiet);
+ } else {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "CTEST_BINARY_DIRECTORY not set"
+ << std::endl;);
}
- else
- {
- this->CTest->SetCTestConfiguration("SourceDirectory",
+ }
+ if (this->Values[ct_SOURCE]) {
+ cmCTestLog(this->CTest, DEBUG, "Set source directory to: "
+ << this->Values[ct_SOURCE] << std::endl);
+ this->CTest->SetCTestConfiguration(
+ "SourceDirectory",
+ cmSystemTools::CollapseFullPath(this->Values[ct_SOURCE]).c_str(),
+ this->Quiet);
+ } else {
+ this->CTest->SetCTestConfiguration(
+ "SourceDirectory",
cmSystemTools::CollapseFullPath(
- this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")).c_str(),
+ this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY"))
+ .c_str(),
this->Quiet);
- }
+ }
- if(const char* changeId =
- this->Makefile->GetDefinition("CTEST_CHANGE_ID"))
- {
+ if (const char* changeId =
+ this->Makefile->GetDefinition("CTEST_CHANGE_ID")) {
this->CTest->SetCTestConfiguration("ChangeId", changeId, this->Quiet);
- }
+ }
cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;);
cmCTestGenericHandler* handler = this->InitializeHandler();
- if ( !handler )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Cannot instantiate test handler " << this->GetName()
- << std::endl);
+ if (!handler) {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot instantiate test handler "
+ << this->GetName() << std::endl);
return false;
- }
+ }
handler->SetAppendXML(this->AppendXML);
handler->PopulateCustomVectors(this->Makefile);
- if ( this->Values[ct_SUBMIT_INDEX] )
- {
- if(!this->CTest->GetDropSiteCDash() && this->CTest->GetDartVersion() <= 1)
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
+ if (this->Values[ct_SUBMIT_INDEX]) {
+ if (!this->CTest->GetDropSiteCDash() &&
+ this->CTest->GetDartVersion() <= 1) {
+ cmCTestLog(
+ this->CTest, ERROR_MESSAGE,
"Dart before version 2.0 does not support collecting submissions."
- << std::endl
- << "Please upgrade the server to Dart 2 or higher, or do not use "
- "SUBMIT_INDEX." << std::endl);
- }
- else
- {
+ << std::endl
+ << "Please upgrade the server to Dart 2 or higher, or do not use "
+ "SUBMIT_INDEX."
+ << std::endl);
+ } else {
handler->SetSubmitIndex(atoi(this->Values[ct_SUBMIT_INDEX]));
- }
}
+ }
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(
this->CTest->GetCTestConfiguration("BuildDirectory"));
int res = handler->ProcessHandler();
- if ( this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE])
- {
+ if (this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE]) {
std::ostringstream str;
str << res;
- this->Makefile->AddDefinition(
- this->Values[ct_RETURN_VALUE], str.str().c_str());
- }
+ this->Makefile->AddDefinition(this->Values[ct_RETURN_VALUE],
+ str.str().c_str());
+ }
cmSystemTools::ChangeDirectory(current_dir);
return true;
}
@@ -161,50 +146,44 @@ bool cmCTestHandlerCommand
bool cmCTestHandlerCommand::CheckArgumentKeyword(std::string const& arg)
{
// Look for non-value arguments common to all commands.
- if(arg == "APPEND")
- {
+ if (arg == "APPEND") {
this->ArgumentDoing = ArgumentDoingNone;
this->AppendXML = true;
return true;
- }
- if(arg == "QUIET")
- {
+ }
+ if (arg == "QUIET") {
this->ArgumentDoing = ArgumentDoingNone;
this->Quiet = true;
return true;
- }
+ }
// Check for a keyword in our argument/value table.
- for(unsigned int k=0; k < this->Arguments.size(); ++k)
- {
- if(this->Arguments[k] && arg == this->Arguments[k])
- {
+ for (unsigned int k = 0; k < this->Arguments.size(); ++k) {
+ if (this->Arguments[k] && arg == this->Arguments[k]) {
this->ArgumentDoing = ArgumentDoingKeyword;
this->ArgumentIndex = k;
return true;
- }
}
+ }
return false;
}
bool cmCTestHandlerCommand::CheckArgumentValue(std::string const& arg)
{
- if(this->ArgumentDoing == ArgumentDoingKeyword)
- {
+ if (this->ArgumentDoing == ArgumentDoingKeyword) {
this->ArgumentDoing = ArgumentDoingNone;
unsigned int k = this->ArgumentIndex;
- if(this->Values[k])
- {
+ if (this->Values[k]) {
std::ostringstream e;
e << "Called with more than one value for " << this->Arguments[k];
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
this->ArgumentDoing = ArgumentDoingError;
return true;
- }
+ }
this->Values[k] = arg.c_str();
- cmCTestLog(this->CTest, DEBUG, "Set " << this->Arguments[k]
- << " to " << arg << "\n");
+ cmCTestLog(this->CTest, DEBUG, "Set " << this->Arguments[k] << " to "
+ << arg << "\n");
return true;
- }
+ }
return false;
}