[Cmake-commits] [cmake-commits] king committed cmAddTestCommand.cxx 1.30 1.31 cmTest.cxx 1.11 1.12 cmTest.h 1.6 1.7 cmTestGenerator.cxx 1.1 1.2
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Mar 16 10:42:44 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv29157/Source
Modified Files:
cmAddTestCommand.cxx cmTest.cxx cmTest.h cmTestGenerator.cxx
Log Message:
ENH: Refactor storage of test command lines
We used to separate the command executable from its argument vector.
It is simpler to just store the whole command line in one vector.
Index: cmTestGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTestGenerator.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmTestGenerator.cxx 16 Mar 2009 14:40:33 -0000 1.1
--- cmTestGenerator.cxx 16 Mar 2009 14:42:40 -0000 1.2
***************
*** 17,20 ****
--- 17,21 ----
#include "cmTestGenerator.h"
+ #include "cmSystemTools.h"
#include "cmTest.h"
***************
*** 97,108 ****
this->TestGenerated = true;
! cmTest* test = this->Test;
fout << indent;
fout << "ADD_TEST(";
! fout << test->GetName() << " \"" << test->GetCommand() << "\"";
! std::vector<cmStdString>::const_iterator argit;
! for (argit = test->GetArguments().begin();
! argit != test->GetArguments().end(); ++argit)
{
// Just double-quote all arguments so they are re-parsed
--- 98,112 ----
this->TestGenerated = true;
! // Get the test command line to be executed.
! std::vector<std::string> const& command = this->Test->GetCommand();
!
! std::string exe = command[0];
! cmSystemTools::ConvertToUnixSlashes(exe);
fout << indent;
fout << "ADD_TEST(";
! fout << this->Test->GetName() << " \"" << exe << "\"";
! for(std::vector<std::string>::const_iterator argit = command.begin()+1;
! argit != command.end(); ++argit)
{
// Just double-quote all arguments so they are re-parsed
Index: cmTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTest.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmTest.h 17 Jan 2008 23:13:55 -0000 1.6
--- cmTest.h 16 Mar 2009 14:42:37 -0000 1.7
***************
*** 38,47 ****
void SetName(const char* name);
const char* GetName() const { return this->Name.c_str(); }
! void SetCommand(const char* command);
! const char* GetCommand() const { return this->Command.c_str(); }
! void SetArguments(const std::vector<cmStdString>& args);
! const std::vector<cmStdString>& GetArguments() const
{
! return this->Args;
}
--- 38,46 ----
void SetName(const char* name);
const char* GetName() const { return this->Name.c_str(); }
!
! void SetCommand(std::vector<std::string> const& command);
! std::vector<std::string> const& GetCommand() const
{
! return this->Command;
}
***************
*** 68,73 ****
cmPropertyMap Properties;
cmStdString Name;
! cmStdString Command;
! std::vector<cmStdString> Args;
// The cmMakefile instance that owns this target. This should
--- 67,71 ----
cmPropertyMap Properties;
cmStdString Name;
! std::vector<std::string> Command;
// The cmMakefile instance that owns this target. This should
Index: cmTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTest.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -C 2 -d -r1.11 -r1.12
*** cmTest.cxx 7 Jan 2009 15:41:37 -0000 1.11
--- cmTest.cxx 16 Mar 2009 14:42:33 -0000 1.12
***************
*** 39,55 ****
}
! void cmTest::SetCommand(const char* command)
{
- if ( !command )
- {
- command = "";
- }
this->Command = command;
- cmSystemTools::ConvertToUnixSlashes(this->Command);
- }
-
- void cmTest::SetArguments(const std::vector<cmStdString>& args)
- {
- this->Args = args;
}
--- 39,45 ----
}
! void cmTest::SetCommand(std::vector<std::string> const& command)
{
this->Command = command;
}
Index: cmAddTestCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddTestCommand.cxx,v
retrieving revision 1.30
retrieving revision 1.31
diff -C 2 -d -r1.30 -r1.31
*** cmAddTestCommand.cxx 16 Mar 2009 14:40:22 -0000 1.30
--- cmAddTestCommand.cxx 16 Mar 2009 14:42:29 -0000 1.31
***************
*** 34,46 ****
return false;
}
-
- // store the arguments for the final pass
- // also expand any CMake variables
! std::vector<cmStdString> arguments;
! std::vector<std::string>::const_iterator it;
! for ( it = args.begin() + 2; it != args.end(); ++ it )
{
! arguments.push_back(*it);
}
--- 34,44 ----
return false;
}
! // Collect the command with arguments.
! std::vector<std::string> command;
! for(std::vector<std::string>::const_iterator it = args.begin() + 1;
! it != args.end(); ++it)
{
! command.push_back(*it);
}
***************
*** 53,58 ****
this->Makefile->AddTestGenerator(new cmTestGenerator(test));
}
! test->SetCommand(args[1].c_str());
! test->SetArguments(arguments);
return true;
--- 51,55 ----
this->Makefile->AddTestGenerator(new cmTestGenerator(test));
}
! test->SetCommand(command);
return true;
More information about the Cmake-commits
mailing list