Commit 6503a0ee authored by Andy Cedilnik's avatar Andy Cedilnik
Browse files

STYLE: Fix some style issues

parent 10d1b207
......@@ -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.
=========================================================================*/
......@@ -55,9 +55,9 @@ int cmCTestBuildAndTestHandler::ProcessHandler()
}
//----------------------------------------------------------------------
int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, cmOStringStream &out,
std::string &cmakeOutString, std::string &cwd,
cmake *cm)
int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
cmOStringStream &out, std::string &cmakeOutString, std::string &cwd,
cmake *cm)
{
unsigned int k;
std::vector<std::string> args;
......@@ -71,7 +71,8 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, cmOStringStream
}
if ( m_CTest->GetConfigType().size() > 0 )
{
std::string btype = "-DCMAKE_BUILD_TYPE:STRING=" + m_CTest->GetConfigType();
std::string btype
= "-DCMAKE_BUILD_TYPE:STRING=" + m_CTest->GetConfigType();
args.push_back(btype);
}
......@@ -114,7 +115,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, cmOStringStream
}
return 1;
}
}
}
return 0;
}
......@@ -135,7 +136,7 @@ void CMakeStdoutCallback(const char* m, int len, void* s)
//----------------------------------------------------------------------
int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
{
{
unsigned int k;
std::string cmakeOutString;
cmSystemTools::SetErrorCallback(CMakeMessageCallback, &cmakeOutString);
......@@ -143,23 +144,23 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
cmOStringStream out;
// What is this? double timeout = m_CTest->GetTimeOut();
int retVal = 0;
// if the generator and make program are not specified then it is an error
if (!m_BuildGenerator.size() || !m_BuildMakeProgram.size())
{
if(outstring)
{
*outstring =
*outstring =
"--build-and-test requires that both the generator and makeprogram "
"be provided using the --build-generator and --build-makeprogram "
"command line options. ";
}
return 1;
}
// make sure the binary dir is there
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
out << "Internal cmake changing into directory: " << m_BinaryDir << "\n";
out << "Internal cmake changing into directory: " << m_BinaryDir << "\n";
if (!cmSystemTools::FileIsDirectory(m_BinaryDir.c_str()))
{
cmSystemTools::MakeDirectory(m_BinaryDir.c_str());
......@@ -169,7 +170,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
// should we cmake?
cmake cm;
cm.SetGlobalGenerator(cm.CreateGlobalGenerator(m_BuildGenerator.c_str()));
if(!m_BuildNoCMake)
{
// do the cmake step
......@@ -210,20 +211,20 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
{
*outstring = out.str();
}
// if not test was specified then we are done
if (!m_TestCommand.size())
{
return 0;
}
// now run the compiled test if we can find it
std::vector<std::string> attempted;
std::vector<std::string> failed;
std::string tempPath;
std::string filepath =
std::string filepath =
cmSystemTools::GetFilenamePath(m_TestCommand);
std::string filename =
std::string filename =
cmSystemTools::GetFilenameName(m_TestCommand);
// if full path specified then search that first
if (filepath.size())
......@@ -282,9 +283,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
// store the final location in fullPath
std::string fullPath;
// now look in the paths we specified above
for(unsigned int ai=0;
for(unsigned int ai=0;
ai < attempted.size() && fullPath.size() == 0; ++ai)
{
// first check without exe extension
......@@ -396,7 +397,8 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "--build-and-test must have source and binary dir" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"--build-and-test must have source and binary dir" << std::endl);
return 0;
}
}
......@@ -433,7 +435,8 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
idx++;
m_BuildProject = allArgs[idx];
}
if(currentArg.find("--build-makeprogram",0) == 0 && idx < allArgs.size() - 1)
if(currentArg.find("--build-makeprogram",0) == 0 &&
idx < allArgs.size() - 1)
{
idx++;
m_BuildMakeProgram = allArgs[idx];
......@@ -449,8 +452,9 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
while(idx < allArgs.size() && !done)
{
m_BuildOptions.push_back(allArgs[idx]);
if(idx+1 < allArgs.size()
&& (allArgs[idx+1] == "--build-target" || allArgs[idx+1] == "--test-command"))
if(idx+1 < allArgs.size()
&& (allArgs[idx+1] == "--build-target" ||
allArgs[idx+1] == "--test-command"))
{
done = true;
}
......
......@@ -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.
=========================================================================*/
......@@ -63,16 +63,18 @@ bool cmCTestBuildCommand::InitialPass(
{
if ( res_var )
{
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
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.");
this->SetError("called with incorrect number of arguments. "
"BUILD specified twice.");
return false;
}
havesource = true;
......@@ -80,7 +82,8 @@ bool cmCTestBuildCommand::InitialPass(
else
{
cmOStringStream str;
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
str << "called with incorrect number of arguments. Extra argument is: "
<< args[i].c_str() << ".";
this->SetError(str.str().c_str());
return false;
}
......@@ -97,18 +100,23 @@ bool cmCTestBuildCommand::InitialPass(
this->SetError("internal CTest error. Cannot instantiate build handler");
return false;
}
const char* ctestBuildCommand = m_Makefile->GetDefinition("CTEST_BUILD_COMMAND");
const char* ctestBuildCommand
= m_Makefile->GetDefinition("CTEST_BUILD_COMMAND");
if ( ctestBuildCommand && *ctestBuildCommand )
{
m_CTest->SetCTestConfiguration("MakeCommand", ctestBuildCommand);
}
else
{
const char* cmakeGeneratorName = m_Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
const char* cmakeProjectName = m_Makefile->GetDefinition("CTEST_PROJECT_NAME");
const char* cmakeBuildConfiguration = m_Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
const char* cmakeBuildAdditionalFlags = m_Makefile->GetDefinition("CTEST_BUILD_FLAGS");
const char* cmakeGeneratorName
= m_Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
const char* cmakeProjectName
= m_Makefile->GetDefinition("CTEST_PROJECT_NAME");
const char* cmakeBuildConfiguration
= m_Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
const char* cmakeBuildAdditionalFlags
= m_Makefile->GetDefinition("CTEST_BUILD_FLAGS");
if ( cmakeGeneratorName && *cmakeGeneratorName &&
cmakeProjectName && *cmakeProjectName )
{
......@@ -126,25 +134,31 @@ bool cmCTestBuildCommand::InitialPass(
}
if ( !m_GlobalGenerator )
{
m_GlobalGenerator =
m_Makefile->GetCMakeInstance()->CreateGlobalGenerator(cmakeGeneratorName);
m_GlobalGenerator =
m_Makefile->GetCMakeInstance()->CreateGlobalGenerator(
cmakeGeneratorName);
}
m_GlobalGenerator->FindMakeProgram(m_Makefile);
const char* cmakeMakeProgram = m_Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
const char* cmakeMakeProgram
= m_Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
std::string buildCommand
= m_GlobalGenerator->GenerateBuildCommand(cmakeMakeProgram, cmakeProjectName,
= m_GlobalGenerator->GenerateBuildCommand(cmakeMakeProgram,
cmakeProjectName,
cmakeBuildAdditionalFlags, 0, cmakeBuildConfiguration, true);
m_CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str());
}
else
{
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.";
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 false;
}
}
int res = handler->ProcessHandler();
if ( res_var )
{
......
This diff is collapsed.
......@@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc. 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.
=========================================================================*/
......@@ -39,21 +39,21 @@ public:
* The main entry point for this class
*/
int ProcessHandler();
cmCTestBuildHandler();
void PopulateCustomVectors(cmMakefile *mf);
/**
* Initialize handler
*/
virtual void Initialize();
private:
//! Run command specialized for make and configure. Returns process status
// and retVal is return value or exception.
int RunMakeCommand(const char* command,
int* retVal, const char* dir, int timeout,
int* retVal, const char* dir, int timeout,
std::ofstream& ofs);
enum {
......@@ -84,14 +84,14 @@ private:
};
// generate the XML output
void GenerateDartBuildOutput(std::ostream& os,
void GenerateDartBuildOutput(std::ostream& os,
std::vector<cmCTestBuildErrorWarning>,
double elapsed_time);
std::string m_StartBuild;
std::string m_EndBuild;
std::vector<cmStdString> m_CustomErrorMatches;
std::vector<cmStdString> m_CustomErrorExceptions;
std::vector<cmStdString> m_CustomWarningMatches;
......@@ -105,8 +105,8 @@ private:
typedef std::deque<char> t_BuildProcessingQueueType;
void ProcessBuffer(const char* data, int length, size_t& tick, size_t tick_len,
std::ofstream& ofs, t_BuildProcessingQueueType* queue);
void ProcessBuffer(const char* data, int length, size_t& tick,
size_t tick_len, std::ofstream& ofs, t_BuildProcessingQueueType* queue);
int ProcessSingleLine(const char* data);
t_BuildProcessingQueueType m_BuildProcessingQueue;
......
......@@ -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.
=========================================================================*/
......@@ -50,16 +50,18 @@ bool cmCTestConfigureCommand::InitialPass(
{
if ( res_var )
{
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
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.");
this->SetError("called with incorrect number of arguments. "
"SOURCE specified twice.");
return false;
}
havesource = true;
......@@ -68,7 +70,8 @@ bool cmCTestConfigureCommand::InitialPass(
{
if ( build_dir )
{
this->SetError("called with incorrect number of arguments. BUILD specified twice.");
this->SetError("called with incorrect number of arguments. "
"BUILD specified twice.");
return false;
}
havebuild = true;
......@@ -76,7 +79,8 @@ bool cmCTestConfigureCommand::InitialPass(
else
{
cmOStringStream str;
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
str << "called with incorrect number of arguments. Extra argument is: "
<< args[i].c_str() << ".";
this->SetError(str.str().c_str());
return false;
}
......@@ -100,20 +104,24 @@ bool cmCTestConfigureCommand::InitialPass(
build_dir = m_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");
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 = m_Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
const char* ctestConfigureCommand
= m_Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
if ( ctestConfigureCommand && *ctestConfigureCommand )
{
m_CTest->SetCTestConfiguration("ConfigureCommand", ctestConfigureCommand);
}
else
{
const char* cmakeGeneratorName = m_Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
const char* cmakeGeneratorName
= m_Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
if ( cmakeGeneratorName && *cmakeGeneratorName )
{
std::string cmakeConfigureCommand = "\"";
......@@ -123,19 +131,24 @@ bool cmCTestConfigureCommand::InitialPass(
cmakeConfigureCommand += "\" \"";
cmakeConfigureCommand += source_dir;
cmakeConfigureCommand += "\"";
m_CTest->SetCTestConfiguration("ConfigureCommand", cmakeConfigureCommand.c_str());
m_CTest->SetCTestConfiguration("ConfigureCommand",
cmakeConfigureCommand.c_str());
}
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.");
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 false;
}
}
cmCTestGenericHandler* handler = m_CTest->GetInitializedHandler("configure");
cmCTestGenericHandler* handler
= m_CTest->GetInitializedHandler("configure");
if ( !handler )
{
this->SetError("internal CTest error. Cannot instantiate configure handler");
this->SetError(
"internal CTest error. Cannot instantiate configure handler");
return false;
}
int res = handler->ProcessHandler();
......
......@@ -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.
=========================================================================*/
......@@ -29,11 +29,11 @@ class cmCTestConfigureCommand : public cmCTestCommand
public:
cmCTestConfigureCommand() {}
/**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
virtual cmCommand* Clone()
{
cmCTestConfigureCommand* ni = new cmCTestConfigureCommand;
ni->m_CTest = this->m_CTest;
......@@ -55,11 +55,11 @@ public:
/**
* Succinct documentation.
*/
virtual const char* GetTerseDocumentation()
virtual const char* GetTerseDocumentation()
{
return "Configures the repository.";
}
/**
* More documentation.
*/
......@@ -67,8 +67,9 @@ public:
{
return
" CTEST_CONFIGURE(BUILD build_dir RETURN_VALUE res)\n"
"Configures the given build directory and stores results in Configure.xml. The "
"second argument is a variable that will hold return value.";
"Configures the given build directory and stores results in "
"Configure.xml. The second argument is a variable that will hold "
"return value.";
}
cmTypeMacro(cmCTestConfigureCommand, cmCTestCommand);
......
......@@ -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.
=========================================================================*/
......@@ -43,15 +43,19 @@ int cmCTestConfigureHandler::ProcessHandler()
std::string cCommand = m_CTest->GetCTestConfiguration("ConfigureCommand");
if ( cCommand.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find ConfigureCommand key in the DartConfiguration.tcl"
<< std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot find ConfigureCommand key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
std::string buildDirectory = m_CTest->GetCTestConfiguration("BuildDirectory");
std::string buildDirectory
= m_CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl"
<< std::endl);
return -1;
}
......@@ -61,18 +65,20 @@ int cmCTestConfigureHandler::ProcessHandler()
int res = 0;
if ( !m_CTest->GetShowOnly() )
{
cmGeneratedFileStream os;
cmGeneratedFileStream os;
if ( !this->StartResultingXML("Configure", os) )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open configure file" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Cannot open configure file"
<< std::endl);
return 1;
}
std::string start_time = m_CTest->CurrentTime();
cmGeneratedFileStream ofs;
this->StartLogFile("Configure", ofs);
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: " << cCommand.c_str() << std::endl);
res = m_CTest->RunMakeCommand(cCommand.c_str(), &output,
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: "
<< cCommand.c_str() << std::endl);
res = m_CTest->RunMakeCommand(cCommand.c_str(), &output,
&retVal, buildDirectory.c_str(),
0, ofs);
......@@ -80,37 +86,41 @@ int cmCTestConfigureHandler::ProcessHandler()
{
ofs.close();
}
if ( os )
{
m_CTest->StartXML(os);
os << "<Configure>\n"
<< "\t<StartDateTime>" << start_time << "</StartDateTime>" << std::endl;
<< "\t<StartDateTime>" << start_time << "</StartDateTime>"
<< std::endl;
if ( res == cmsysProcess_State_Exited && retVal )
{
os << retVal;
}
os << "<ConfigureCommand>" << cCommand.c_str() << "</ConfigureCommand>" << std::endl;
os << "<ConfigureCommand>" << cCommand.c_str() << "</ConfigureCommand>"
<< std::endl;
cmCTestLog(m_CTest, DEBUG, "End" << std::endl);
os << "<Log>" << cmCTest::MakeXMLSafe(output) << "</Log>" << std::endl;
std::string end_time = m_CTest->CurrentTime();
os << "\t<ConfigureStatus>" << retVal << "</ConfigureStatus>\n"
<< "\t<EndDateTime>" << end_time << "</EndDateTime>\n"
<< "<ElapsedMinutes>"
<< "<ElapsedMinutes>"
<< static_cast<int>(
(cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0
<< "</ElapsedMinutes>"
<< "</Configure>" << std::endl;
m_CTest->EndXML(os);
}
}
}
else
{
cmCTestLog(m_CTest, DEBUG, "Configure with command: " << cCommand << std::endl);
cmCTestLog(m_CTest, DEBUG, "Configure with command: " << cCommand
<< std::endl);
}
if (! res || retVal )
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Error(s) when updating the project" << std::endl);
cmCTestLog(m_CTest, ERROR_MESSAGE, "Error(s) when updating the project"
<< std::endl);
return -1;
}
return 0;
......
......@@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc. 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.
=========================================================================*/
......@@ -35,7 +35,7 @@ public:
* The main entry point for this class
*/
int ProcessHandler();